[Dive4elements-commits] [PATCH] DateGuesser: set times exactly (without parts of import time)

Wald Commits scm-commit at wald.intevation.org
Tue Apr 30 11:15:09 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1367313298 -7200
# Node ID 7100059790dfbbded9f37cf43b23e9a15b586db8
# Parent  1afeb674381d855d5bcc60cef8f61fac4d113ff0
DateGuesser: set times exactly (without parts of import time)

diff -r 1afeb674381d -r 7100059790df backend/src/main/java/org/dive4elements/river/utils/DateGuesser.java
--- 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


More information about the Dive4elements-commits mailing list