[weld-commits] Weld SVN: r4166 - in core/trunk/impl/src/main/java/org/jboss/weld: util and 1 other directory.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Sat Oct 17 14:34:25 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-10-17 14:34:25 -0400 (Sat, 17 Oct 2009)
New Revision: 4166

Modified:
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
   core/trunk/impl/src/main/java/org/jboss/weld/util/Names.java
Log:
merge marius' and my version fixes :-)

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java	2009-10-17 18:33:57 UTC (rev 4165)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java	2009-10-17 18:34:25 UTC (rev 4166)
@@ -146,7 +146,7 @@
    
    static
    {
-	   log.info("Weld " + getVersion());
+	   log.info("Weld " + Names.version(WeldBootstrap.class.getPackage()));
    }
 
    // The Bean manager
@@ -310,23 +310,6 @@
       }
       return this;
    }
-
-   /**
-    * Gets version information
-    * 
-    * @return The implementation version from the Bootstrap class package.
-    */
-   public static String getVersion()
-   {
-      Package pkg = WeldBootstrap.class.getPackage();
-      if (pkg != null)
-      {
-         //allow for the case when pkg.getImplementationVersion() == null
-         String pkgImplementationVersion = pkg.getImplementationVersion();
-         return pkgImplementationVersion != null ? Names.version(pkgImplementationVersion) : null;
-      }
-      return null;
-   }
    
    protected void initializeContexts()
    {

Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Names.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Names.java	2009-10-17 18:33:57 UTC (rev 4165)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Names.java	2009-10-17 18:34:25 UTC (rev 4166)
@@ -333,9 +333,17 @@
       return buffer.toString();
    }
    
-   public static String version(String version)
+   public static String version(Package pkg)
    {
-      return new StringBuilder().append(version.substring(0, version.lastIndexOf("-"))).append(" (").append(version.substring(version.lastIndexOf("-") + 1)).append(")").toString();
+      if (pkg != null)
+      {
+         String version = pkg.getImplementationVersion();
+         if (version != null)
+         {
+            return new StringBuilder().append(version.substring(0, version.lastIndexOf("-"))).append(" (").append(version.substring(version.lastIndexOf("-") + 1)).append(")").toString();
+         }
+      }
+      return "SNAPSHOT";
    }
 
 }



More information about the weld-commits mailing list