@@ -348,7 +348,7 @@ public DerValue(byte[] encoding) throws IOException {
348348 length = lenByte ;
349349 } else { // long form
350350 lenByte &= 0x07f ;
351- if (lenByte < 0 || lenByte > 4 ) {
351+ if (lenByte > 4 ) {
352352 throw new IOException ("Invalid lenByte" );
353353 }
354354 if (len < 2 + lenByte ) {
@@ -455,11 +455,7 @@ public final DerInputStream data() {
455455 }
456456
457457 /**
458- * Returns the data field inside this class. This method should be
459- * avoided because the data field is mutable but every call always
460- * return the same object. The caller had better directly use the
461- * data field. A better way is to call data() that will always return
462- * a new DerInputStream that points to the beginning of the content.
458+ * Returns the data field inside this class directly.
463459 *
464460 * Both this method and the {@link #data} field should be avoided.
465461 * Consider using {@link #data()} instead.
@@ -825,7 +821,7 @@ private Date getTimeInternal(boolean generalized) throws IOException {
825821 */
826822
827823 int year , month , day , hour , minute , second , millis ;
828- String type = null ;
824+ String type ;
829825 int pos = start ;
830826 int len = end - start ;
831827
@@ -896,15 +892,9 @@ private Date getTimeInternal(boolean generalized) throws IOException {
896892 }
897893 pos ++;
898894 switch (precision ) {
899- case 1 :
900- millis += 100 * thisDigit ;
901- break ;
902- case 2 :
903- millis += 10 * thisDigit ;
904- break ;
905- case 3 :
906- millis += thisDigit ;
907- break ;
895+ case 1 -> millis += 100 * thisDigit ;
896+ case 2 -> millis += 10 * thisDigit ;
897+ case 3 -> millis += thisDigit ;
908898 }
909899 }
910900 if (precision == 0 ) {
@@ -1212,6 +1202,6 @@ DerValue[] subs(byte expectedTag, int startLen) throws IOException {
12121202 while (dis .available () > 0 ) {
12131203 result .add (dis .getDerValue ());
12141204 }
1215- return result .toArray (new DerValue [result . size () ]);
1205+ return result .toArray (new DerValue [0 ]);
12161206 }
12171207}
0 commit comments