incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r900561 - /sling/trunk/contrib/scripting/java/src/main/java/org/apache/sling/scripting/java/jdt/CompilationUnit.java
Date Mon, 18 Jan 2010 21:13:48 GMT
Author: cziegeler
Date: Mon Jan 18 21:13:47 2010
New Revision: 900561

URL: http://svn.apache.org/viewvc?rev=900561&view=rev
Log:
Code cleanup

Modified:
    sling/trunk/contrib/scripting/java/src/main/java/org/apache/sling/scripting/java/jdt/CompilationUnit.java

Modified: sling/trunk/contrib/scripting/java/src/main/java/org/apache/sling/scripting/java/jdt/CompilationUnit.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/java/src/main/java/org/apache/sling/scripting/java/jdt/CompilationUnit.java?rev=900561&r1=900560&r2=900561&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/java/src/main/java/org/apache/sling/scripting/java/jdt/CompilationUnit.java
(original)
+++ sling/trunk/contrib/scripting/java/src/main/java/org/apache/sling/scripting/java/jdt/CompilationUnit.java
Mon Jan 18 21:13:47 2010
@@ -213,22 +213,25 @@
      * @see org.eclipse.jdt.internal.compiler.env.INameEnvironment#isPackage(char[][], char[])
      */
     public boolean isPackage(char[][] parentPackageName, char[] packageName) {
-        StringBuilder result = new StringBuilder();
+        if (Character.isUpperCase(packageName[0])) {
+            return false;
+        }
+        final StringBuilder builder = new StringBuilder();
         if (parentPackageName != null) {
             for (int i = 0; i < parentPackageName.length; i++) {
                 if (i > 0) {
-                    result.append(".");
+                    builder.append(".");
                 }
-                result.append(parentPackageName[i]);
+                builder.append(parentPackageName[i]);
             }
         }
-        String str = new String(packageName);
-        if (Character.isUpperCase(str.charAt(0)) && !isPackage(result.toString()))
{
-                return false;
+        if (!isPackage(builder.toString())) {
+            return false;
         }
-        result.append(".");
-        result.append(str);
-        return isPackage(result.toString());
+        builder.append(".");
+        builder.append(packageName);
+
+        return isPackage(builder.toString());
     }
 
     /**



Mime
View raw message