The CService class is actually named CRLFactory (and the inner class is named CertScanner, though this is irrelevant)

Scott M Stark wrote:
Run the attached ListJar on the ear in question.


import java.io.FileInputStream; import java.util.Enumeration; import java.util.Iterator; import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream;

/** A little utility that displays the contents of composite jars
 *
 * @author [EMAIL PROTECTED]
 * @version $Revision: 1.2 $
 */
public class ListJar
{
   static String[] jarSuffixes = {
      ".jar", ".zip", ".ear", ".war", ".sar"
   };
   static String jarPrefix = "+- ";
   static String entryPrefix = "|  ";
   static byte[] buffer = new byte[65535];
   static boolean showOnlyArchives = false;

   static
   {
      for(int i = 0; i < 10; i ++)
      {
         jarPrefix += "+- ";
         entryPrefix += "|  ";
      }
   }

   static boolean isJar(String name)
   {
      boolean isJar = false;
      for(int s = 0; isJar == false && s < jarSuffixes.length; s ++)
      {
         String suffix = jarSuffixes[s];
         isJar |= name.endsWith(suffix);
      }
      return isJar;
   }

   static void processEntry(ZipInputStream zis, ZipEntry entry, int level) throws Exception
   {
      String name = entry.getName();
      boolean isDirectory = entry.isDirectory();
      if( isDirectory == true )
         return;

      // See if this is a jar archive
      if( isJar(name) )
      {
         System.out.print(jarPrefix.substring(0, 3*level));
         System.out.println(name+" (archive)");
         try
         {
            ZipInputStream entryZIS = new ZipInputStream(zis);
            processJar(entryZIS, ++ level);
         }
         catch(Exception e)
         {
            e.printStackTrace();
         }
      }
      else if( name.endsWith("MANIFEST.MF") )
      {
         System.out.print(entryPrefix.substring(0, 3*(level-1)));
         System.out.print("+- ");
         System.out.print(name);
         Manifest mf = new Manifest(zis);
         Attributes main = mf.getMainAttributes();

         String cp = main.getValue(Attributes.Name.CLASS_PATH);
         if( cp != null )
         {
            System.out.print(" Class-Path: ");
            System.out.print(cp);
            System.out.print(' ');
         }
         System.out.println();
      }
      else if( showOnlyArchives == false )
      {
         System.out.print(entryPrefix.substring(0, 3*(level-1)));
         System.out.print("+- ");
         System.out.println(name);
      }
   }

   static void processJar(ZipInputStream zis, int level) throws Exception
   {
      ZipEntry entry;
      while( (entry = zis.getNextEntry()) != null )
      {
         processEntry(zis, entry, level);
      }
   }

   /** List the jar contents
    * @param args the command line arguments
    */
   public static void main(String[] args) throws Exception
   {
      String name = args[0];
      JarFile jarFile = new JarFile(name);
      Manifest mf = jarFile.getManifest();
      FileInputStream fis = new FileInputStream(name);
      ZipInputStream zis = new ZipInputStream(fis);
      System.out.println(name);
      processJar(zis, 1);
      System.out.println("Done");
   }

}
  

Attachment: results
Description: application/java-vm

Reply via email to