Skip to content

Commit

Permalink
Address #257: Row always uses US Locale
Browse files Browse the repository at this point in the history
  • Loading branch information
fabuzaid21 committed Mar 11, 2018
1 parent 3b92043 commit ffd3b93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import com.google.common.base.Joiner;
import java.io.PrintStream;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;

/**
Expand All @@ -15,7 +17,8 @@
public class Row {

// Formatter for printing out doubles; print at least 1 and no more than 6 decimal places
private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("#.0#####");
private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("#.0#####",
DecimalFormatSymbols.getInstance(Locale.US));

private Schema schema; // not set by user
private List<Object> vals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void testSimple() {
Row row = new Row(Arrays.asList(5.0, "java"));
assertEquals(5.0, row.getAs(0), 1e-10);
assertEquals("java", row.getAs(1));
assertTrue(row.toString().contains("5.0"));
assertTrue(row.toString().contains(Row.DOUBLE_FORMAT.format(5.0)));

Schema schema = new Schema();
schema.addColumn(Schema.ColType.DOUBLE, "metric");
Expand Down

0 comments on commit ffd3b93

Please sign in to comment.