struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1026245 - /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ResourceStoreClassLoader.java
Date Fri, 22 Oct 2010 08:39:27 GMT
Author: lukaszlenart
Date: Fri Oct 22 08:39:27 2010
New Revision: 1026245

URL: http://svn.apache.org/viewvc?rev=1026245&view=rev
Log:
Applied patch to solve WW-3486 - NPE when struts.convention.classes.reload is set to true

Modified:
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ResourceStoreClassLoader.java

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ResourceStoreClassLoader.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ResourceStoreClassLoader.java?rev=1026245&r1=1026244&r2=1026245&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ResourceStoreClassLoader.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ResourceStoreClassLoader.java
Fri Oct 22 08:39:27 2010
@@ -41,6 +41,7 @@ public final class ResourceStoreClassLoa
             for (final ResourceStore store : stores) {
                 final byte[] clazzBytes = store.read(fileName);
                 if (clazzBytes != null) {
+                    definePackage(name);
                     return defineClass(name, clazzBytes, 0, clazzBytes.length);
                 }
             }
@@ -80,4 +81,22 @@ public final class ResourceStoreClassLoa
         }
         return clazz;
     }
+
+    /**
+     * Define the package information associated with a class.
+     *
+     * @param className the class name of for which the package information
+     *                  is to be determined.
+     */
+    protected void definePackage(String className){
+        int classIndex = className.lastIndexOf('.');
+        if (classIndex == -1) {
+            return;
+        }
+        String packageName = className.substring(0, classIndex);
+        if (getPackage(packageName) != null) {
+            return;
+        }
+        definePackage(packageName, null, null, null, null, null, null, null);
+    }
 }



Mime
View raw message