mirror of
https://github.com/apache/sqoop.git
synced 2025-05-02 02:31:27 +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:
|
||||
|
||||
* 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:
|
||||
|
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
|
||||
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
|
||||
|
18
gradlew
vendored
18
gradlew
vendored
@ -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_NAME="Gradle"
|
||||
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"
|
||||
|
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
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
||||
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
|
||||
|
@ -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 void setFieldToValueIfApplicable(Object target, Field field) throws Exce
|
||||
}
|
||||
|
||||
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 @@ else if (type.isArray()) {
|
||||
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;
|
||||
}
|
||||
|
@ -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 @@ protected static String getClasspath(File confDir) throws URISyntaxException {
|
||||
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user