Modify

Opened 20 months ago

Last modified 20 months ago

#22266 new defect

[PATCH][RFC] Report exceptions on plugin load better

Reported by: taylor.smock Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: Cc:

Description

See #22263.

Essentially, what happens is that there is an exception loading the plugin. We then ask the user to Keep or Disable the plugin. We do not offer (at any point) to report the issue.

Attachments (2)

22266.patch (2.4 KB ) - added by taylor.smock 20 months ago.
josm-custom.jar (16.0 MB ) - added by taylor.smock 20 months ago.
Test jar

Change History (4)

comment:1 by taylor.smock, 20 months ago

Summary: Report exceptions on plugin load better[PATCH][RFC] Report exceptions on plugin load better

by taylor.smock, 20 months ago

Attachment: 22266.patch added

comment:2 by taylor.smock, 20 months ago

With the following patch (DO NOT APPLY)

  • plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImportImagePlugin.java

    Cannot display: file marked as a binary type.
    svn:mime-type = application/java-archive
     
    6161     */
    6262    public ImportImagePlugin(PluginInformation info) throws IOException {
    6363        super(info);
     64        if (true) {
     65            throw new IllegalArgumentException("Test error on load");
     66        }
    6467
    6568        try {
    6669            // Initialize logger

The bug reports look like the following:


Build-Date:2022-08-02 16:04:13
Revision:18531
Is-Local-Build:true

Identification: JOSM/1.5 (18531 SVN en) Mac OS X 10.16
OS Build number: macOS 12.5 (21G72)
Memory Usage: 2161 MB / 3641 MB (171 MB allocated, but free)
Java version: 1.8.0_332-b09, Temurin, OpenJDK 64-Bit Server VM
Look and Feel: com.apple.laf.AquaLookAndFeel
Screen: Display 188945233 1920×1080 (scaling 1.00×1.00) Display 188945231 1920×1080 (scaling 1.00×1.00) Display 69733382 1680×1050 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→16×16, 32×32→32×32
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en_US
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:61835,suspend=y,server=n, -javaagent:/Users/tsmock/Library/Caches/JetBrains/IntelliJIdea2022.2/captureAgent/debugger-agent.jar, -Dfile.encoding=UTF-8]
Program arguments: [${HOME}/workspace/josm/core/MesaCounty.osm]
Dataset consistency test: No problems found

Plugins:
+ ImportImagePlugin
+ Mapillary (2.0.0-beta.15)
+ apache-commons (36003)
+ apache-http (35924)
+ ejml (35924)
+ geotools (36008)
+ jackson (36006)
+ jaxb (35952)
+ jna (36005)
+ jts (36004)
+ log4j (36007)
+ mapwithai (1.9.16)
+ todo (30306)
+ utilsplugin2 (36011)

Map paint styles:
+ https://josm.openstreetmap.de/josmfile?page=Styles/MapWithAI&zip=1

Last errors/warnings:
- 00014.070 E: Failed to locate image 'MapWithAI'
- 00014.292 E: org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin ImportImagePlugin. Cause: java.lang.reflect.InvocationTargetException. Cause: java.lang.IllegalArgumentException: Test error on load
- 00014.338 W: Disable plugin - Could not load plugin 'ImportImagePlugin'. Delete from preferences?
- 00019.042 E: Handled by bug report queue: org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin ImportImagePlugin. Cause: java.lang.reflect.InvocationTargetException. Cause: java.lang.IllegalArgumentException: Test error on load



=== REPORTED CRASH DATA ===
PluginHandler#loadPlugin:
No data collected.

Failing plugin:
 - name: ImportImagePlugin
 - localVersion: 35995
 - version: 35893
 - downloadlink: https://josm.openstreetmap.de/osmsvn/applications/editors/josm/dist/ImportImagePlugin.jar

Warning issued by: PluginHandler#loadPlugin

=== STACK TRACE ===
Thread: main (1)
org.openstreetmap.josm.plugins.PluginException: An error occurred in plugin ImportImagePlugin
	at org.openstreetmap.josm.plugins.PluginInformation.load(PluginInformation.java:387)
	at org.openstreetmap.josm.plugins.PluginHandler.loadPlugin(PluginHandler.java:816)
	at org.openstreetmap.josm.plugins.PluginHandler.loadPlugins(PluginHandler.java:912)
	at org.openstreetmap.josm.plugins.PluginHandler.loadLatePlugins(PluginHandler.java:964)
	at org.openstreetmap.josm.gui.MainApplication.loadLatePlugins(MainApplication.java:1226)
	at org.openstreetmap.josm.gui.MainApplication.mainJOSM(MainApplication.java:956)
	at org.openstreetmap.josm.gui.MainApplication$3.processArguments(MainApplication.java:277)
	at org.openstreetmap.josm.gui.MainApplication.main(MainApplication.java:741)
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:382)
	... 7 more
Caused by: java.lang.IllegalArgumentException: Test error on load
	at org.openstreetmap.josm.plugins.ImportImagePlugin.ImportImagePlugin.<init>(ImportImagePlugin.java:65)
	... 12 more

by taylor.smock, 20 months ago

Attachment: josm-custom.jar added

Test jar

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to taylor.smock.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


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