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 3
3
import com .xxdb .io .ExtendedDataInput ;
4
4
5
5
import java .io .IOException ;
6
+ import java .time .DateTimeException ;
6
7
import java .time .Month ;
7
8
import java .time .YearMonth ;
8
9
import java .time .format .DateTimeFormatter ;
@@ -19,6 +20,8 @@ public class BasicMonth extends BasicInt{
19
20
20
21
public BasicMonth (int year , Month month ){
21
22
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 ));
22
25
}
23
26
public BasicMonth (Calendar calendar ){
24
27
super ((calendar .get (Calendar .YEAR )) * 12 + calendar .get (Calendar .MONTH ));
@@ -33,6 +36,8 @@ public BasicMonth(ExtendedDataInput in) throws IOException {
33
36
34
37
protected BasicMonth (int value ){
35
38
super (value );
39
+ if (getInt () < 0 )
40
+ throw new DateTimeException (String .format ("number %d is invalid, it must be non-negative integer" , getInt ()));
36
41
}
37
42
38
43
You can’t perform that action at this time.
0 commit comments