Skip to content

Commit 571f6e8

Browse files
committed
Merge pull request #630 from keeps/alindo-dev-decimal-fix
fixed error when decimal or numeric type dont have precision or scale
2 parents 02cea63 + d6a0f67 commit 571f6e8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

dbptk-model/src/main/java/com/databasepreservation/model/structure/type/SimpleTypeNumericExact.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public class SimpleTypeNumericExact extends Type {
2121

2222
private Integer scale;
2323

24+
private static final Integer SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_PRECISION = 53;
25+
private static final Integer SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_SCALE = 10;
26+
2427
/**
2528
* Exact numeric, like int or integer
2629
*/
@@ -37,8 +40,13 @@ public SimpleTypeNumericExact() {
3740
* the number of digits after the radix point (optional)
3841
*/
3942
public SimpleTypeNumericExact(Integer precision, Integer scale) {
40-
this.precision = precision;
41-
this.scale = scale;
43+
if (precision == 0 && scale == 0) {
44+
this.precision = SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_PRECISION;
45+
this.scale = SIMPLE_TYPE_NUMERIC_EXACT_DEFAULT_SCALE;
46+
} else {
47+
this.precision = precision;
48+
this.scale = scale;
49+
}
4250
}
4351

4452
/**

0 commit comments

Comments
 (0)