# HG changeset patch # User goetz # Date 1503282042 14400 # Node ID 8d2f07a78ac7a4f230ef8365cac50bd9e7305f80 # Parent dae7992b161596a7d999501908c92abfb4c60145 8185112: [TESTBUG] Serviceability tests cannot parse float if non US locale. Reviewed-by: simonis, goetz, dholmes Contributed-by: Arno Zeller diff -r dae7992b1615 -r 8d2f07a78ac7 hotspot/test/serviceability/tmtools/jstat/utils/JstatResults.java --- a/hotspot/test/serviceability/tmtools/jstat/utils/JstatResults.java Fri Aug 18 14:54:43 2017 -0700 +++ b/hotspot/test/serviceability/tmtools/jstat/utils/JstatResults.java Sun Aug 20 22:20:42 2017 -0400 @@ -23,6 +23,9 @@ package utils; import common.ToolResults; +import java.text.NumberFormat; +import java.text.ParseException; + /** * Results of running the jstat tool Concrete subclasses will detail the jstat @@ -55,7 +58,13 @@ */ public float getFloatValue(String name) { int valueNdx = new StringOfValues(getStdoutLine(0)).getIndex(name); - return Float.valueOf(new StringOfValues(getStdoutLine(1)).getValue(valueNdx)); + // Let the parsing use the current locale format. + try { + return NumberFormat.getInstance().parse(new StringOfValues(getStdoutLine(1)).getValue(valueNdx)).floatValue(); + } catch (ParseException e) { + throw new NumberFormatException(e.getMessage()); + } + } /** @@ -66,7 +75,11 @@ */ public int getIntValue(String name) { int valueNdx = new StringOfValues(getStdoutLine(0)).getIndex(name); - return Integer.valueOf(new StringOfValues(getStdoutLine(1)).getValue(valueNdx)); + try { + return NumberFormat.getInstance().parse(new StringOfValues(getStdoutLine(1)).getValue(valueNdx)).intValue(); + } catch (ParseException e) { + throw new NumberFormatException(e.getMessage()); + } } /**