Skip to content
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

NullPointerException on detatch #370

Open
laeubi opened this issue Apr 23, 2021 · 2 comments
Open

NullPointerException on detatch #370

laeubi opened this issue Apr 23, 2021 · 2 comments

Comments

@laeubi
Copy link

laeubi commented Apr 23, 2021

I thee the following NPE ocasionally when detaching a class

java.lang.NullPointerException
        at java.base/java.util.Hashtable.put(Unknown Source)
        at javassist.ClassPool.cacheCtClass(ClassPool.java:236)
        at javassist.CtClass.detach(CtClass.java:1427)

Code used here:

CtClass ctClass = pool.makeClass(new ByteArrayInputStream(getClassBytes()));
try {
	//do something with the class...
} finally {
	ctClass.detach();
}

As I cache ClassPool object, it might get confused when called from differen threads?

@laeubi
Copy link
Author

laeubi commented Apr 23, 2021

But maybe there is more an intrinsic problem as I getting sometime spurious error also on other places.

@SACHDEVHITESH
Copy link

I am still getting the null pointer issue in the version 3.27.0-GA

Caused by: java.lang.NullPointerException
at javassist.ClassPool.cacheCtClass(ClassPool.java:236)
at javassist.CtClass.detach(CtClass.java:1427)
at com.microsoft.intune.mam.TransformationUnit.writeClassesToDirectory(TransformationUnit.java:275)
at com.microsoft.intune.mam.TransformationUnit.writeOutput(TransformationUnit.java:126)
at com.microsoft.intune.mam.BuildTimeMamifier.mamify(BuildTimeMamifier.java:131)
at com.microsoft.intune.mam.MamifyTransformBase.transform(MamifyTransformBase.java:195)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:284)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:69)
... 126 more

New issue Link
https://github.com/jboss-javassist/javassist/issues/442

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants