changeset 5882:7100059790df

DateGuesser: set times exactly (without parts of import time)
author Tom Gottfried <tom.gottfried@intevation.de>
date Tue, 30 Apr 2013 11:14:58 +0200
parents 1afeb674381d
children 4f35b34f4efa
files backend/src/main/java/org/dive4elements/river/utils/DateGuesser.java
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/utils/DateGuesser.java	Tue Apr 30 09:15:56 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/utils/DateGuesser.java	Tue Apr 30 11:14:58 2013 +0200
@@ -87,6 +87,7 @@
             String year  = m.group(1);
             String month = m.group(2);
             String day   = m.group(3);
+	    cal.clear();
             cal.set(
                 Integer.parseInt(year),
                 calendarMonth(month),
@@ -102,6 +103,7 @@
             String year  = m.group(3);
             String month = m.group(2);
             String day   = m.group(1);
+	    cal.clear();
             cal.set(
                 Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
                 calendarMonth(month),
@@ -118,6 +120,7 @@
                 Calendar cal = Calendar.getInstance();
                 String year = m.group(3);
                 String day  = m.group(1);
+		cal.clear();
                 cal.set(
                     Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
                     month,
@@ -136,6 +139,7 @@
             String day = m.group(3);
             String hour = m.group(4);
             String minute = m.group(5);
+	    cal.clear();
             cal.set(
                 Integer.parseInt(year),
                 calendarMonth(month),
@@ -157,6 +161,7 @@
             String hour = m.group(4);
             String minute = m.group(5);
             String second = m.group(6);
+	    cal.clear();
             cal.set(
                 Integer.parseInt(year),
                 calendarMonth(month),
@@ -177,6 +182,7 @@
             String day = m.group(1);
             String hour = m.group(4);
             String minute = m.group(5);
+	    cal.clear();
             cal.set(
                 Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
                 calendarMonth(month),
@@ -198,6 +204,7 @@
             String hour = m.group(4);
             String minute = m.group(5);
             String second = m.group(6);
+	    cal.clear();
             cal.set(
                 Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
                 calendarMonth(month),
@@ -224,6 +231,7 @@
             else {
                 year += 1900;
             }
+	    cal.clear();
             cal.set(
                 year,
                 Integer.parseInt(month),  // month
@@ -237,6 +245,7 @@
         if (m.matches()) {
             Calendar cal = Calendar.getInstance();
             String year = m.group(1);
+	    cal.clear();
             cal.set(
                 Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
                 5,  // month

http://dive4elements.wald.intevation.org