@@ -190,12 +190,14 @@ private void checkContainingSince(DetailAST ast, SinceTag currentTag) {
190190 if (containingSince != null ) {
191191 SinceVersion current = currentTag .version ;
192192 SinceVersion container = containingSince .version ;
193- int comparison = current .compareTo (container );
194- if (comparison < 0 ) {
195- log (currentTag .lineNumber , currentTag .columnNumber , "javadoc.earlierSince" , current , container , containingSince .lineNumber , containingSince .columnNumber );
196- }
197- else if (comparison == 0 ) {
198- log (currentTag .lineNumber , currentTag .columnNumber , "javadoc.sameSince" , current , containingSince .lineNumber , containingSince .columnNumber );
193+ if (current != SinceVersion .UNKNOWN && container != SinceVersion .UNKNOWN ) {
194+ int comparison = current .compareTo (container );
195+ if (comparison < 0 ) {
196+ log (currentTag .lineNumber , currentTag .columnNumber , "javadoc.earlierSince" , current , container , containingSince .lineNumber , containingSince .columnNumber );
197+ }
198+ else if (comparison == 0 ) {
199+ log (currentTag .lineNumber , currentTag .columnNumber , "javadoc.sameSince" , current , containingSince .lineNumber , containingSince .columnNumber );
200+ }
199201 }
200202 }
201203 }
@@ -324,6 +326,10 @@ private static SinceTag find(DetailAST ast, TextBlock javadoc) {
324326
325327 private static final class SinceVersion implements Comparable <SinceVersion > {
326328
329+ private static final SinceVersion UNKNOWN = new SinceVersion (-1 , -1 , -1 , "unknown" );
330+
331+ private static final Pattern DATE_PATTERN = Pattern .compile ("[0-3][0-9]\\ .[0-1][0-9]\\ .20[0-2][0-9]" );
332+
327333 private final int major ;
328334
329335 private final int minor ;
@@ -340,11 +346,19 @@ private SinceVersion(int major, int minor, int patch, String text) {
340346 }
341347
342348 private static SinceVersion of (String text ) {
343- String [] components = text .split ("\\ ." );
344- int major = (components .length > 0 ) ? Integer .parseInt (components [0 ]) : 0 ;
345- int minor = (components .length > 1 ) ? Integer .parseInt (components [1 ]) : 0 ;
346- int patch = (components .length > 2 ) ? Integer .parseInt (components [2 ]) : 0 ;
347- return new SinceVersion (major , minor , patch , text );
349+ if (DATE_PATTERN .matcher (text ).matches ()) {
350+ return UNKNOWN ;
351+ }
352+ try {
353+ String [] components = text .split ("\\ ." );
354+ int major = (components .length > 0 ) ? Integer .parseInt (components [0 ]) : 0 ;
355+ int minor = (components .length > 1 ) ? Integer .parseInt (components [1 ]) : 0 ;
356+ int patch = (components .length > 2 ) ? Integer .parseInt (components [2 ]) : 0 ;
357+ return new SinceVersion (major , minor , patch , text );
358+ }
359+ catch (NumberFormatException ex ) {
360+ return UNKNOWN ;
361+ }
348362 }
349363
350364 public String toString () {
0 commit comments