[webbeans-commits] Webbeans SVN: r2688 - ri/trunk/impl/src/main/java/org/jboss/webbeans/util.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sun May 17 10:36:18 EDT 2009


Author: dallen6
Date: 2009-05-17 10:36:17 -0400 (Sun, 17 May 2009)
New Revision: 2688

Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Names.java
Log:
Made scopeTypeToString() behave better with non-initialized scopes

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Names.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Names.java	2009-05-15 19:58:11 UTC (rev 2687)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Names.java	2009-05-17 14:36:17 UTC (rev 2688)
@@ -48,19 +48,22 @@
     */
    public static String scopeTypeToString(Class<? extends Annotation> scopeType)
    {
-      String scopeName = scopeType.getSimpleName();
-      Matcher matcher = CAPITAL_LETTERS.matcher(scopeName);
       StringBuilder result = new StringBuilder();
-      int i = 0;
-      while (matcher.find())
+      if (scopeType != null)
       {
-         String name = matcher.group();
-         if (i > 0)
+         String scopeName = scopeType.getSimpleName();
+         Matcher matcher = CAPITAL_LETTERS.matcher(scopeName);
+         int i = 0;
+         while (matcher.find())
          {
-            name = name.toLowerCase();
+            String name = matcher.group();
+            if (i > 0)
+            {
+               name = name.toLowerCase();
+            }
+            result.append(name).append(" ");
+            i++;
          }
-         result.append(name).append(" ");
-         i++;
       }
       return result.toString();
    }




More information about the weld-commits mailing list