add apache-commons-lang
This commit is contained in:
parent
920ec01c6a
commit
5b00a70f8b
71
0002-Fix-FastDateFormat-for-Java-7-behaviour.patch
Normal file
71
0002-Fix-FastDateFormat-for-Java-7-behaviour.patch
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
From 6af11cb2cfdf83ce013a531005077259984c55e7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stanislav Ochotnicky <sochotnicky@redhat.com>
|
||||||
|
Date: Wed, 22 Feb 2012 11:21:06 +0100
|
||||||
|
Subject: [PATCH 2/2] Fix FastDateFormat for Java 7 behaviour
|
||||||
|
|
||||||
|
Backported from 1146138
|
||||||
|
See https://issues.apache.org/jira/browse/LANG-719 for more information
|
||||||
|
---
|
||||||
|
.../apache/commons/lang/time/FastDateFormat.java | 14 ++++++++++----
|
||||||
|
.../commons/lang/time/FastDateFormatTest.java | 5 +++--
|
||||||
|
2 files changed, 13 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/apache/commons/lang/time/FastDateFormat.java b/src/main/java/org/apache/commons/lang/time/FastDateFormat.java
|
||||||
|
index 2ca7e5c..b7e19ec 100644
|
||||||
|
--- a/src/main/java/org/apache/commons/lang/time/FastDateFormat.java
|
||||||
|
+++ b/src/main/java/org/apache/commons/lang/time/FastDateFormat.java
|
||||||
|
@@ -49,7 +49,7 @@ import org.apache.commons.lang.text.StrBuilder;
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>Only formatting is supported, but all patterns are compatible with
|
||||||
|
- * SimpleDateFormat (except time zones - see below).</p>
|
||||||
|
+ * SimpleDateFormat (except time zones and some year patterns - see below).</p>
|
||||||
|
*
|
||||||
|
* <p>Java 1.4 introduced a new pattern letter, <code>'Z'</code>, to represent
|
||||||
|
* time zones in RFC822 format (eg. <code>+0800</code> or <code>-1100</code>).
|
||||||
|
@@ -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.</p>
|
||||||
|
*
|
||||||
|
+ * <p>Javadoc cites for the year pattern: <i>For formatting, if the number of
|
||||||
|
+ * pattern letters is 2, the year is truncated to 2 digits; otherwise it is
|
||||||
|
+ * interpreted as a number.</i> 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.</p>
|
||||||
|
+ *
|
||||||
|
* @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
|
||||||
|
|
||||||
101
apache-commons-lang.spec
Normal file
101
apache-commons-lang.spec
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
Name: apache-commons-lang
|
||||||
|
|
||||||
|
Version: 2.6
|
||||||
|
|
||||||
|
Release: 23
|
||||||
|
|
||||||
|
Summary: Provides a host of helper utilities for the java.lang API
|
||||||
|
|
||||||
|
License: ASL 2.0
|
||||||
|
|
||||||
|
URL: http://commons.apache.org/lang
|
||||||
|
|
||||||
|
Source0: http://archive.apache.org/dist/commons/lang/source/commons-lang-2.6-src.tar.gz
|
||||||
|
|
||||||
|
Patch0000: 0002-Fix-FastDateFormat-for-Java-7-behaviour.patch
|
||||||
|
|
||||||
|
Patch9000: remove-2-test-fix-compile-with-bep-java.patch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
BuildRequires: maven-local apache-commons-parent maven-surefire-provider-junit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%description
|
||||||
|
|
||||||
|
The standard Java libraries fail to provide enough methods for manipulation of
|
||||||
|
|
||||||
|
its core classes. Apache Commons Lang provides these extra methods.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%package help
|
||||||
|
|
||||||
|
Summary: API documentation for apache-commons-lang
|
||||||
|
|
||||||
|
Provides: %{name}-javadoc = %{version}-%{release}
|
||||||
|
|
||||||
|
Obsoletes: %{name}-javadoc < %{version}-%{release}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%description help
|
||||||
|
|
||||||
|
The help for apache-commons-lang to use.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
|
||||||
|
%autosetup -n commons-lang-2.6-src -p1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%pom_add_plugin org.apache.maven.plugins:maven-javadoc-plugin . "
|
||||||
|
|
||||||
|
<configuration><source>1.3</source></configuration>"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%mvn_file : apache-commons-lang commons-lang
|
||||||
|
|
||||||
|
%mvn_alias : org.apache.commons: lang:lang
|
||||||
|
|
||||||
|
%mvn_config buildSettings/compilerSource 1.3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
%mvn_build
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
|
||||||
|
%mvn_install
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%files -f .mfiles
|
||||||
|
|
||||||
|
%doc PROPOSAL.html LICENSE.txt RELEASE-NOTES.txt NOTICE.txt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%files help -f .mfiles-javadoc
|
||||||
|
|
||||||
|
%doc LICENSE.txt NOTICE.txt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
|
||||||
|
* Thu Nov 14 2019 wangye<wangye54@huawei.com> - 2.6-23
|
||||||
|
|
||||||
|
- Package init
|
||||||
BIN
commons-lang-2.6-src.tar.gz
Normal file
BIN
commons-lang-2.6-src.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user