Modify

Opened 5 years ago

Closed 5 years ago

#19420 closed defect (fixed)

mapwithai-dev=java.lang.NullPointerException

Reported by: Klumbumbus Owned by: taylor.smock
Priority: normal Milestone:
Component: Plugin mapwithai Version:
Keywords: Cc:

Description

Jenkins reports a NPE for the dev version. Could you please have a look?

https://josm.openstreetmap.de/jenkins/job/JOSM-Integration/lastCompletedBuild/testReport/

Attachments (0)

Change History (2)

comment:1 by taylor.smock, 5 years ago

It looks like either I will need to rework my plugin to avoid calling Territories during initialization, call Territories.initialize() during plugin startup, or add territories() to the test rules.
Stack trace:

2020-06-19 15:46:06.436 SEVERE: org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin mapwithai-dev. Cause: java.lang.reflect.InvocationTargetException. Cause: java.lang.ExceptionInInitializerError. Cause: java.lang.NullPointerException
org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin mapwithai-dev
        at org.openstreetmap.josm.plugins.PluginInformation.load(PluginInformation.java:369)
        at org.openstreetmap.josm.plugins.PluginHandler.loadPlugin(PluginHandler.java:810)
        at org.openstreetmap.josm.plugins.PluginHandler.loadPlugins(PluginHandler.java:896)
        at org.openstreetmap.josm.plugins.PluginHandler.loadLatePlugins(PluginHandler.java:939)
        at org.openstreetmap.josm.plugins.PluginHandlerTestIT.loadPlugins(PluginHandlerTestIT.java:206)
        at org.openstreetmap.josm.plugins.PluginHandlerTestIT.loadAllPlugins(PluginHandlerTestIT.java:198)
        at org.openstreetmap.josm.plugins.PluginHandlerTestIT.testValidityOfAvailablePlugins(PluginHandlerTestIT.java:72)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at mockit.integration.junit4.JUnit4TestRunnerDecorator.executeTestMethod(JUnit4TestRunnerDecorator.java:157)
        at mockit.integration.junit4.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:71)
        at mockit.integration.junit4.FakeFrameworkMethod.invokeExplosively(FakeFrameworkMethod.java:29)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.openstreetmap.josm.testutils.JOSMTestRules$CreateJosmEnvironment.evaluate(JOSMTestRules.java:697)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:43)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.Iterator.forEachRemaining(Iterator.java:116)
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
        at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:82)
        at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:73)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
        at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
        at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:141)
        at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:98)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.openstreetmap.josm.plugins.PluginInformation.load(PluginInformation.java:364)
        ... 60 more
Caused by: java.lang.ExceptionInInitializerError
        at org.openstreetmap.josm.plugins.mapwithai.gui.preferences.mapwithai.MapWithAILayerTableModel.getRowCount(MapWithAILayerTableModel.java:53)
        at javax.swing.table.DefaultTableModel.setDataVector(DefaultTableModel.java:224)
        at javax.swing.table.DefaultTableModel.<init>(DefaultTableModel.java:124)
        at javax.swing.table.DefaultTableModel.<init>(DefaultTableModel.java:106)
        at javax.swing.table.DefaultTableModel.<init>(DefaultTableModel.java:86)
        at org.openstreetmap.josm.plugins.mapwithai.gui.preferences.mapwithai.MapWithAILayerTableModel.<init>(MapWithAILayerTableModel.java:20)
        at org.openstreetmap.josm.plugins.mapwithai.gui.preferences.mapwithai.MapWithAIProvidersPanel.<clinit>(MapWithAIProvidersPanel.java:107)
        at org.openstreetmap.josm.plugins.mapwithai.gui.download.MapWithAIDownloadOptions.<init>(MapWithAIDownloadOptions.java:36)
        at org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin.<init>(MapWithAIPlugin.java:106)
        ... 65 more
Caused by: java.lang.NullPointerException
        at org.openstreetmap.josm.tools.Territories.getKnownIso3166Codes(Territories.java:78)
        at org.openstreetmap.josm.plugins.mapwithai.io.mapwithai.MapWithAISourceReader.getBounds(MapWithAISourceReader.java:163)
        at org.openstreetmap.josm.plugins.mapwithai.io.mapwithai.MapWithAISourceReader.parse(MapWithAISourceReader.java:127)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet.lambda$entryConsumer$0(Collections.java:1577)
        at java.util.Iterator.forEachRemaining(Iterator.java:116)
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntrySetSpliterator.forEachRemaining(Collections.java:1602)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
        at org.openstreetmap.josm.plugins.mapwithai.io.mapwithai.MapWithAISourceReader.parseJson(MapWithAISourceReader.java:89)
        at org.openstreetmap.josm.plugins.mapwithai.io.mapwithai.MapWithAISourceReader.parse(MapWithAISourceReader.java:107)
        at org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo$DefaultEntryLoader.loadSource(MapWithAILayerInfo.java:189)
        at org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo$DefaultEntryLoader.realRun(MapWithAILayerInfo.java:176)
        at org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo.loadDefaults(MapWithAILayerInfo.java:138)
        at org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo.load(MapWithAILayerInfo.java:117)
        at org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo.<init>(MapWithAILayerInfo.java:76)
        at org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo.<clinit>(MapWithAILayerInfo.java:59)
        ... 74 more

comment:2 by taylor.smock, 5 years ago

Resolution: fixed
Status: newclosed

I'm fixing this in https://gitlab.com/gokaart/JOSM_MapWithAI/-/merge_requests/201 .
I'm just catching the NPE and then initializing the necessary data for that particular method (so Territories.initializeInternalData() is being called).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain taylor.smock.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.