Repository: drill
Updated Branches:
refs/heads/master 363d30b54 -> 5cdd71986
DRILL-1919: Running DRILL with JRE results in failure with ambiguous errors
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/8a9f02a0
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/8a9f02a0
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/8a9f02a0
Branch: refs/heads/master
Commit: 8a9f02a084a7faab503692c7271803cd88ce05fb
Parents: 363d30b
Author: Aditya Kishore <adi@apache.org>
Authored: Thu Jan 1 23:48:14 2015 -0800
Committer: Aditya Kishore <adi@apache.org>
Committed: Wed Jan 7 02:29:48 2015 -0800
----------------------------------------------------------------------
.../apache/drill/exec/compile/JDKClassCompiler.java | 14 ++++++++++----
.../apache/drill/exec/compile/QueryClassLoader.java | 5 +++--
2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/8a9f02a0/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JDKClassCompiler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JDKClassCompiler.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JDKClassCompiler.java
index 2e101dc..ecd222d 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JDKClassCompiler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JDKClassCompiler.java
@@ -41,12 +41,18 @@ class JDKClassCompiler extends AbstractClassCompiler {
private final JavaCompiler compiler;
private final DrillJavaFileManager fileManager;
- public JDKClassCompiler(ClassLoader classLoader, boolean debug) {
- super(debug);
- this.compiler = ToolProvider.getSystemJavaCompiler();
+ public static JDKClassCompiler newInstance(ClassLoader classLoader, boolean debug) {
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
if (compiler == null) {
- throw new UnsupportedOperationException("JDK Java compiler not available - probably
you're running a JRE, not a JDK");
+ logger.warn("JDK Java compiler not available - probably you're running Drill with a
JRE and not a JDK");
+ return null;
}
+ return new JDKClassCompiler(compiler, classLoader, debug);
+ }
+
+ private JDKClassCompiler(JavaCompiler compiler, ClassLoader classLoader, boolean debug)
{
+ super(debug);
+ this.compiler = compiler;
this.listener = new DrillDiagnosticListener();
this.fileManager = new DrillJavaFileManager(compiler.getStandardFileManager(listener,
null, Charsets.UTF_8), classLoader);
this.compilerOptions = Lists.newArrayList(this.debug ? "-g:source,lines,vars" : "-g:none");
http://git-wip-us.apache.org/repos/asf/drill/blob/8a9f02a0/exec/java-exec/src/main/java/org/apache/drill/exec/compile/QueryClassLoader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/QueryClassLoader.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/QueryClassLoader.java
index e1ac7a8..065c3c8 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/QueryClassLoader.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/QueryClassLoader.java
@@ -125,13 +125,14 @@ public class QueryClassLoader extends URLClassLoader {
boolean debug = (value != null) ? value.bool_val : config.getBoolean(JAVA_COMPILER_DEBUG_CONFIG);
this.janinoClassCompiler = (policy == CompilerPolicy.JANINO || policy == CompilerPolicy.DEFAULT)
? new JaninoClassCompiler(QueryClassLoader.this, debug) : null;
- this.jdkClassCompiler = (policy == CompilerPolicy.JDK || policy == CompilerPolicy.DEFAULT)
? new JDKClassCompiler(QueryClassLoader.this, debug) : null;
+ this.jdkClassCompiler = (policy == CompilerPolicy.JDK || policy == CompilerPolicy.DEFAULT)
? JDKClassCompiler.newInstance(QueryClassLoader.this, debug) : null;
}
private byte[][] getClassByteCode(ClassNames className, String sourceCode)
throws CompileException, ClassNotFoundException, ClassTransformationException, IOException
{
AbstractClassCompiler classCompiler;
- if (policy == CompilerPolicy.JDK || (policy == CompilerPolicy.DEFAULT && sourceCode.length()
> janinoThreshold)) {
+ if (jdkClassCompiler != null &&
+ (policy == CompilerPolicy.JDK || (policy == CompilerPolicy.DEFAULT && sourceCode.length()
> janinoThreshold))) {
classCompiler = jdkClassCompiler;
} else {
classCompiler = janinoClassCompiler;
|