diff --git a/.gitignore b/.gitignore
index e69de29..86e0788 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,2 @@
+commons-lang-2.5-src.tar.gz
+/commons-lang-2.6-src.tar.gz
diff --git a/0000-Fix-FastDateFormat-for-Java-7-behaviour.patch b/0000-Fix-FastDateFormat-for-Java-7-behaviour.patch
new file mode 100644
index 0000000..122e56c
--- /dev/null
+++ b/0000-Fix-FastDateFormat-for-Java-7-behaviour.patch
@@ -0,0 +1,71 @@
+From 6af11cb2cfdf83ce013a531005077259984c55e7 Mon Sep 17 00:00:00 2001
+From: Stanislav Ochotnicky
Only formatting is supported, but all patterns are compatible with +- * SimpleDateFormat (except time zones - see below).
++ * SimpleDateFormat (except time zones and some year patterns - see below). + * + *Java 1.4 introduced a new pattern letter, 'Z'
, to represent
+ * time zones in RFC822 format (eg. +0800
or -1100
).
+@@ -60,6 +60,12 @@ import org.apache.commons.lang.text.StrBuilder;
+ * This introduces a minor incompatibility with Java 1.4, but at a gain of
+ * useful functionality.
Javadoc cites for the year pattern: For formatting, if the number of ++ * pattern letters is 2, the year is truncated to 2 digits; otherwise it is ++ * interpreted as a number. Starting with Java 1.7 a pattern of 'Y' or ++ * 'YYY' will be formatted as '2003', while it was '03' in former Java ++ * versions. FastDateFormat implements the behavior of Java 7.
++ * + * @author Apache Software Foundation + * @author TeaTrove project + * @author Brian S O'Neill +@@ -606,10 +612,10 @@ public class FastDateFormat extends Format { + rule = new TextField(Calendar.ERA, ERAs); + break; + case 'y': // year (number) +- if (tokenLen >= 4) { +- rule = selectNumberRule(Calendar.YEAR, tokenLen); +- } else { ++ if (tokenLen == 2) { + rule = TwoDigitYearField.INSTANCE; ++ } else { ++ rule = selectNumberRule(Calendar.YEAR, tokenLen < 4 ? 4 : tokenLen); + } + break; + case 'M': // month in year (text and number) +diff --git a/src/test/java/org/apache/commons/lang/time/FastDateFormatTest.java b/src/test/java/org/apache/commons/lang/time/FastDateFormatTest.java +index 8232747..bd4d664 100644 +--- a/src/test/java/org/apache/commons/lang/time/FastDateFormatTest.java ++++ b/src/test/java/org/apache/commons/lang/time/FastDateFormatTest.java +@@ -230,8 +230,9 @@ public class FastDateFormatTest extends TestCase { + " dddd ddd dd d DDDD DDD DD D EEEE EEE EE E aaaa aaa aa a zzzz zzz zz z"; + fdf = FastDateFormat.getInstance(pattern); + sdf = new SimpleDateFormat(pattern); +- assertEquals(sdf.format(date1), fdf.format(date1)); +- assertEquals(sdf.format(date2), fdf.format(date2)); ++ // SDF bug fix starting with Java 7 ++ assertEquals(sdf.format(date1).replaceAll("2003 03 03 03", "2003 2003 03 2003"), fdf.format(date1)); ++ assertEquals(sdf.format(date2).replaceAll("2003 03 03 03", "2003 2003 03 2003"), fdf.format(date2)); + + } finally { + Locale.setDefault(realDefaultLocale); +-- +1.7.7.6 + diff --git a/apache-commons-lang.spec b/apache-commons-lang.spec new file mode 100644 index 0000000..14cd1ea --- /dev/null +++ b/apache-commons-lang.spec @@ -0,0 +1,203 @@ +%global base_name lang +%global short_name commons-%{base_name} + +Name: apache-%{short_name} +Version: 2.6 +Release: 32%{?dist} +Summary: Provides a host of helper utilities for the java.lang API +License: ASL 2.0 + +URL: https://commons.apache.org/%{base_name} +Source0: https://archive.apache.org/dist/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.gz +Patch0: 0000-Fix-FastDateFormat-for-Java-7-behaviour.patch + +BuildArch: noarch + +BuildRequires: maven-local +BuildRequires: apache-commons-parent +BuildRequires: maven-surefire-provider-junit + +%description +The standard Java libraries fail to provide enough methods for +manipulation of its core classes. The Commons Lang Component provides +these extra methods. +The Commons Lang Component provides a host of helper utilities for the +java.lang API, notably String manipulation methods, basic numerical +methods, object reflection, creation and serialization, and System +properties. Additionally it contains an inheritable enum type, an +exception structure that supports multiple types of nested-Exceptions +and a series of utilities dedicated to help with building methods, such +as hashCode, toString and equals. + +%package javadoc +Summary: API documentation for %{name} + +%description javadoc +%{summary}. + +%prep +%setup -q -n %{short_name}-%{version}-src +%patch0 -p1 + +sed -i 's/\r//' *.txt *.html + +%mvn_file : %{name} %{short_name} +%mvn_alias : org.apache.commons: %{base_name}:%{base_name} + +# remove org.apache.commons.lang.enum package +# "enum" is a keyword since Java 4 and cannot be used as an identifier +rm -r src/main/java/org/apache/commons/lang/enum/ +rm -r src/test/java/org/apache/commons/lang/enum/ +rm src/test/java/org/apache/commons/lang/enums/EnumTest.java + +# convert some stray ISO-8859-1 characters to UTF-8 +iconv -f ISO-8859-1 -t UTF-8 \ + src/main/java/org/apache/commons/lang/Entities.java > \ + src/main/java/org/apache/commons/lang/Entities.java.utf-8 +mv src/main/java/org/apache/commons/lang/Entities.java.utf-8 \ + src/main/java/org/apache/commons/lang/Entities.java + +%build +%mvn_build -- \ + -Dcommons.osgi.symbolicName=org.apache.commons.lang \ + -Dmaven.compiler.source=1.8 \ + -Dmaven.compiler.target=1.8 \ + -Dsource=1.8 + +%install +%mvn_install + +%files -f .mfiles +%doc PROPOSAL.html RELEASE-NOTES.txt +%license LICENSE.txt NOTICE.txt + +%files javadoc -f .mfiles-javadoc +%license LICENSE.txt NOTICE.txt + +%changelog +* Sat Aug 15 2020 Fabio Valentini