NullPointerException on deserializing external system data

Answered

I've been having a really hard time getting a very complex project to import with my custom external system plugin. 

 

Currently I'm getting this crash:

java.lang.NullPointerException 
       at java.lang.String.hashCode(String.java:1467)
       at com.intellij.openapi.externalSystem.model.project.AbstractNamedData.hashCode(AbstractNamedData.java:88)
       at com.intellij.openapi.externalSystem.model.project.ModuleData.hashCode(ModuleData.java:279)
       at gnu.trove.TObjectHash.computeHashCode(TObjectHash.java:289)
       at gnu.trove.TObjectHash.index(TObjectHash.java:186)
       at com.intellij.util.containers.OpenTHashSet.index(OpenTHashSet.java:70)
       at com.intellij.util.containers.OpenTHashSet.get(OpenTHashSet.java:83)
       at com.intellij.util.containers.Interner.intern(Interner.java:43)
       at com.intellij.openapi.externalSystem.service.project.manage.DeduplicateVisitorsSupplier.visit(DeduplicateVisitorsSupplier.kt:37)
       at com.intellij.openapi.externalSystem.service.project.manage.DeduplicateVisitorsSupplier$getVisitor$2.apply(DeduplicateVisitorsSupplier.kt:20)
       at com.intellij.openapi.externalSystem.service.project.manage.DeduplicateVisitorsSupplier$getVisitor$2.apply(DeduplicateVisitorsSupplier.kt:13)
       at com.intellij.openapi.externalSystem.model.DataNode.visitData(DataNode.java:128)
       at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.lambda$ensureTheDataIsReadyToUse$5(ProjectDataManagerImpl.java:373)
       at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.visit(ExternalSystemApiUtil.java:285)
       at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.ensureTheDataIsReadyToUse(ProjectDataManagerImpl.java:371)
       at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.ensureTheDataIsReadyToUse(ProjectDataManagerImpl.java:442)
       at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.doImportData(ProjectDataManagerImpl.java:294)
       at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:168)
       at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:254)
       at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:261)

And to my eye, that seems to me that the data isn't fully deserialized by that point and the ModuleData's internalName has an invalid string where the inner value array is null. I'm not sure how this is possible.

5 comments
Comment actions Permalink

Thomas,

With a limited input, it's hard to say anything - above stack trace may lead us just to the assumptions that there's something wrong with handled data or maybe some applicationService extension, sorry.

0
Comment actions Permalink

Ah, ok. I'm going to presume it's something I'm doing causing this to happen. 

What could cause the de-serialization to behave this way? Could it be a cycle in the dependency graph? Or some other problem? Does FST know how to deal with cycles?

Previously I had some other odd intermittent crashes. While trying to figure it out i fixed things like removing duplicate ModuleDependencies, modules depending on themselves, and other types of errors. I've since fixed that but now it's always crashing at the same place.

If it helps, this is the full backtrace. I didn't think the entire thing would be relevant.

 

java.lang.NullPointerException
at java.lang.String.hashCode(String.java:1467)
at com.intellij.openapi.externalSystem.model.project.AbstractNamedData.hashCode(AbstractNamedData.java:88)
at com.intellij.openapi.externalSystem.model.project.ModuleData.hashCode(ModuleData.java:279)
at gnu.trove.TObjectHash.computeHashCode(TObjectHash.java:289)
at gnu.trove.TObjectHash.index(TObjectHash.java:186)
at com.intellij.util.containers.OpenTHashSet.index(OpenTHashSet.java:70)
at com.intellij.util.containers.OpenTHashSet.get(OpenTHashSet.java:83)
at com.intellij.util.containers.Interner.intern(Interner.java:43)
at com.intellij.openapi.externalSystem.service.project.manage.DeduplicateVisitorsSupplier.visit(DeduplicateVisitorsSupplier.kt:37)
at com.intellij.openapi.externalSystem.service.project.manage.DeduplicateVisitorsSupplier$getVisitor$2.apply(DeduplicateVisitorsSupplier.kt:20)
at com.intellij.openapi.externalSystem.service.project.manage.DeduplicateVisitorsSupplier$getVisitor$2.apply(DeduplicateVisitorsSupplier.kt:13)
at com.intellij.openapi.externalSystem.model.DataNode.visitData(DataNode.java:128)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.lambda$ensureTheDataIsReadyToUse$5(ProjectDataManagerImpl.java:373)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.visit(ExternalSystemApiUtil.java:285)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.ensureTheDataIsReadyToUse(ProjectDataManagerImpl.java:371)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.ensureTheDataIsReadyToUse(ProjectDataManagerImpl.java:442)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.doImportData(ProjectDataManagerImpl.java:294)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:168)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:254)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:261)
at ca.bulltech.intelij.extsys.ProjectRefreshCallback.lambda$onSuccess$1(ProjectRefreshCallback.java:77)
at ca.bulltech.intelij.extsys.ProjectRefreshCallback.onSuccess(ProjectRefreshCallback.java:94)
at com.intellij.openapi.externalSystem.service.project.ExternalProjectRefreshCallback.onSuccess(ExternalProjectRefreshCallback.java:41)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:569)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$5.run(ExternalSystemUtil.java:659)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:727)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:403)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
0
Comment actions Permalink

Ok, doesn't seem like I have any cycles. Odd.

 

Dropped some debug logging into visitData, and it appears the owner module for one or more ModuleDependency's has an invalid internalName string. Still not sure how this is possible.

0
Comment actions Permalink

I haven't dived into it too much yet, but it may be related to this: https://github.com/RuedigerMoeller/fast-serialization/issues/270

0
Comment actions Permalink

Yeah, changing to jdk serialization made the crash go away. So it would appear there's a problem in the fst library or the use of it, or both.

0

Please sign in to leave a comment.