click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r1002954 - /click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java
Date Thu, 30 Sep 2010 07:17:15 GMT
Author: sabob
Date: Thu Sep 30 07:17:14 2010
New Revision: 1002954

URL: http://svn.apache.org/viewvc?rev=1002954&view=rev
Log:
only prefix page classnames if a package is defined

Modified:
    click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java

Modified: click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java?rev=1002954&r1=1002953&r2=1002954&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java (original)
+++ click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java Thu Sep
30 07:17:14 2010
@@ -1043,7 +1043,7 @@ public class XmlConfigService implements
             }
 
             pagesPackage = pagesPackage.trim();
-            if (pagesPackage.endsWith(".")) {
+            if (pagesPackage.endsWith(".") && pagesPackage.length() > 1) {
                 pagesPackage =
                     pagesPackage.substring(0, pagesPackage.length() - 2);
             }
@@ -1992,41 +1992,41 @@ public class XmlConfigService implements
             }
 
             Class tmpPageClass = null;
-            String classFound = null;
+            String classnameFound = null;
 
             try {
 
                     // First, lookup classname as provided
                     tmpPageClass = ClickUtils.classForName(classname);
-                    classFound = classname;
+                    classnameFound = classname;
 
             } catch (ClassNotFoundException cnfe) {
-// For backward compatibility prefix classname with package name
-                String prefixedClassname = classname;
 
                 if (pagesPackage.trim().length() > 0) {
-                    prefixedClassname = pagesPackage + "." + classname;
-                }
-
-                try {
-                    // CLK-704
-                    // For backward compatibility, lookup classname prefixed with the package
name
+                    // For backward compatibility prefix classname with package name
+                    String prefixedClassname = pagesPackage + "." + classname;
 
-                    tmpPageClass = ClickUtils.classForName(prefixedClassname);
-                    classFound = prefixedClassname;
-
-                } catch (ClassNotFoundException cnfe2) {
-                    // Throw original exception which used the given classname
-                    String msg = "No class was found for the Page classname: '"
-                        + classname + "'.";
-                    throw new RuntimeException(msg, cnfe);
+                    try {
+                        // CLK-704
+                        // For backward compatibility, lookup classname prefixed with the
package name
+
+                        tmpPageClass =
+                            ClickUtils.classForName(prefixedClassname);
+                        classnameFound = prefixedClassname;
+
+                    } catch (ClassNotFoundException cnfe2) {
+                        // Throw original exception which used the given classname
+                        String msg = "No class was found for the Page classname: '"
+                            + classname + "'.";
+                        throw new RuntimeException(msg, cnfe);
+                    }
                 }
             }
 
             pageClass = tmpPageClass;
 
             if (!Page.class.isAssignableFrom(pageClass)) {
-                String msg = "Page class '" + classFound
+                String msg = "Page class '" + classnameFound
                              + "' is not a subclass of org.apache.click.Page";
                 throw new RuntimeException(msg);
             }



Mime
View raw message