summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Clement2018-08-29 16:07:25 -0400
committerAndy Clement2018-08-29 16:07:25 -0400
commitdeb181f01c43d03e41b06cddf383503bfe943d8a (patch)
tree62d22bf4e49a3a04da559bf61c532c77cd27fd3f
parenta5c0fc936fbbe65f31339395aa8e369ffda7b136 (diff)
downloadorg.aspectj-deb181f01c43d03e41b06cddf383503bfe943d8a.tar.gz
org.aspectj-deb181f01c43d03e41b06cddf383503bfe943d8a.tar.xz
org.aspectj-deb181f01c43d03e41b06cddf383503bfe943d8a.zip
Fix 538393: Allow for toString() to fail on some classloaders
-rw-r--r--weaver/src/org/aspectj/weaver/ltw/LTWWorld.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/ltw/LTWWorld.java b/weaver/src/org/aspectj/weaver/ltw/LTWWorld.java
index 49185a2fb..a053acefd 100644
--- a/weaver/src/org/aspectj/weaver/ltw/LTWWorld.java
+++ b/weaver/src/org/aspectj/weaver/ltw/LTWWorld.java
@@ -73,7 +73,12 @@ public class LTWWorld extends BcelWorld implements IReflectionWorld {
public LTWWorld(ClassLoader loader, IWeavingContext weavingContext, IMessageHandler handler, ICrossReferenceHandler xrefHandler) {
super(loader, handler, xrefHandler);
this.weavingContext = weavingContext;
- classLoaderString = loader.toString();
+ try {
+ classLoaderString = loader.toString();
+ } catch (NullPointerException npe) {
+ // Possibly some state in the loader isn't initialized but is used in the toString()
+ classLoaderString = loader.getClass().getName()+":"+Integer.toString(System.identityHashCode(loader));
+ }
classLoaderParentString = (loader.getParent() == null ? "<NullParent>" : loader.getParent().toString());
setBehaveInJava5Way(LangUtil.is15VMOrGreater());
annotationFinder = ReflectionWorld.makeAnnotationFinderIfAny(loader, this);