Opened 13 years ago

Closed 13 years ago

#176 closed enhancement (fixed)

Fix NumberFormatExceptions in different locales from IMT_Info()

Reported by: tfaksu@… Owned by: Peter Powers
Priority: major Milestone: OpenSHA 1.2
Component: sha Version: 1.0.x
Keywords: HazardSpectrumLocal Cc:

Description

Steps to reproduce: (PLEASE FILL IN)

Other info: (PLEASE FILL IN)

Application: HazardSpectrumLocal?
Version: 1.1.2
Bulid Type: dist

Metadata:

IMR Param List:


IMR = Boore, Joyner & Fumal (1997); Gaussian Truncation = None; Tectonic Region = Active Shallow Crust; Component = Average Horizontal; Std Dev Type = Total

Site Param List:


Longitude = 24.3; Latitude = 34.053; Vs30 = 760.0

IML/Prob Param List:


Map Type = IML@Prob; Probability = 0.5

Forecast Param List:


Eqk Rup Forecast = USGS/CGS 1996 Adj. Cal. ERF; Fault Model = Frankel's; GR Fraction on B Faults = 0.5; Rupture Offset = 10.0; Background Seismicity = Exclude

TimeSpan? Param List:


Duration = 50.0

Maximum Distance = 200.0

Exception:

java.lang.NumberFormatException: For input string: "0,00010"
	at sun.misc.FloatingDecimal.readJavaFormatString#Unknown Source#
	at java.lang.Double.parseDouble#Unknown Source#
	at org.opensha.sha.gui.infoTools.IMT_Info.getDefaultHazardCurve#IMT_Info.java:107#
	at org.opensha.sha.gui.HazardSpectrumLocalModeApplication.initX_Values#HazardSpectrumLocalModeApplication.java:646#
	at org.opensha.sha.gui.HazardSpectrumLocalModeApplication.computeHazardCurve#HazardSpectrumLocalModeApplication.java:305#
	at org.opensha.sha.gui.HazardCurveServerModeApplication.run#HazardCurveServerModeApplication.java:943#
	at java.lang.Thread.run#Unknown Source#

Change History (3)

comment:1 Changed 13 years ago by Kevin Milner

Resolution: invalid
Status: newclosed

Hello, sorry for taking so long to respond to this. OpenSHA only currently supports numbers which use decimal points, instead of commas to mark the radix point. We are working on better exception handling when this happens.

comment:2 Changed 13 years ago by Kevin Milner

Resolution: invalid
Status: closedreopened

Actually, I don't think this was a problem with user input. It appears that it's a problem with any system where a decimal comma is used by default, due to some code that combines DecimalFormat? and Double.parseDouble().

comment:3 Changed 13 years ago by Kevin Milner

Milestone: OpenSHA 2.0OpenSHA 1.2
Resolution: fixed
Status: reopenedclosed
Summary: Bug in HazardSpectrumLocalFix NumberFormatExceptions in different locales from IMT_Info()

OK I reproduced the bug by running the application with a French locality:

java -Duser.language=fr -Duser.country=FR org.opensha.sha.gui.HazardCurveLocalModeApplication

This has been fixed now (in revision [7767]). We'll eventually want to fix it better (see #259)/ I've also merged this update to the release branch, and re-released the apps as version 1.1.4.

You can re-launch the application to get this fix from this page: http://opensha.org/apps

Thanks for the bug report!

Note: See TracTickets for help on using tickets.