View Issue Details

IDProjectCategoryView StatusLast Update
0004702SymmetricDS ProBugpublic2024-01-25 19:11
Reporterpmarzullo Assigned Topmarzullo  
Prioritynormal 
Status closedResolutionfixed 
Product Version3.11.13 
Target Version3.11.14Fixed in Version3.11.14 
Summary0004702: BigDecimal value in Row needs to use toPlainString() when returning string representation
DescriptionWhen 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 InformationActual 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;
        }
    }
.
.
.
}
Tagsdbimport/dbexport

Relationships

related to 0004703 closedpmarzullo BigDecimal value in Row needs to use toPlainString() when returning string representation 

Activities

There are no notes attached to this issue.

Related Changesets

SymmetricDS: 3.11 fb41dd6f

2020-12-14 18:44:31

pmarzullo

Details Diff
0004702: BigDecimal value in Row needs to use toPlainString() when
returning string representation
Affected Issues
0004702
mod - symmetric-db/src/main/java/org/jumpmind/db/sql/Row.java Diff File

SymmetricDS: 3.12 14d42f20

2020-12-14 18:44:31

pmarzullo

Details Diff
0004702: BigDecimal value in Row needs to use toPlainString() when
returning string representation
Affected Issues
0004702
mod - symmetric-db/src/main/java/org/jumpmind/db/sql/Row.java Diff File

Issue History

Date Modified Username Field Change
2020-12-14 17:52 pmarzullo New Issue
2020-12-14 17:52 pmarzullo Status new => assigned
2020-12-14 17:52 pmarzullo Assigned To => pmarzullo
2020-12-14 17:52 pmarzullo Tag Attached: dbexport
2020-12-14 17:59 pmarzullo Relationship added related to 0004703
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.11.14
2020-12-14 19:00 pmarzullo Changeset attached => SymmetricDS 3.11 fb41dd6f
2020-12-14 19:00 pmarzullo Changeset attached => SymmetricDS 3.12 14d42f20
2021-11-04 20:09 elong Status resolved => closed
2024-01-25 19:11 elong Tag Attached: dbimport/dbexport
2024-01-25 19:11 elong Tag Detached: dbexport