SQOOP-3441: Prepare Sqoop for Java 11 support

(Fero Szabo via Boglarka Egyed)
diff --git a/COMPILING.adoc b/COMPILING.adoc
index 2d7c899..1a7d24d 100644
--- a/COMPILING.adoc
+++ b/COMPILING.adoc
@@ -27,7 +27,7 @@
 
 Compiling Sqoop requires the following tools:
 
-* Apache ant (1.9.7) or Gradle (4.9)
+* Apache ant (1.9.7) or Gradle (5.4.1)
 * Java JDK 1.8
 
 Additionally, building the documentation requires these tools:
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 0d4a951..5c2d1cf 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a95009c..f4d7b2b 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index cccdd3d..b0d6d0a 100755
--- a/gradlew
+++ b/gradlew
@@ -1,5 +1,21 @@
 #!/usr/bin/env sh
 
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 ##############################################################################
 ##
 ##  Gradle start up script for UN*X
@@ -28,7 +44,7 @@
 APP_BASE_NAME=`basename "$0"`
 
 # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
 
 # Use the maximum available, or set MAX_FD != -1 to use that value.
 MAX_FD="maximum"
diff --git a/gradlew.bat b/gradlew.bat
index f955316..9991c50 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      http://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
 @if "%DEBUG%" == "" @echo off
 @rem ##########################################################################
 @rem
@@ -14,7 +30,7 @@
 set APP_HOME=%DIRNAME%
 
 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
 
 @rem Find java.exe
 if defined JAVA_HOME goto findJavaFromJavaHome
diff --git a/src/test/org/apache/sqoop/TestSqoopOptions.java b/src/test/org/apache/sqoop/TestSqoopOptions.java
index 39d2d7c..4779382 100644
--- a/src/test/org/apache/sqoop/TestSqoopOptions.java
+++ b/src/test/org/apache/sqoop/TestSqoopOptions.java
@@ -26,10 +26,12 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 import java.util.Random;
 import java.util.Set;
 import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.sqoop.manager.oracle.OracleUtils;
@@ -918,7 +920,7 @@
   }
 
   private <T> T createAndFill(Class<T> clazz) throws Exception {
-    T instance = clazz.newInstance();
+    T instance = clazz.getConstructor().newInstance();
     for(Field field: clazz.getDeclaredFields()) {
       if (field.getType().equals(clazz)
               || field.getType().equals(ClassLoader.class)
@@ -977,6 +979,9 @@
       int length = random.nextInt(9) + 1;
       return Array.newInstance(type.getComponentType(), length);
     }
+    else if (type.equals(ConcurrentHashMap.class)) {
+      return type.getConstructor().newInstance();
+    }
     else if (Number.class.isAssignableFrom(type)) {
       return random.nextInt(Byte.MAX_VALUE) + 1;
     }
diff --git a/src/test/org/apache/sqoop/accumulo/AccumuloTestCase.java b/src/test/org/apache/sqoop/accumulo/AccumuloTestCase.java
index 14413b1..982b135 100644
--- a/src/test/org/apache/sqoop/accumulo/AccumuloTestCase.java
+++ b/src/test/org/apache/sqoop/accumulo/AccumuloTestCase.java
@@ -23,9 +23,10 @@
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
+import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.net.URLClassLoader;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
@@ -184,22 +185,25 @@
 
     StringBuilder classpathBuilder = new StringBuilder(64);
     classpathBuilder.append(confDir.getAbsolutePath());
+    for (URL u : getUrlsFromClassPath()) {
+      append(classpathBuilder, u);
+    }
+    return classpathBuilder.toString();
+  }
 
-    // assume 0 is the system classloader and skip it
-    for (int i = 1; i < classloaders.size(); i++) {
-      ClassLoader classLoader = classloaders.get(i);
-
-      if (classLoader instanceof URLClassLoader) {
-
-        for (URL u : ((URLClassLoader) classLoader).getURLs()) {
-          append(classpathBuilder, u);
-        }
-      } else {
-        throw new IllegalArgumentException("Unknown classloader type : " + classLoader.getClass().getName());
+  public static URL[] getUrlsFromClassPath() {
+    String classpath = System.getProperty("java.class.path");
+    String[] entries = classpath.split(File.pathSeparator);
+    URL[] result = new URL[entries.length];
+    for(int i = 0; i < entries.length; i++) {
+      try {
+        result[i] = Paths.get(entries[i]).toAbsolutePath().toUri().toURL();
+      }
+      catch (MalformedURLException ex) {
+        throw new RuntimeException(ex);
       }
     }
-
-    return classpathBuilder.toString();
+    return result;
   }
 
   private static void append(StringBuilder classpathBuilder, URL url) throws URISyntaxException {