You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by js...@apache.org on 2015/11/13 23:49:09 UTC
[2/2] drill git commit: DRILL-4082: Better error message when
multiple versions of the same function are found by the classpath scanner
DRILL-4082: Better error message when multiple versions of the same function are found by the classpath scanner
This closes #252
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/447f8ba5
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/447f8ba5
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/447f8ba5
Branch: refs/heads/master
Commit: 447f8ba536ff6d17116211141c67eeecd1704fb8
Parents: f38a96b
Author: Julien Le Dem <ju...@ledem.net>
Authored: Thu Nov 12 14:27:26 2015 -0800
Committer: Jason Altekruse <al...@gmail.com>
Committed: Fri Nov 13 13:22:39 2015 -0800
----------------------------------------------------------------------
.../apache/drill/common/scanner/ClassPathScanner.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/447f8ba5/common/src/main/java/org/apache/drill/common/scanner/ClassPathScanner.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/scanner/ClassPathScanner.java b/common/src/main/java/org/apache/drill/common/scanner/ClassPathScanner.java
index 92b2027..6313b53 100644
--- a/common/src/main/java/org/apache/drill/common/scanner/ClassPathScanner.java
+++ b/common/src/main/java/org/apache/drill/common/scanner/ClassPathScanner.java
@@ -34,6 +34,7 @@ import java.util.Set;
import org.apache.drill.common.config.CommonConstants;
import org.apache.drill.common.config.DrillConfig;
+import org.apache.drill.common.exceptions.UserException;
import org.apache.drill.common.scanner.persistence.AnnotationDescriptor;
import org.apache.drill.common.scanner.persistence.AttributeDescriptor;
import org.apache.drill.common.scanner.persistence.ChildClassDescriptor;
@@ -408,7 +409,7 @@ public final class ClassPathScanner {
new ArrayList<>(subTypesScanner.getChildrenOf(baseTypeName))));
}
List<AnnotatedClassDescriptor> annotated = annotationScanner.getAnnotatedClasses();
- verifyClassUnicity(annotated);
+ verifyClassUnicity(annotated, pathsToScan);
return new ScanResult(
packagePrefixes,
scannedClasses,
@@ -422,11 +423,18 @@ public final class ClassPathScanner {
}
}
- private static void verifyClassUnicity(List<AnnotatedClassDescriptor> annotatedClasses) {
+ private static void verifyClassUnicity(List<AnnotatedClassDescriptor> annotatedClasses, Collection<URL> pathsScanned) {
Set<String> scanned = new HashSet<>();
for (AnnotatedClassDescriptor annotated : annotatedClasses) {
if (!scanned.add(annotated.getClassName())) {
- throw new RuntimeException("BUG: " + annotated.getClassName() + " scanned twice");
+ throw UserException.functionError()
+ .message(
+ "function %s scanned twice in the following locations:\n"
+ + "%s\n"
+ + "Do you have conflicting jars on the classpath?",
+ annotated.getClassName(), pathsScanned
+ )
+ .build(logger);
}
}
}