support a few days difference between info in index page and in artifact metadata
git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk@1632807 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckIndexPageMojo.java b/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckIndexPageMojo.java
index 997aafd..fc8a1fe 100644
--- a/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckIndexPageMojo.java
+++ b/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckIndexPageMojo.java
@@ -20,7 +20,12 @@
*/
import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -194,7 +199,19 @@
private boolean isDateSimilar( String date1, String date2 )
{
- return date1.equals( date2 );
+ try
+ {
+ DateFormat df = new SimpleDateFormat( "yyyy-MM-dd" );
+ Date d1 = df.parse( date1 );
+ Date d2 = df.parse( date2 );
+
+ long daysDifference = ( d1.getTime() - d2.getTime() ) / ( 24 * 60 * 60 * 1000 );
+ return Math.abs( daysDifference ) < 7; // ok for 7 days difference
+ }
+ catch ( ParseException e )
+ {
+ return false;
+ }
}
@Override
diff --git a/dist-tools/dist-tool-plugin/src/site/markdown/todo.md b/dist-tools/dist-tool-plugin/src/site/markdown/todo.md
index bf48650..ef7aade 100644
--- a/dist-tools/dist-tool-plugin/src/site/markdown/todo.md
+++ b/dist-tools/dist-tool-plugin/src/site/markdown/todo.md
@@ -22,13 +22,13 @@
### Index Pages
-* support different dates in artifact metadata and in index page: it's consistent if difference is only a few days
-(date in index page is chosen by the release manager between the vote start and announce)
-
* check consistency between team information in [Maven parent pom][1] and in Apache LDAP [maven][2] and [maven-pmc][3] groups
# Done
+* support different dates in artifact metadata and in index page: it's consistent if difference is only a few days
+(date in index page is chosen by the release manager between the vote start and announce)
+
* See where to publish the result on Maven site
* jenkins site URL https://builds.apache.org/view/M-R/view/Maven/job/dist-tool-plugin/site