[jboss-cvs] JBossAS SVN: r106328 - branches/JBPAPP_5_1/build.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 29 14:41:22 EDT 2010


Author: fnasser at redhat.com
Date: 2010-06-29 14:41:22 -0400 (Tue, 29 Jun 2010)
New Revision: 106328

Modified:
   branches/JBPAPP_5_1/build/VersionRelease.java
Log:
Modify version-release program to skip signed JARs and to print more relevant information

Modified: branches/JBPAPP_5_1/build/VersionRelease.java
===================================================================
--- branches/JBPAPP_5_1/build/VersionRelease.java	2010-06-29 18:22:21 UTC (rev 106327)
+++ branches/JBPAPP_5_1/build/VersionRelease.java	2010-06-29 18:41:22 UTC (rev 106328)
@@ -91,6 +91,7 @@
       processDir(jbossHome);
       try
       {
+         System.out.println("VR: Creating jar-versions.xml file...");
          DocumentFactory df = DocumentFactory.getInstance();
          Document doc = df.createDocument();
          Element root = doc.addElement("jar-versions");
@@ -98,6 +99,7 @@
          while( iter.hasNext() )
          {
             JarInfo info = (JarInfo) iter.next();
+            System.out.println("VR: Add info for file: "+info.jarName);
             info.writeXML(root);
          }
 
@@ -130,19 +132,21 @@
    }
    void processFile(File file)
    {
-      System.out.println("Checking file: "+file);
       // See if this is a jar archive
       try
       {
          JarInfo info = new JarInfo(file, this);
+         System.out.println("VR: Checking file: "+file);
          info.write(md5);
          jars.add(info);
       }
       catch(FileNotFoundException e)
       {
+         System.out.println("VR: Skipping non-JAR file: "+file);
       }
       catch(Exception e)
       {
+         System.out.println("VR: Exception while checking file: "+file);
          e.printStackTrace();
       }
    }
@@ -154,8 +158,10 @@
 
       Manifest mf;
       JarFile jarFile;
+      JarEntry jarSignature;
       String jarName;
       boolean sealed;
+      boolean signed;
       String md5Digest;
       String specVersion;
       String specVendor;
@@ -173,7 +179,7 @@
          this.jarName = file.getName();
          this.tmpFile = new File(file.getAbsolutePath()+".tmp");
          if( file.renameTo(tmpFile) == false )
-            throw new IOException("Failed to rename: "+file);
+            throw new IOException("VR: Failed to rename: "+file);
 
          try
          {
@@ -182,15 +188,28 @@
          catch(IOException e)
          {
             tmpFile.renameTo(file);
-            throw new FileNotFoundException("Not a JarFile: "+file);
+            throw new FileNotFoundException("VR: Not a JarFile: "+file);
          }
 
-         this.mf = jarFile.getManifest();
+         try
+         {
+            this.mf = jarFile.getManifest();
+            this.jarSignature = jarFile.getJarEntry( "META-INF/JBOSSCOD.SF" );
+         }
+         catch(Exception e)
+         {
+            System.out.println("VR: Exception while getting info from file: "+file);
+            e.printStackTrace();
+            tmpFile.renameTo(file);
+         }
+
          Attributes mfAttrs = mf.getMainAttributes();
 
          String sealedAttr = mfAttrs.getValue(Attributes.Name.SEALED);
          sealed = Boolean.valueOf(sealedAttr).booleanValue();
 
+         signed = ( jarSignature == null) ? false : true;
+
          specVersion = mfAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
          if( specVersion == null )
          {
@@ -246,9 +265,10 @@
          throws IOException
       {
          md5.reset();
-         if( sealed == true )
+         if( ( sealed == true ) || ( signed == true ) )
          {
-            System.out.println("Skipping sealed jar: "+file);
+            tmpFile.renameTo(file);
+            System.out.println("VR: Skipping sealed or signed jar: "+file);
          }
          else
          {



More information about the jboss-cvs-commits mailing list