Hello community,

here is the log from the commit of package jakarta-commons-net for 
openSUSE:Factory checked in at 2012-03-22 12:33:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/jakarta-commons-net (Old)
 and      /work/SRC/openSUSE:Factory/.jakarta-commons-net.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "jakarta-commons-net", Maintainer is 
"[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/jakarta-commons-net/jakarta-commons-net.changes  
2011-09-23 02:03:57.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.jakarta-commons-net.new/jakarta-commons-net.changes 
    2012-03-22 12:33:49.000000000 +0100
@@ -1,0 +2,5 @@
+Mon Mar 12 13:58:33 UTC 2012 - [email protected]
+
+- fix bnc#749895 - ant FTP action fails on the date with leap year 
+
+-------------------------------------------------------------------

New:
----
  commons-net-ftp-leap-year-parsing.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ jakarta-commons-net.spec ++++++
--- /var/tmp/diff_new_pack.xTMkcR/_old  2012-03-22 12:33:50.000000000 +0100
+++ /var/tmp/diff_new_pack.xTMkcR/_new  2012-03-22 12:33:50.000000000 +0100
@@ -1,7 +1,7 @@
 #
-# spec file for package jakarta-commons-net (Version 1.4.1)
+# spec file for package jakarta-commons-net
 #
-# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -26,7 +26,7 @@
 
 Name:           jakarta-commons-net
 Version:        1.4.1
-Release:        2
+Release:        0
 Summary:        Jakarta Commons Net Package
 License:        Apache-2.0
 Group:          Development/Libraries/Java
@@ -41,8 +41,11 @@
 Patch0:         %{name}-crosslink.patch
 Patch1:         %{short_name}-%{version}-project_xml.patch
 Patch2:         %{short_name}-%{version}-project_properties.patch
-BuildRequires:  jpackage-utils >= 1.7.2
+#PATCH-FIX-UPSTREAM: bnc#749895
+#http://svn-master.apache.org/viewvc?view=revision&revision=1294922
+Patch3:         commons-net-ftp-leap-year-parsing.patch
 BuildRequires:  ant >= 1.6
+BuildRequires:  jpackage-utils >= 1.7.2
 %if ! %{without_tests}
 BuildRequires:  ant-junit >= 1.6
 BuildRequires:  junit >= 3.8.1
@@ -52,7 +55,6 @@
 BuildRequires:  oro
 %if %{with_maven}
 BuildRequires:  maven >= 1.1
-BuildRequires:  maven-plugins-base
 BuildRequires:  maven-plugin-changes
 BuildRequires:  maven-plugin-checkstyle
 BuildRequires:  maven-plugin-jcoverage
@@ -62,6 +64,7 @@
 BuildRequires:  maven-plugin-tasklist
 BuildRequires:  maven-plugin-test
 BuildRequires:  maven-plugin-xdoc
+BuildRequires:  maven-plugins-base
 BuildRequires:  saxon
 BuildRequires:  saxon-scripts
 %endif
@@ -83,7 +86,6 @@
 
 
 %package javadoc
-License:        Apache-2.0
 Summary:        Jakarta Commons Net Package
 Group:          Development/Libraries/Java
 Requires(post):   /bin/rm,/bin/ln
@@ -101,7 +103,6 @@
 %if %{with_maven}
 
 %package manual
-License:        Apache-2.0
 Summary:        Jakarta Commons Net Package
 Group:          Development/Libraries/Java
 
@@ -122,6 +123,7 @@
 %patch0 -b .sav
 %patch1 -b .sav
 %patch2 -b .sav
+%patch3 -p0
 # remove all binary libs
 find . -name "*.jar" -exec rm -f {} \;
 


++++++ commons-net-ftp-leap-year-parsing.patch ++++++
Index: src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java
===================================================================
--- src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java.orig 
2005-12-03 17:05:48.000000000 +0100
+++ src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java      
2012-03-13 10:30:30.520993343 +0100
@@ -67,44 +67,74 @@
         * 
         */
        public Calendar parseTimestamp(String timestampStr) throws 
ParseException {
-               Calendar now = Calendar.getInstance();
-               now.setTimeZone(this.getServerTimeZone());
-               
-               Calendar working = Calendar.getInstance();
-               working.setTimeZone(this.getServerTimeZone());
-               ParsePosition pp = new ParsePosition(0);
+            Calendar now = Calendar.getInstance();
+            return parseTimestamp(timestampStr, now);
+        }
 
