-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CtClass.detach() may generate NullPointerException #258
Comments
I may have time to look into this. Can you specify:
|
public void detach() {
ClassPool cp = getClassPool();
CtClass obj = cp.removeCached(getName());
if (obj != this)
cp.cacheCtClass(getName(), obj, false);
}
The more interesting question is why is this In any case, I have attached test code here: javassist-bug.zip. Essentially, it looks at every class loaded and lists all its interfaces and superclasses. The java agent can be used when running Apache's tika parser.
|
I am seeing the same issue with version 3.25.0-GA.
I am not sure if |
The specification is that any valid However, |
I am still getting the null pointer issue in the version 3.27.0-GA Caused by: java.lang.NullPointerException
|
Here is a stack trace:
This seems to be the conditions:
removeCached
returnsnull
leading toobj(null) != this
, whichHashTable
(for some Java implementation) does not allow.CtClass.java:
HashTable.java (openjdk):
This doesn't always happen, but when it does, it seems to only happen for CtClass instances representing interfaces.
For background, I'm instrumenting classes if they implement certain interfaces. So I'm examining a class' interfaces. After which, I'm trying to be efficient by cleaning up the class pool by calling
detach()
. This works fine for classes but for some interfaces, it fails. Note that I'm using javassist inside a java agent that is loaded by the Boot class loader (the usual default for java agent is System class loader).The text was updated successfully, but these errors were encountered: