Opened 16 years ago

Closed 16 years ago

#259 closed defect (fixed)

Plugin installation problem (line breaks in file names!)

Reported by: flschm Owned by: josm@…
Priority: major Milestone:
Component: Core Version: latest
Keywords: plugins Cc:


Using the following JOSM version:

Path: josm
Repository Root:
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Revision: 320
Node Kind: directory
Last Changed Author: imi
Last Changed Rev: 320
Last Changed Date: 2007-09-04 15:41:49 +0200 (Tue, 04 Sep 2007)

with Java:

florian@qatan:~/.josm/plugins$ java -version[[BR]]
java version "1.5.0_10"[[BR]]
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)[[BR]]
Java HotSpot(TM) Client VM (build 1.5.0_10-b03, mixed mode, sharing)

Installation of any plugin using the plugins page of preferences dialog fails. Plugins are downloaded and registered in the preferences file, but both the plugin jar file name and the plugin name in the preferences file starts with two line feeds and some spaces. So the preferences file isn't valid any more and a fresh preferences file is created (the old one gets overwritten if one doesn't kill JOSM with CTRL+C).

Everything works fine if one renames both the jar and the plugin entry in the preferences after installation before restarting JOSM.

Plugin dir looks as follows (three plugins manually corrected, one corrupt):

florian@qatan:~/.josm/plugins$ ls -la
insgesamt 288
drwxr-xr-x 2 florian florian    256 2007-09-12 23:52 .
drwxr-xr-x 3 florian florian    168 2007-09-12 23:34 ..
-rw-r--r-- 1 florian florian   8466 2007-09-12 23:27 0-site-http___josm.openstreetmap.de_wiki_Plugins.xml
-rw-r--r-- 1 florian florian  16655 2007-09-12 23:52 ?  ?    geotagged.jar
-rw-r--r-- 1 florian florian  26326 2007-09-12 23:28 lang-de.jar
-rw-r--r-- 1 florian florian 216210 2007-09-12 23:31 mappaint.jar
-rw-r--r-- 1 florian florian  12411 2007-09-12 23:33 namefinder.jar

Preferences file looks as follows (same as above):




Attachments (0)

Change History (6)

comment:1 by Nukehead, 16 years ago

I encountered the same error.

comment:2 by florian.schmitt@…, 16 years ago


it seems that the problem is caused by a bug when parsing the plugin data file. The parser reads not only the plugin name, but also the surrounding whitespace and line feeds. I didn't understand fully how the parser works, but a quick and dirty fix could be to replace lines 76 ff. of class

@Override public void characters(char[] ch, int start, int length) {
    String s = new String(ch, start, length);
    characters += s;


@Override public void characters(char[] ch, int start, int length) {
    String s = new String(ch, start, length);
    s = s.replace("\n", "").trim();
    characters += s;

Of course, that's not a perfect fix, but it helps :-)


comment:3 by anonymous, 16 years ago

Version: releaselatest

comment:4 by anonymous, 16 years ago

Resolution: fixed
Status: newclosed

Fixed in 327 by using a trim() call on the resulting string in the XmlObjectParser. Not 100% sure if there are side effects but seems to work.

comment:5 by anonymous, 16 years ago

Priority: criticalmajor
Resolution: fixed
Status: closedreopened

The save-code for the Preferences should now allow saving unescaped newlines at all in the first place. or Properties.saveAsXML() already exist and do not have this bug.

comment:6 by Gabriel Ebner <ge@…>, 16 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in r439.

Modify Ticket

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