-               Date parsed = null;
-               if (this.recentDateFormat != null) {
-                       parsed = recentDateFormat.parse(timestampStr, pp);
-               }
-               if (parsed != null && pp.getIndex() == timestampStr.length()) 
-               {
-                       working.setTime(parsed);
-                       working.set(Calendar.YEAR, now.get(Calendar.YEAR));
-                       if (working.after(now)) {
-                               working.add(Calendar.YEAR, -1);
-                       }
-               } else {
-                       pp = new ParsePosition(0);
-                       parsed = defaultDateFormat.parse(timestampStr, pp);
-                       // note, length checks are mandatory for us since
-                       // SimpleDateFormat methods will succeed if less than
-                       // full string is matched.  They will also accept, 
-                       // despite "leniency" setting, a two-digit number as
-                       // a valid year (e.g. 22:04 will parse as 22 A.D.) 
-                       // so could mistakenly confuse an hour with a year, 
-                       // if we don't insist on full length parsing.
-                       if (parsed != null && pp.getIndex() == 
timestampStr.length()) {
-                               working.setTime(parsed);
-                       } else {
-                               throw new ParseException(
-                                       "Timestamp could not be parsed with 
older or recent DateFormat", 
-                                       pp.getIndex());
-                       }
-               }
-               return working;
-       }
+        /**
+         * If the recentDateFormat member has been defined, try to parse the
+         * supplied string with that.  If that parse fails, or if the 
recentDateFormat
+         * member has not been defined, attempt to parse with the 
defaultDateFormat
+         * member.  If that fails, throw a ParseException.
+         *
+         * This method allows a {@link Calendar} instance to be passed in 
which represents the
+         * current (system) time.
+         *
+         * @see FTPTimestampParser#parseTimestamp(String)
+         * @param timestampStr The timestamp to be parsed
+         * @param serverTime The current time for the server
+         * @since 1.5
+         */
+        public Calendar parseTimestamp(String timestampStr, Calendar 
serverTime) throws ParseException {
+            Calendar working = (Calendar) serverTime.clone();
+            working.setTimeZone(getServerTimeZone()); // is this needed?
+
+            Date parsed = null;
+
+            if (recentDateFormat != null) {
+                Calendar now = (Calendar) serverTime.clone();// Copy this, 
because we may change it
+                now.setTimeZone(this.getServerTimeZone());
+                // Temporarily add the current year to the short date time
+                // to cope with short-date leap year strings.
+                // e.g. Java's DateFormatter will assume that "Feb 29 12:00" 
refers to
+                // Feb 29 1970 (an invalid date) rather than a potentially 
valid leap year date.
+                // This is pretty bad hack to work around the deficiencies of 
the JDK date/time classes.
+                String year = Integer.toString(now.get(Calendar.YEAR));
+                String timeStampStrPlusYear = timestampStr + " " + year;
+                SimpleDateFormat hackFormatter = new 
SimpleDateFormat(recentDateFormat.toPattern() + " yyyy",
+                        recentDateFormat.getDateFormatSymbols());
+                hackFormatter.setLenient(false);
+                hackFormatter.setTimeZone(recentDateFormat.getTimeZone());
+                ParsePosition pp = new ParsePosition(0);
+                parsed = hackFormatter.parse(timeStampStrPlusYear, pp);
+                // Check if we parsed the full string, if so it must have been 
a short date originally
+                if (parsed != null && pp.getIndex() == 
timeStampStrPlusYear.length()) {
+                    working.setTime(parsed);
+                    if (working.after(now)) { // must have been last year 
instead
+                        working.add(Calendar.YEAR, -1);
+                    }
+                    return working;
+                }
+            }
+
+            ParsePosition pp = new ParsePosition(0);
+            parsed = defaultDateFormat.parse(timestampStr, pp);
+            // note, length checks are mandatory for us since
+            // SimpleDateFormat methods will succeed if less than
+            // full string is matched.  They will also accept,
+            // despite "leniency" setting, a two-digit number as
+            // a valid year (e.g. 22:04 will parse as 22 A.D.)
+            // so could mistakenly confuse an hour with a year,
+            // if we don't insist on full length parsing.
+            if (parsed != null && pp.getIndex() == timestampStr.length()) {
+                working.setTime(parsed);
+            } else {
+                throw new ParseException(
+                        "Timestamp could not be parsed with older or recent 
DateFormat",
+                        pp.getErrorIndex());
+            }
+            return working;
+        }
 
        /**
         * @return Returns the defaultDateFormat.



-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to