Bug#895234: libcommons-lang3-java: update for OpenJDK 10 and OpenJDK 11

2018-04-19 Thread Tiago Daitx
As per LP: #1765570 [1] I have been able to simplify the required
build steps to 3 simpler steps:

1) Apply the newly attached debdiff that includes the required patches
and overrides build/test/install targets, rebuild
2) Rebuild surefire, make sure the debian binary from step #1 is used
during build time
3) Rebuild this package without the 3 build/test/install overrides,
make sure the debian binaries from steps #1 and #2 are included during
build time

cheers!

References:
[1] https://bugs.launchpad.net/bugs/1765570
diff -Nru libcommons-lang3-java-3.5/debian/changelog libcommons-lang3-java-3.5/debian/changelog
--- libcommons-lang3-java-3.5/debian/changelog	2018-04-16 09:30:12.0 -0300
+++ libcommons-lang3-java-3.5/debian/changelog	2018-04-19 22:43:40.0 -0300
@@ -1,3 +1,16 @@
+libcommons-lang3-java (3.5-3) UNRELEASED; urgency=medium
+
+  * debian/patches/fix-openjdk-10-nullpointer-lang-1365.diff: calls to
+org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast cause
+NullPointerException when running under openjdk-10 which in turn causes
+other packages to FTBFS with the message "Execution default-cli of goal
+groupId:artifactId:version:jar failed.: NullPointerException -> [Help 1]".
+LP: #1765570. (Closes: #895234)
+  * debian/patches/fix-numeric-3-area-code-support-lang-1312.diff: pull
+upstream fix for numeric-3 area code support. (Closes: #895583)
+
+ -- Tiago Stürmer Daitx   Fri, 20 Apr 2018 01:43:40 +
+
 libcommons-lang3-java (3.5-2) unstable; urgency=medium
 
   * Team upload.
diff -Nru libcommons-lang3-java-3.5/debian/patches/fix-numeric-3-area-code-support-lang-1312.diff libcommons-lang3-java-3.5/debian/patches/fix-numeric-3-area-code-support-lang-1312.diff
--- libcommons-lang3-java-3.5/debian/patches/fix-numeric-3-area-code-support-lang-1312.diff	1969-12-31 21:00:00.0 -0300
+++ libcommons-lang3-java-3.5/debian/patches/fix-numeric-3-area-code-support-lang-1312.diff	2018-04-19 22:43:40.0 -0300
@@ -0,0 +1,65 @@
+Description: Fix UN M.49 numeric-3 area code support.
+ LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3
+ area code. 
+Author: pascalschumacher 
+Origin: upstream, https://github.com/apache/commons-lang/pull/239
+Bug: https://issues.apache.org/jira/browse/LANG-1312
+Bug-Debian: https://bug.debian.org/895234
+Forwarded: not-needed
+Applied-Upstream: https://github.com/apache/commons-lang/commit/4bd982d1a1df87724682c17c39bf27b5cbe389be
+Reviewed-by: Tiago Stürmer Daitx 
+Last-Update: 2018-04-13
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+
+From 4bd982d1a1df87724682c17c39bf27b5cbe389be Mon Sep 17 00:00:00 2001
+From: pascalschumacher 
+Date: Sun, 19 Feb 2017 20:39:05 +0100
+Subject: [PATCH] LANG-1312: LocaleUtils#toLocale does not support language
+ followed by UN M.49 numeric-3 area code (closes #239)
+
+---
+ src/main/java/org/apache/commons/lang3/LocaleUtils.java | 4 +++-
+ src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java | 7 +++
+ 3 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/src/main/java/org/apache/commons/lang3/LocaleUtils.java b/src/main/java/org/apache/commons/lang3/LocaleUtils.java
+index a3126ebf4..f13b52f38 100644
+--- a/src/main/java/org/apache/commons/lang3/LocaleUtils.java
 b/src/main/java/org/apache/commons/lang3/LocaleUtils.java
+@@ -67,6 +67,7 @@ public LocaleUtils() {
+  *   LocaleUtils.toLocale("")   = new Locale("", "")
+  *   LocaleUtils.toLocale("en") = new Locale("en", "")
+  *   LocaleUtils.toLocale("en_GB")  = new Locale("en", "GB")
++ *   LocaleUtils.toLocale("en_001") = new Locale("en", "001")
+  *   LocaleUtils.toLocale("en_GB_xxx")  = new Locale("en", "GB", "xxx")   (#)
+  * 
+  *
+@@ -134,7 +135,8 @@ public static Locale toLocale(final String str) {
+ case 1:
+ if (StringUtils.isAllLowerCase(split[0]) &&
+ (split[0].length() == 2 || split[0].length() == 3) &&
+- split[1].length() == 2 && StringUtils.isAllUpperCase(split[1])) {
++ (split[1].length() == 2 && StringUtils.isAllUpperCase(split[1])) ||
++  (split[1].length() == 3 && StringUtils.isNumeric(split[1]))) {
+ return new Locale(split[0], split[1]);
+ }
+ throw new IllegalArgumentException("Invalid locale format: " + str);
+diff --git a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
+index 4a867bab1..79198af5b 100644
+--- a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
 b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
+@@ -505,6 +505,13 @@ public void testLang328() {
+ assertValidToLocale("fr__POSIX", "fr", "", "POSIX");
+ }
+ 
++@Test
++public void testLanguageAndUNM49Numeric3AreaCodeLang1312() {
++assertValidToLoc

Bug#895234: libcommons-lang3-java: update for OpenJDK 10 and OpenJDK 11

2018-04-12 Thread Tiago Daitx
This fix (or testing it) might be blocked by bug #895587.

-- 
Tiago Stürmer Daitx
Software Engineer
tiago.da...@canonical.com

PGP Key: 4096R/F5B213BE (hkp://keyserver.ubuntu.com)
Fingerprint = 45D0 FE5A 8109 1E91 866E  8CA4 1931 8D5E F5B2 13BE



Bug#895234: libcommons-lang3-java: update for OpenJDK 10 and OpenJDK 11

2018-04-12 Thread Tiago Daitx
> 1) libcommons-lang3-java must be rebuild using openjdk-9 with docs and
> tests disabled
Then install the resulting deb binary.

> 2) rebuild with openjdk-10, keep doc and tests disabled
Or maybe with just tests disabled, I might have run with docs disabled
just to get a binary a bit faster. Tests must be disabled because for
some reason surefire seems to embed those classes into it's own jars
instead of using them from libcommons-lang3-java (otherwise installing
the deb binary from step #1 should have fixed it). And then, again,
install the resulting deb binary.

> 3) rebuild surefire with the new libcommons-lang3-java
It might also require the tests to be disabled IIRC. And then install
the deb binary.

> 4) rebuild libcommons-lang3-java with openjdk-10 with tests and docs enabled 
> (just to be sure it works)

surefire needs to be rebuild after uploading the deb binary from step #4.



Bug#895234: libcommons-lang3-java: update for OpenJDK 10 and OpenJDK 11

2018-04-12 Thread Tiago Daitx
On Sun, 8 Apr 2018 19:03:14 +0200 Matthias Klose  wrote:
> Package: src:libcommons-lang3-java
> Version: 3.5-1
> Severity: important
> Tags: patch sid buster
>
> Please either apply the following patches for 10 and 11, or update to the
> upstream 3.6 release, and only apply the latter patch for 11 (which will be in
> 3.7 upstream).
>
> https://git-wip-us.apache.org/repos/asf?p=commons-lang.git;a=commitdiff_plain;h=a618b844c5a261ced37385ab3947de6e215d46f7
>
> https://git-wip-us.apache.org/repos/asf?p=commons-lang.git;a=patch;h=50ce8c44e1601acffa39f5568f0fc140aade0564
>

After applying the openjdk-10 patch libcommons-lang3-java will FTBFS
due to a NullPointerException in the surefire plugin:

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test
(default-test) on project commons-lang3: Execution default-test of
goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test
failed.: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test
(default-test) on project commons-lang3: Execution default-test of
goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test
failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute
(MojoExecutor.java:213)

at org.codehaus.plexus.classworlds.launcher.Launcher.main
(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution
default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo
(DefaultBuildPluginManager.java:145)

at org.codehaus.plexus.classworlds.launcher.Launcher.main
(Launcher.java:356)
Caused by: java.lang.NullPointerException
at 
org.apache.maven.surefire.shade.org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast
(SystemUtils.java:1626)


and then another FTBFS due to a failing locale test as reported in bug #895583.

The current bug also affects libmaven-javadoc-plugin-java.

In order to get the build working some additional steps are required
due to the circular runtime dependency between libcommons-lang3-java,
libmaven-javadoc-plugin-java (doc generation), and libsurefire-java
(tests):
1) libcommons-lang3-java must be rebuild using openjdk-9 with docs and
tests disabled
2) rebuild with openjdk-10, keep doc and tests disabled
3) rebuild surefire with the new libcommons-lang3-java
4) rebuild libcommons-lang3-java with openjdk-10

I believe it is easier to do a binary upload after the last step than
trying to get the builds to do that correctly. Note that it can't be
rebuild with openjdk-8 in step #1 due to a "Method
flip()Ljava/nio/ByteBuffer" error in bnd.

Hopefully I described all the required steps above without missing any
- I got sidetracked checking the openjdk-8 failure and testing the fix
in a few other packages, so it took me a while to remember everything
I had to run and install.

Please consider the attached debdiff as it fixes both this bug as well
as bug #895583.

thanks
Tiago
diff -Nru libcommons-lang3-java-3.5/debian/changelog libcommons-lang3-java-3.5/debian/changelog
--- libcommons-lang3-java-3.5/debian/changelog	2016-10-20 15:08:15.0 -0200
+++ libcommons-lang3-java-3.5/debian/changelog	2018-04-12 10:14:49.0 -0300
@@ -1,3 +1,16 @@
+libcommons-lang3-java (3.5-2) UNRELEASED; urgency=medium
+
+  * debian/patches/fix-openjdk-10-nullpointer-lang-1365.diff: calls to
+org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast cause
+NullPointerException when running under openjdk-10 which in turn causes
+other packages to FTBFS with the message "Execution default-cli of goal
+groupId:artifactId:version:jar failed.: NullPointerException -> [Help 1]".
+(Closes: #895234)
+  * debian/patches/fix-numeric-3-area-code-support-lang-1312.diff: pull
+upstream fix for numeric-3 area code support. (Closes: #895583)
+
+ -- Tiago Stürmer Daitx   Thu, 12 Apr 2018 13:14:49 +
+
 libcommons-lang3-java (3.5-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru libcommons-lang3-java-3.5/debian/patches/fix-numeric-3-area-code-support-lang-1312.diff libcommons-lang3-java-3.5/debian/patches/fix-numeric-3-area-code-support-lang-1312.diff
--- libcommons-lang3-java-3.5/debian/patches/fix-numeric-3-area-code-support-lang-1312.diff	1969-12-31 21:00:00.0 -0300
+++ libcommons-lang3-java-3.5/debian/patches/fix-numeric-3-area-code-support-lang-1312.diff	2018-04-12 10:14:49.0 -0300
@@ -0,0 +1,65 @@
+Description: Fix UN M.49 numeric-3 area code support.
+ LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3
+ area code. 
+Author: pascalschumacher 
+Origin: upstream, https://github.com/apache/commons-lang/pull/239
+Bug: https://issues.apache.org/jira/browse/LANG-1312
+Bug-Debian: https://bug.debian.org/
+Forwarded: not-needed
+Applied-Upstream: https://github.com/apache/com

Bug#895234: libcommons-lang3-java: update for OpenJDK 10 and OpenJDK 11

2018-04-08 Thread Matthias Klose
Package: src:libcommons-lang3-java
Version: 3.5-1
Severity: important
Tags: patch sid buster

Please either apply the following patches for 10 and 11, or update to the
upstream 3.6 release, and only apply the latter patch for 11 (which will be in
3.7 upstream).

https://git-wip-us.apache.org/repos/asf?p=commons-lang.git;a=commitdiff_plain;h=a618b844c5a261ced37385ab3947de6e215d46f7

https://git-wip-us.apache.org/repos/asf?p=commons-lang.git;a=patch;h=50ce8c44e1601acffa39f5568f0fc140aade0564