View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004703 | SymmetricDS Pro | Bug | public | 2020-12-14 17:59 | 2024-01-25 19:11 |
Reporter | pmarzullo | Assigned To | pmarzullo | ||
Priority | normal | ||||
Status | closed | Resolution | fixed | ||
Product Version | 3.12.5 | ||||
Target Version | 3.12.6 | Fixed in Version | 3.12.6 | ||
Summary | 0004703: BigDecimal value in Row needs to use toPlainString() when returning string representation | ||||
Description | When a Row object has a BigDecimal value in it, the string representation that is returned by Row returns exponents when the scale (the number of digits to the right of the decimal point) is greater than 6. See code in "Steps To Reproduce" for demonstration of the problem. The Row object should use the toPlainString() method of BigDecimal when the object type is a BigDecimal. | ||||
Steps To Reproduce | public static void main(String[] args) { BigDecimal bd = new BigDecimal(BigInteger.valueOf(0l), 8); Row row = new Row("col1", bd); System.out.println(row.getString("col1")); System.out.println(bd.toPlainString()); bd = new BigDecimal(BigInteger.valueOf(0l), 7); row = new Row("col1", bd); System.out.println(row.getString("col1")); System.out.println(bd.toPlainString()); bd = new BigDecimal(BigInteger.valueOf(0l), 6); row = new Row("col1", bd); System.out.println(row.getString("col1")); System.out.println(bd.toPlainString()); } | ||||
Additional Information | Actual planned code change: Old method: public class Row . . . public String getString(String columnName, boolean checkForColumn) { Object obj = this.get(columnName); if (obj != null) { return obj.toString(); } else { if (checkForColumn) { checkForColumn(columnName); } return null; } } . . . } Updated method: public class Row . . . public String getString(String columnName, boolean checkForColumn) { Object obj = this.get(columnName); if (obj != null) { if(obj instanceof BigDecimal) { return ((BigDecimal) obj).toPlainString(); } else { return obj.toString(); } } else { if (checkForColumn) { checkForColumn(columnName); } return null; } } . . . } | ||||
Tags | dbimport/dbexport | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2020-12-14 17:59 | pmarzullo | New Issue | |
2020-12-14 17:59 | pmarzullo | Status | new => assigned |
2020-12-14 17:59 | pmarzullo | Assigned To | => pmarzullo |
2020-12-14 17:59 | pmarzullo | Tag Attached: dbexport | |
2020-12-14 17:59 | pmarzullo | Relationship added | related to 0004702 |
2020-12-14 18:49 | pmarzullo | Status | assigned => resolved |
2020-12-14 18:49 | pmarzullo | Resolution | open => fixed |
2020-12-14 18:49 | pmarzullo | Fixed in Version | => 3.12.6 |
2021-01-11 13:48 | admin | Status | resolved => closed |
2024-01-25 19:11 | elong | Tag Attached: dbimport/dbexport | |
2024-01-25 19:11 | elong | Tag Detached: dbexport |