Skip to content

Commit

Permalink
Made scopeTypeToString() behave better with non-initialized scopes
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2688 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
drallen committed May 17, 2009
1 parent 913af04 commit e906b3f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions impl/src/main/java/org/jboss/webbeans/util/Names.java
Expand Up @@ -48,19 +48,22 @@ public class Names
*/
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();
}
Expand Down

0 comments on commit e906b3f

Please sign in to comment.