changeset 5895:4110565baff8

backend: Fixed DateGuesser for DDMMYY.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 03 May 2013 12:51:29 +0200
parents 62e6598a2c4b
children 45871a108aae
files backend/src/main/java/org/dive4elements/river/utils/DateGuesser.java
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/utils/DateGuesser.java	Fri May 03 10:31:34 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/utils/DateGuesser.java	Fri May 03 12:51:29 2013 +0200
@@ -54,7 +54,7 @@
         Pattern.compile("^(\\d{1,2})\\.(\\d{1,2})\\.(\\d{2,4})T(\\d{1,2}):(\\d{2}):(\\d{2})$");
 
     public static final Pattern DDMMYY =
-        Pattern.compile("^(\\d{1,2})(\\d{1,2})(\\d{1,2})$");
+        Pattern.compile("^(\\d{2})(\\d{2})(\\d{2})$");
 
     private DateGuesser() {
     }
@@ -87,7 +87,7 @@
             String year  = m.group(1);
             String month = m.group(2);
             String day   = m.group(3);
-	    cal.clear();
+            cal.clear();
             cal.set(
                 Integer.parseInt(year),
                 calendarMonth(month),
@@ -103,11 +103,11 @@
             String year  = m.group(3);
             String month = m.group(2);
             String day   = m.group(1);
-	    cal.clear();
+            cal.clear();
             cal.set(
                 Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
                 calendarMonth(month),
-                Integer.parseInt(m.group(1)),
+                Integer.parseInt(day),
                 12, 0, 0);
             return cal.getTime();
         }
@@ -120,7 +120,7 @@
                 Calendar cal = Calendar.getInstance();
                 String year = m.group(3);
                 String day  = m.group(1);
-		cal.clear();
+                cal.clear();
                 cal.set(
                     Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
                     month,
@@ -139,7 +139,7 @@
             String day = m.group(3);
             String hour = m.group(4);
             String minute = m.group(5);
-	    cal.clear();
+            cal.clear();
             cal.set(
                 Integer.parseInt(year),
                 calendarMonth(month),
@@ -161,7 +161,7 @@
             String hour = m.group(4);
             String minute = m.group(5);
             String second = m.group(6);
-	    cal.clear();
+            cal.clear();
             cal.set(
                 Integer.parseInt(year),
                 calendarMonth(month),
@@ -182,7 +182,7 @@
             String day = m.group(1);
             String hour = m.group(4);
             String minute = m.group(5);
-	    cal.clear();
+            cal.clear();
             cal.set(
                 Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
                 calendarMonth(month),
@@ -204,7 +204,7 @@
             String hour = m.group(4);
             String minute = m.group(5);
             String second = m.group(6);
-	    cal.clear();
+            cal.clear();
             cal.set(
                 Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
                 calendarMonth(month),
@@ -231,7 +231,7 @@
             else {
                 year += 1900;
             }
-	    cal.clear();
+            cal.clear();
             cal.set(
                 year,
                 Integer.parseInt(month),  // month
@@ -245,7 +245,7 @@
         if (m.matches()) {
             Calendar cal = Calendar.getInstance();
             String year = m.group(1);
-	    cal.clear();
+            cal.clear();
             cal.set(
                 Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
                 5,  // month

http://dive4elements.wald.intevation.org