Skip to content
Browse files

Merge pull request #3 from harbulot/master

Trying to load a classes in the unnamed package causes an exception
  • Loading branch information...
2 parents d307321 + 9273d07 commit 5e127aceb2f9199d52b6f1b4d9312e81738295de @kamranzafar committed May 12, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 JCL2/src/main/java/org/xeustechnologies/jcl/JarClassLoader.java
View
3 JCL2/src/main/java/org/xeustechnologies/jcl/JarClassLoader.java
@@ -261,7 +261,8 @@ public Class loadClass(String className, boolean resolveIt) {
* Preserve package name.
*/
if (result.getPackage() == null) {
- String packageName = className.substring( 0, className.lastIndexOf( '.' ) );
+ int lastDotIndex = className.lastIndexOf( '.' );
+ String packageName = (lastDotIndex >= 0) ? className.substring( 0, lastDotIndex) : "";
definePackage( packageName, null, null, null, null, null, null, null );
}

0 comments on commit 5e127ac

Please sign in to comment.
Something went wrong with that request. Please try again.