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.000000000 -0300
+++ libcommons-lang3-java-3.5/debian/changelog	2018-04-19 22:43:40.000000000 -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 <tiago.da...@ubuntu.com>  Fri, 20 Apr 2018 01:43:40 +0000
+
 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.000000000 -0300
+++ libcommons-lang3-java-3.5/debian/patches/fix-numeric-3-area-code-support-lang-1312.diff	2018-04-19 22:43:40.000000000 -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 <pascalschumac...@gmx.net>
+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 <tiago.da...@ubuntu.com>
+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 <pascalschumac...@gmx.net>
+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")   (#)
+      * </pre>
+      *
+@@ -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() {
++        assertValidToLocale("en_001", "en", "001");
++        assertValidToLocale("en_150", "en", "150");
++        assertValidToLocale("ar_001", "ar", "001");
++    }
++
+     /**
+      * Tests #LANG-865, strings starting with an underscore.
+      */
diff -Nru libcommons-lang3-java-3.5/debian/patches/fix-openjdk-10-nullpointer-lang-1365.diff libcommons-lang3-java-3.5/debian/patches/fix-openjdk-10-nullpointer-lang-1365.diff
--- libcommons-lang3-java-3.5/debian/patches/fix-openjdk-10-nullpointer-lang-1365.diff	1969-12-31 21:00:00.000000000 -0300
+++ libcommons-lang3-java-3.5/debian/patches/fix-openjdk-10-nullpointer-lang-1365.diff	2018-04-19 22:43:40.000000000 -0300
@@ -0,0 +1,202 @@
+Description: Fix missing openjdk-10 version
+ [LANG-1365] Fix NullPointerException in isJavaVersionAtLeast on Java 10,
+ add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10.
+Author: Gary Gregory <ggreg...@apache.org>
+Origin: https://git-wip-us.apache.org/repos/asf?p=commons-lang.git;a=patch;h=a618b844c5a261ced37385ab3947de6e215d46f7
+Bug: https://issues.apache.org/jira/browse/LANG-1365
+Bug-Debian: https://bugs.debian.org/895234
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1765570
+Applied-Upstream: https://git-wip-us.apache.org/repos/asf?p=commons-lang.git;a=commit;h=a618b844c5a261ced37385ab3947de6e215d46f7
+Reviewed-by: Tiago Stürmer Daitx <tiago.da...@ubuntu.com>
+Last-Update: 2018-04-12
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+
+From a618b844c5a261ced37385ab3947de6e215d46f7 Mon Sep 17 00:00:00 2001
+From: Gary Gregory <ggreg...@apache.org>
+Date: Fri, 3 Nov 2017 11:33:34 -0600
+Subject: [PATCH] [LANG-1365] Fix NullPointerException in isJavaVersionAtLeast
+ on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10.
+
+---
+ src/changes/changes.xml                            |  3 +-
+ .../java/org/apache/commons/lang3/JavaVersion.java | 11 ++++++++
+ .../java/org/apache/commons/lang3/SystemUtils.java | 12 ++++++++
+ .../org/apache/commons/lang3/JavaVersionTest.java  |  2 ++
+ .../org/apache/commons/lang3/SystemUtilsTest.java  | 33 +++++++++++++++++++++-
+ 5 files changed, 59 insertions(+), 2 deletions(-)
+
+--- a/src/changes/changes.xml
++++ b/src/changes/changes.xml
+@@ -45,7 +45,8 @@ The <action> type attribute can be add,u
+   </properties>
+   <body>
+ 
+-  <release version="3.5" date="2014-10-13" description="New features including Java 9 detection">
++  <release version="3.5" date="2017-MM-DD" description="New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.">
++    <action issue="LANG-1365" type="fix" dev="ggregory" due-to="Gary Gregory">Fix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10</action>
+     <action issue="LANG-1275" type="add" dev="oheger">Added a tryAcquire() method to TimedSemaphore.</action>
+     <action issue="LANG-1273" type="add" dev="ebourg" due-to="Jake Wang">Added a new property IS_OS_MAC_OSX_EL_CAPITAN in SystemUtils</action>
+     <action issue="LANG-1255" type="add" dev="britter" due-to="Kaiyuan Wang">Add DateUtils.toCalendar(Date, TimeZone)</action>
+--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java
++++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java
+@@ -81,10 +81,19 @@ public enum JavaVersion {
+ 
+     /**
+      * Java 9
++     * 
++     * @since 3.5
+      */
+     JAVA_9(9.0f, "9"),
+ 
+     /**
++     * Java 10
++     * 
++     * @since 3.7
++     */
++    JAVA_10(10.0f, "10"),
++
++    /**
+      * The most recent java version. Mainly introduced to avoid to break when a new version of Java is used.
+      */
+     JAVA_RECENT(maxVersion(), Float.toString(maxVersion()));
+@@ -167,6 +176,8 @@ public enum JavaVersion {
+             return JAVA_1_8;
+         } else if ("9".equals(nom)) {
+             return JAVA_9;
++        } else if ("10".equals(nom)) {
++            return JAVA_10;
+         }
+         if (nom == null) {
+             return null;
+--- a/src/main/java/org/apache/commons/lang3/SystemUtils.java
++++ b/src/main/java/org/apache/commons/lang3/SystemUtils.java
+@@ -971,6 +971,18 @@ public class SystemUtils {
+      */
+     public static final boolean IS_JAVA_9 = getJavaVersionMatches("9");
+ 
++    /**
++     * <p>
++     * Is {@code true} if this is Java version 10 (also 10.x versions).
++     * </p>
++     * <p>
++     * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
++     * </p>
++     *
++     * @since 3.7
++     */
++    public static final boolean IS_JAVA_10 = getJavaVersionMatches("10");
++
+     // Operating system checks
+     // -----------------------------------------------------------------------
+     // These MUST be declared after those above as they depend on the
+--- a/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
++++ b/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
+@@ -32,6 +32,7 @@ import static org.apache.commons.lang3.J
+ import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
+ import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
+ import static org.apache.commons.lang3.JavaVersion.JAVA_9;
++import static org.apache.commons.lang3.JavaVersion.JAVA_10;
+ import static org.apache.commons.lang3.JavaVersion.get;
+ import static org.apache.commons.lang3.JavaVersion.getJavaVersion;
+ 
+@@ -52,6 +53,7 @@ public class JavaVersionTest {
+         assertEquals("1.7 failed", JAVA_1_7, get("1.7"));
+         assertEquals("1.8 failed", JAVA_1_8, get("1.8"));
+         assertEquals("9 failed", JAVA_9, get("9"));
++        assertEquals("10 failed", JAVA_10, get("10"));
+         assertEquals("1.10 failed", JAVA_RECENT, get("1.10"));
+         // assertNull("2.10 unexpectedly worked", get("2.10"));
+         assertEquals("Wrapper method failed", get("1.5"), getJavaVersion("1.5"));
+--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
++++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+@@ -28,6 +28,7 @@ import static org.apache.commons.lang3.J
+ import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
+ import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
+ import static org.apache.commons.lang3.JavaVersion.JAVA_9;
++import static org.apache.commons.lang3.JavaVersion.JAVA_10;
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.assertFalse;
+ import static org.junit.Assert.assertNotNull;
+@@ -125,6 +126,7 @@ public class SystemUtilsTest {
+             assertFalse(SystemUtils.IS_JAVA_1_8);
+             assertFalse(SystemUtils.IS_JAVA_1_9);
+             assertFalse(SystemUtils.IS_JAVA_9);
++            assertFalse(SystemUtils.IS_JAVA_10);
+         } else if (javaVersion.startsWith("1.7")) {
+             assertFalse(SystemUtils.IS_JAVA_1_1);
+             assertFalse(SystemUtils.IS_JAVA_1_2);
+@@ -136,6 +138,7 @@ public class SystemUtilsTest {
+             assertFalse(SystemUtils.IS_JAVA_1_8);
+             assertFalse(SystemUtils.IS_JAVA_1_9);
+             assertFalse(SystemUtils.IS_JAVA_9);
++            assertFalse(SystemUtils.IS_JAVA_10);
+         } else if (javaVersion.startsWith("1.8")) {
+             assertFalse(SystemUtils.IS_JAVA_1_1);
+             assertFalse(SystemUtils.IS_JAVA_1_2);
+@@ -147,6 +150,7 @@ public class SystemUtilsTest {
+             assertTrue(SystemUtils.IS_JAVA_1_8);
+             assertFalse(SystemUtils.IS_JAVA_1_9);
+             assertFalse(SystemUtils.IS_JAVA_9);
++            assertFalse(SystemUtils.IS_JAVA_10);
+         } else if (javaVersion.startsWith("9")) {
+             assertFalse(SystemUtils.IS_JAVA_1_1);
+             assertFalse(SystemUtils.IS_JAVA_1_2);
+@@ -158,8 +162,21 @@ public class SystemUtilsTest {
+             assertFalse(SystemUtils.IS_JAVA_1_8);
+             assertTrue(SystemUtils.IS_JAVA_1_9);
+             assertTrue(SystemUtils.IS_JAVA_9);
++            assertFalse(SystemUtils.IS_JAVA_10);
++        } else if (javaVersion.startsWith("10")) {
++            assertFalse(SystemUtils.IS_JAVA_1_1);
++            assertFalse(SystemUtils.IS_JAVA_1_2);
++            assertFalse(SystemUtils.IS_JAVA_1_3);
++            assertFalse(SystemUtils.IS_JAVA_1_4);
++            assertFalse(SystemUtils.IS_JAVA_1_5);
++            assertFalse(SystemUtils.IS_JAVA_1_6);
++            assertFalse(SystemUtils.IS_JAVA_1_7);
++            assertFalse(SystemUtils.IS_JAVA_1_8);
++            assertFalse(SystemUtils.IS_JAVA_1_9);
++            assertFalse(SystemUtils.IS_JAVA_9);
++            assertTrue(SystemUtils.IS_JAVA_10);
+         } else {
+-            System.out.println("Can't test IS_JAVA value: "+javaVersion);
++            System.out.println("Can't test IS_JAVA value: " + javaVersion);
+         }
+     }
+ 
+@@ -406,6 +423,7 @@ public class SystemUtilsTest {
+             assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_7));
+             assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
+             assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_9));
++            assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_10));
+         } else if (SystemUtils.IS_JAVA_1_8) {
+             assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
+             assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
+@@ -416,6 +434,7 @@ public class SystemUtilsTest {
+             assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_7));
+             assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
+             assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_9));
++            assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_10));
+         } else if (SystemUtils.IS_JAVA_9) {
+             assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
+             assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
+@@ -426,6 +445,18 @@ public class SystemUtilsTest {
+             assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_7));
+             assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
+             assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_9));
++            assertFalse(SystemUtils.isJavaVersionAtLeast(JAVA_10));
++        } else if (SystemUtils.IS_JAVA_10) {
++            assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_1));
++            assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_2));
++            assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_3));
++            assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_4));
++            assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_5));
++            assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_6));
++            assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_7));
++            assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_1_8));
++            assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_9));
++            assertTrue(SystemUtils.isJavaVersionAtLeast(JAVA_10));
+         }
+     }
+ 
diff -Nru libcommons-lang3-java-3.5/debian/patches/series libcommons-lang3-java-3.5/debian/patches/series
--- libcommons-lang3-java-3.5/debian/patches/series	2018-04-16 09:30:12.000000000 -0300
+++ libcommons-lang3-java-3.5/debian/patches/series	2018-04-19 22:30:04.000000000 -0300
@@ -1 +1,3 @@
 disable_testGetUserHome_test.diff
+fix-openjdk-10-nullpointer-lang-1365.diff
+fix-numeric-3-area-code-support-lang-1312.diff
diff -Nru libcommons-lang3-java-3.5/debian/rules libcommons-lang3-java-3.5/debian/rules
--- libcommons-lang3-java-3.5/debian/rules	2018-04-16 09:30:12.000000000 -0300
+++ libcommons-lang3-java-3.5/debian/rules	2018-04-19 22:43:40.000000000 -0300
@@ -3,6 +3,14 @@
 %:
 	dh $@ --buildsystem=maven
 
+override_dh_auto_build:
+	dh_auto_build -- -X package -DskipTests
+
+override_dh_auto_test:
+
+override_dh_install:
+	dh_install -Xapidocs
+
 override_dh_installchangelogs:
 	dh_installchangelogs -- RELEASE-NOTES.txt
 

Reply via email to