File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 33import com .xxdb .io .ExtendedDataInput ;
44
55import java .io .IOException ;
6+ import java .time .DateTimeException ;
67import java .time .Month ;
78import java .time .YearMonth ;
89import java .time .format .DateTimeFormatter ;
@@ -19,6 +20,8 @@ public class BasicMonth extends BasicInt{
1920
2021 public BasicMonth (int year , Month month ){
2122 super (year * 12 + month .getValue ()-1 );
23+ if (getInt () < 0 )
24+ throw new DateTimeException (String .format ("year %d is invalid, it must be non-negative integer" , year ));
2225 }
2326 public BasicMonth (Calendar calendar ){
2427 super ((calendar .get (Calendar .YEAR )) * 12 + calendar .get (Calendar .MONTH ));
@@ -33,6 +36,8 @@ public BasicMonth(ExtendedDataInput in) throws IOException {
3336
3437 protected BasicMonth (int value ){
3538 super (value );
39+ if (getInt () < 0 )
40+ throw new DateTimeException (String .format ("number %d is invalid, it must be non-negative integer" , getInt ()));
3641 }
3742
3843
You can’t perform that action at this time.
0 commit comments