mirror of
https://github.com/apache/sqoop.git
synced 2025-05-02 05:00:01 +08:00
SQOOP-3441: Prepare Sqoop for Java 11 support
(Fero Szabo via Boglarka Egyed)
This commit is contained in:
parent
be260e3096
commit
cee4ab15c7
@ -27,7 +27,7 @@ under the License.
|
|||||||
|
|
||||||
Compiling Sqoop requires the following tools:
|
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
|
* Java JDK 1.8
|
||||||
|
|
||||||
Additionally, building the documentation requires these tools:
|
Additionally, building the documentation requires these tools:
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
18
gradlew
vendored
18
gradlew
vendored
@ -1,5 +1,21 @@
|
|||||||
#!/usr/bin/env sh
|
#!/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
|
## Gradle start up script for UN*X
|
||||||
@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
|||||||
APP_BASE_NAME=`basename "$0"`
|
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.
|
# 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.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
18
gradlew.bat
vendored
18
gradlew.bat
vendored
@ -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
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
|||||||
set APP_HOME=%DIRNAME%
|
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.
|
@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
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
@ -26,10 +26,12 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.sqoop.manager.oracle.OracleUtils;
|
import org.apache.sqoop.manager.oracle.OracleUtils;
|
||||||
@ -918,7 +920,7 @@ private void setFieldToValueIfApplicable(Object target, Field field) throws Exce
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <T> T createAndFill(Class<T> clazz) throws Exception {
|
private <T> T createAndFill(Class<T> clazz) throws Exception {
|
||||||
T instance = clazz.newInstance();
|
T instance = clazz.getConstructor().newInstance();
|
||||||
for(Field field: clazz.getDeclaredFields()) {
|
for(Field field: clazz.getDeclaredFields()) {
|
||||||
if (field.getType().equals(clazz)
|
if (field.getType().equals(clazz)
|
||||||
|| field.getType().equals(ClassLoader.class)
|
|| field.getType().equals(ClassLoader.class)
|
||||||
@ -977,6 +979,9 @@ else if (type.isArray()) {
|
|||||||
int length = random.nextInt(9) + 1;
|
int length = random.nextInt(9) + 1;
|
||||||
return Array.newInstance(type.getComponentType(), length);
|
return Array.newInstance(type.getComponentType(), length);
|
||||||
}
|
}
|
||||||
|
else if (type.equals(ConcurrentHashMap.class)) {
|
||||||
|
return type.getConstructor().newInstance();
|
||||||
|
}
|
||||||
else if (Number.class.isAssignableFrom(type)) {
|
else if (Number.class.isAssignableFrom(type)) {
|
||||||
return random.nextInt(Byte.MAX_VALUE) + 1;
|
return random.nextInt(Byte.MAX_VALUE) + 1;
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -184,22 +185,25 @@ protected static String getClasspath(File confDir) throws URISyntaxException {
|
|||||||
|
|
||||||
StringBuilder classpathBuilder = new StringBuilder(64);
|
StringBuilder classpathBuilder = new StringBuilder(64);
|
||||||
classpathBuilder.append(confDir.getAbsolutePath());
|
classpathBuilder.append(confDir.getAbsolutePath());
|
||||||
|
for (URL u : getUrlsFromClassPath()) {
|
||||||
// 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);
|
append(classpathBuilder, u);
|
||||||
}
|
}
|
||||||
} else {
|
return classpathBuilder.toString();
|
||||||
throw new IllegalArgumentException("Unknown classloader type : " + classLoader.getClass().getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return classpathBuilder.toString();
|
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 result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void append(StringBuilder classpathBuilder, URL url) throws URISyntaxException {
|
private static void append(StringBuilder classpathBuilder, URL url) throws URISyntaxException {
|
||||||
|
Loading…
Reference in New Issue
Block a user