Skip to content

Commit 738e593

Browse files
committed
update Java version
1 parent c1dfc9b commit 738e593

File tree

4 files changed

+499
-141
lines changed

4 files changed

+499
-141
lines changed

api/com.upokecenter.cbor.CBORDateConverter.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,11 @@ Tries to extract the fields of a date and time in the form of a CBOR object.
167167
through 23.</li> <li>3 - Minute of the hour, from 0 through 59.</li>
168168
<li>4 - Second of the minute, from 0 through 59.</li> <li>5 -
169169
Fractional seconds, expressed in nanoseconds. This value cannot be
170-
less than 0.</li> <li>6 - Number of minutes to subtract from this
171-
date and time to get global time. This number can be positive or
172-
negative, but cannot be less than -1439 or greater than 1439. For
173-
tags 0 and 1, this value is always 0.</li></ul>.
170+
less than 0 and must be less than 1000*1000*1000.</li> <li>6 -
171+
Number of minutes to subtract from this date and time to get global
172+
time. This number can be positive or negative, but cannot be less
173+
than -1439 or greater than 1439. For tags 0 and 1, this value is
174+
always 0.</li></ul>.
174175

175176
**Returns:**
176177

src/main/java/com/upokecenter/cbor/CBORDateConverter.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,11 @@ public java.util.Date FromCBORObject(CBORObject obj) {
187187
* through 23.</li> <li>3 - Minute of the hour, from 0 through 59.</li>
188188
* <li>4 - Second of the minute, from 0 through 59.</li> <li>5 -
189189
* Fractional seconds, expressed in nanoseconds. This value cannot be
190-
* less than 0.</li> <li>6 - Number of minutes to subtract from this
191-
* date and time to get global time. This number can be positive or
192-
* negative, but cannot be less than -1439 or greater than 1439. For
193-
* tags 0 and 1, this value is always 0.</li></ul>.
190+
* less than 0 and must be less than 1000*1000*1000.</li> <li>6 -
191+
* Number of minutes to subtract from this date and time to get global
192+
* time. This number can be positive or negative, but cannot be less
193+
* than -1439 or greater than 1439. For tags 0 and 1, this value is
194+
* always 0.</li></ul>.
194195
* @return Either {@code true} if the method is successful, or {@code false}
195196
* otherwise.
196197
* @throws NullPointerException The parameter {@code year} or {@code
@@ -374,11 +375,13 @@ public CBORObject DateTimeFieldsToCBORObject(EInteger bigYear, int[]
374375
if (lesserFields == null) {
375376
throw new NullPointerException("lesserFields");
376377
}
378+
// TODO: Make into CBORException in next major version
377379
if (lesserFields.length < 7) {
378380
throw new IllegalArgumentException("\"lesserFields\" + \"'s length\" (" +
379381
lesserFields.length + ") is not greater or equal to 7");
380382
}
381383
try {
384+
CBORUtilities.CheckYearAndLesserFields(bigYear, lesserFields);
382385
switch (this.convType) {
383386
case TaggedString: {
384387
String str = CBORUtilities.ToAtomDateTimeString(bigYear,

0 commit comments

Comments
 (0)