Skip to content

Commit 0fa7dee

Browse files
author
lucaijun
committed
AJ-545: fix duration error prompt
1 parent dd8cd7f commit 0fa7dee

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/com/xxdb/data/BasicDuration.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,11 @@ public class BasicDuration extends AbstractScalar implements Comparable<BasicDur
1515
public BasicDuration(DURATION unit, int value){
1616
this.value = value;
1717
if (unit == DURATION.TDAY)
18-
throw new RuntimeException("the exchange unit should be given when use exchange calendar.");
18+
throw new RuntimeException("the exchange unit should be given as String when use exchange calendar.");
1919
this.unit = unit;
2020
this.exchange_ = unit.ordinal();
2121
}
2222

23-
public BasicDuration(DURATION unit, int value, String exchangeUnit) {
24-
this.value = value;
25-
this.unit = unit;
26-
if (this.unit == DURATION.TDAY)
27-
this.exchange_ = getCodeNumber(exchangeUnit);
28-
else
29-
this.exchange_ = this.unit.ordinal();
30-
}
31-
3223
public BasicDuration(String unit, int value) {
3324
this.value = value;
3425
int codeNumber = getCodeNumber(unit);
@@ -196,7 +187,7 @@ private int getCodeNumber(String unit) {
196187
}
197188
return (codes[0] << 24) + (codes[1] << 16) + (codes[2] << 8) + codes[3];
198189
} else {
199-
throw new RuntimeException(String.format("except duration enum type or length 4, got %s and length %d", unit, unit.length()));
190+
throw new RuntimeException("The value of unit must duration enum type or contain four consecutive uppercase letters.");
200191
}
201192
}
202193
}

0 commit comments

Comments
 (0)