[Dive4elements-commits] [PATCH 3 of 3] DateGuesser: Take current year modulo 100 if compare it with a two digit year value. Removed auto boxing

Wald Commits scm-commit at wald.intevation.org
Fri Jan 4 15:56:09 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1357311345 -3600
# Node ID 28fa48986ae9c6a70cec15a55d78151f45475968
# Parent  92a08725bc63da7d298a2cdf382c2545e1a518ec
DateGuesser: Take current year modulo 100 if compare it with a two digit year value. Removed auto boxing.

diff -r 92a08725bc63 -r 28fa48986ae9 flys-backend/src/main/java/de/intevation/flys/utils/DateGuesser.java
--- a/flys-backend/src/main/java/de/intevation/flys/utils/DateGuesser.java	Fri Jan 04 15:46:33 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/utils/DateGuesser.java	Fri Jan 04 15:55:45 2013 +0100
@@ -216,9 +216,10 @@
             Calendar cal = Calendar.getInstance();
             String day   = m.group(1);
             String month = m.group(2);
-            String yearS  = m.group(3);
-            Integer year = Integer.parseInt(yearS);
-            if (year <= Calendar.getInstance().get(Calendar.YEAR)) {
+            String yearS = m.group(3);
+            int year = Integer.parseInt(yearS);
+
+            if (year <= cal.get(Calendar.YEAR) % 100) {
                 year += 2000;
             }
             else {


More information about the Dive4elements-commits mailing list