Modify

Ticket #797 (closed defect: duplicate)

Opened 4 years ago

Last modified 3 years ago

lakewalker exceptions and wrong preference value format

Reported by: bodo@… Owned by: framm
Priority: major Component: Plugin
Version: latest Keywords: lakewalker
Cc:

Description

After updating the lakewalker plugin today I get exceptions on opening the preferences window or when I try to use lakewalker. (Yesterday I successfully used it.)

Besides updating lakewalker I deactivated the lang-de plugin and activated the usertools plugin.

The exception on opening the preferences window seems to be similar to ticket #604 (Lakewalker vs JOSM settings).

Path: josm URL:  http://www.openstreetmap.de/svn/josm Repository Root:  http://www.openstreetmap.de/svn/josm Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Revision: 645 Node Kind: directory Last Changed Author: david Last Changed Rev: 645 Last Changed Date: 2008-05-21 10:28:56 +0200 (Wed, 21 May 2008)

java.lang.IllegalArgumentException: Cannot format given Object as a Number

at java.text.DecimalFormat.format(Unknown Source) at java.text.Format.format(Unknown Source) at org.openstreetmap.josm.plugins.lakewalker.DoubleConfigurer.setValue(DoubleConfigurer.java:54) at org.openstreetmap.josm.plugins.lakewalker.LakewalkerPreferences.addGui(LakewalkerPreferences.java:84) at org.openstreetmap.josm.gui.preferences.PreferenceDialog.<init>(PreferenceDialog.java:92) at org.openstreetmap.josm.actions.PreferencesAction.actionPerformed(PreferencesAction.java:36) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.AbstractButton.doClick(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

The preferences window shows: lakewalker Version: 6924

I have the following plugins activated: namefinder 1.1 slippy_map_chooser 1.1 usertools 1.1 validator 7804 wmsplugin 3.0

java version 1.6.0_03

When I use lakewalker I get this exception in the command prompt window:

java.lang.NumberFormatException: For input string: "0,0003"

at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) at java.lang.Double.parseDouble(Unknown Source) at org.openstreetmap.josm.plugins.lakewalker.LakewalkerAction.lakewalk(LakewalkerAction.java:109) at org.openstreetmap.josm.plugins.lakewalker.LakewalkerAction.mouseClicked(LakewalkerAction.java:274) at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

I looked in the preferences values and found some lakewalker settings with numbers in European format:

lakewalker.east_offset=0,0 lakewalker.epsilon=0,0003 lakewalker.north_offset=0,0

When I change these values to 0.0 and 0.0003 and activate lakewalker, I can open the preferences window after restarting JOSM. When closing it with OK, I get a message that I have to restart JOSM and after this an exception message with the option to deactivate the lakewalker plugin. (same exception as above)

When I choose to deactivate lakewalker and restart JOSM, it has changed the three preferences to their wrong values as before.

After activating lakewalker again and restarting JOSM I get the same exception when opening the preferences window and the other exception as shown above when I try to use the lakewalker tool.

So I assume it is related to the wrong formatting of double numbers in the preferences values.

Bodo

Attachments

Change History

comment:1 Changed 4 years ago by bodo@…

I looked a bit at the source code. In DoubleConfigurer DecimalFormat.format() is used to convert from double to String but Double.valueOf() to convert from String to Double or in LakewalkerAction Double.parseDouble() to convert from String to double.

If I understand the documentation correct, DecimalFormat.format() creates a localized version of the formatted number but Double.valueOf() and Double.parseDouble() cannot parse this.

I think replacing the number formatting in DoubleConfigurer with a simple Double.toString(d) should fix thix problem.

Bodo

comment:2 Changed 4 years ago by bodo@…

The same problem was already reported as ticket #640.

comment:3 Changed 3 years ago by anonymous

  • Status changed from new to closed
  • Resolution set to duplicate

Other tickets with same issue: #746, 712, #657 #640

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.