diff options
author | Andy Clement <aclement@pivotal.io> | 2018-08-29 13:07:25 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2018-08-29 13:07:25 -0700 |
commit | deb181f01c43d03e41b06cddf383503bfe943d8a (patch) | |
tree | 62d22bf4e49a3a04da559bf61c532c77cd27fd3f /weaver | |
parent | a5c0fc936fbbe65f31339395aa8e369ffda7b136 (diff) | |
download | aspectj-deb181f01c43d03e41b06cddf383503bfe943d8a.tar.gz aspectj-deb181f01c43d03e41b06cddf383503bfe943d8a.zip |
Fix 538393: Allow for toString() to fail on some classloaders
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/ltw/LTWWorld.java | 7 |
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); |