Skip to content

Commit 31af742

Browse files
committed
Use the proper locale here too
1 parent 22ebd9e commit 31af742

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

base/standard/src/main/java/org/openscience/cdk/tools/FormatStringBuffer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636

3737

3838
import java.text.DecimalFormat;
39+
import java.text.DecimalFormatSymbols;
3940
import java.text.NumberFormat;
41+
import java.util.Locale;
4042

4143
/**
4244
* A class for formatting output similar to the C <tt>printf</tt> command.
@@ -333,9 +335,9 @@ public FormatStringBuffer format(double dbl) {
333335

334336
NumberFormat nf;
335337
if ((fmt.flags & SCI) > 0) {
336-
nf = new DecimalFormat("0.#E00");
338+
nf = new DecimalFormat("0.#E00", DecimalFormatSymbols.getInstance(Locale.US));
337339
} else {
338-
nf = NumberFormat.getInstance();
340+
nf = NumberFormat.getInstance(Locale.US);
339341
}
340342
nf.setGroupingUsed((fmt.flags & GROUPING) != 0);
341343
if (fmt.precision != -1) {

storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.openscience.cdk.smiles.CxSmilesState.PolymerSgroup;
2727

2828
import java.text.DecimalFormat;
29+
import java.text.DecimalFormatSymbols;
2930
import java.util.ArrayList;
3031
import java.util.Arrays;
3132
import java.util.Collections;
@@ -187,7 +188,7 @@ public int compare(List<Integer> a, List<Integer> b) {
187188
// 2D/3D Coordinates
188189
if (SmiFlavor.isSet(opts, SmiFlavor.CxCoordinates) &&
189190
state.atomCoords != null && !state.atomCoords.isEmpty()) {
190-
DecimalFormat fmt = new DecimalFormat("#.##");
191+
DecimalFormat fmt = new DecimalFormat("#.##", DecimalFormatSymbols.getInstance(Locale.US));
191192
if (sb.length() > 2) sb.append(',');
192193
sb.append('(');
193194
for (int i = 0; i < ordering.length; i++) {

tool/sdg/src/main/java/org/openscience/cdk/layout/IdentityTemplateLibrary.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@
4545
import java.io.OutputStream;
4646
import java.io.OutputStreamWriter;
4747
import java.text.DecimalFormat;
48+
import java.text.DecimalFormatSymbols;
4849
import java.util.ArrayList;
4950
import java.util.Collection;
5051
import java.util.Collections;
5152
import java.util.HashMap;
5253
import java.util.List;
54+
import java.util.Locale;
5355
import java.util.Map;
5456

5557
import static java.util.AbstractMap.SimpleEntry;
@@ -83,7 +85,7 @@
8385
*/
8486
final class IdentityTemplateLibrary {
8587

86-
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(".##");
88+
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(".##", DecimalFormatSymbols.getInstance(Locale.US));
8789

8890
private final Multimap<String, Point2d[]> templateMap = LinkedListMultimap.create();
8991

0 commit comments

Comments
 (0)