Modify

Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#6117 closed defect (fixed)

Marker Image load crashes on startup when used in plugin under windows

Reported by: anubis@… Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: plugin ButtonMarker Cc:

Description

I made a little plugin that is supposed to read custom markers from a custom file format.
For some data types (video,text,audio) i added customized Marker types which are dirived from ButtonMarker and which define an own icon to display on the map.
While it works fine under linux (ubuntu 10.10) it crashes on Windows (tested 2 PC with Windows 7, multiple JOSM versions tested). The Plugin loader produces an Exception when trying to load the custom images i guess.
The code for the Plugin can be found here:
http://code.google.com/p/swp-dv-ws2010-osm-1/source/browse/#svn%2Ftrunk%2FTraceBookImport

As i think the reason for this is the usage of the ButtonMarker class it can be considered a core issue.

Attachments (0)

Change History (6)

comment:1 by anubis@…, 14 years ago

i traced the problem down to the implementation of ImageProvider and i think the problem is line 151 in ImageProvider.java:

 else if (!subdir.equals("")) {
            subdir += "/";
        }

in my case the subdir is markers, which results in the ImageMarker.getIfAvailableImpl(...) adding "/" between the subdir and the filename, which somehow conflicts with how the plugins folders (in the jar) are mapped into josm in windows.
I think a fix would be adding an OS-Independent Seperator constant instead of "/".

in reply to:  1 comment:2 by anonymous, 14 years ago

update: i tried building a custom JOSM where the "/" is replaced by File.seperatorChar, but it doesnt solve the problem.
here is the error log:


Uncaught error fetching image:
java.lang.NullPointerException

at java.util.Arrays$ArrayList.<init>(Unknown Source)
at java.util.Arrays.asList(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.awt.image.URLImageSource.getDecoder(Unknown Source)
at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
at sun.awt.image.ImageFetcher.run(Unknown Source)

comment:3 by stoecker, 14 years ago

I don't think this can be the reason. We are accessing many files this way.

To help you, first of all, you should not tell it crashed, but rather paste the exception itself. Second step is to verify if the files actually are correctly included in the plugin ".jar" file in an images folder.

You error messages is only partial, so there is no way to find out which JOSM code is used.

comment:4 by anubis@…, 14 years ago

I found the error, the problem is that the plugin icon was set to "..." (default) which caused JOSM to crash, maybe someone can fix this in the future that it just loads NO icon instead of crashing... I solved it for me by defining an icon, but for some users who want to create plugins it may be irritating how JOSM handles the plugin icons differently on different OS

comment:5 by stoecker, 14 years ago

Resolution: fixed
Status: newclosed

"..." is not default. It is wrong. You actually tell the software to load a icon called "....png" which fails. It fails for all OS versions the same.

If you have no icon, simply provide no corresponding information. JOSM can handle icons as optional and required. When required icons are missing, then it is a programming bug and an exception is perfectly valid (optional icons are e.g. used in external styles and presets).

comment:6 by anubis@…, 14 years ago

by "default" i meant it is set to "..." in the default build.xml that ships with the plugin development sample.
The problem is that it should crash on Linux too, but it obviously doesn't.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
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.