Repository: kylin Updated Branches: refs/heads/yang21 91ffb47fa -> f522e2bfe
minor, enhance ClasspathScanner exit code Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/f522e2bf Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/f522e2bf Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/f522e2bf Branch: refs/heads/yang21 Commit: f522e2bfe66389747bfdb06fc0cb48006628e2f4 Parents: 91ffb47 Author: Li Yang <liy...@apache.org> Authored: Wed Nov 2 12:03:12 2016 +0800 Committer: Li Yang <liy...@apache.org> Committed: Wed Nov 2 12:03:12 2016 +0800 ---------------------------------------------------------------------- .../kylin/common/util/ClasspathScanner.java | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/f522e2bf/core-common/src/main/java/org/apache/kylin/common/util/ClasspathScanner.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/util/ClasspathScanner.java b/core-common/src/main/java/org/apache/kylin/common/util/ClasspathScanner.java index 6079a17..365caa8 100644 --- a/core-common/src/main/java/org/apache/kylin/common/util/ClasspathScanner.java +++ b/core-common/src/main/java/org/apache/kylin/common/util/ClasspathScanner.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; -import java.util.Arrays; import java.util.Enumeration; import java.util.List; import java.util.zip.ZipEntry; @@ -35,15 +34,14 @@ public class ClasspathScanner { public static void main(final String[] args) { ClasspathScanner scanner = new ClasspathScanner(); - System.out.println("Finding " + Arrays.toString(args) + " in:"); - System.out.println("----------------------------------------------------------------------------"); - for (File f : scanner.rootResources) { - System.out.println(" - " + f.getAbsolutePath()); + if (args.length == 0) { + for (File f : scanner.rootResources) { + System.out.println(f.getAbsolutePath()); + } + System.exit(0); } - System.out.println("----------------------------------------------------------------------------"); - - if (args.length == 0) - return; + + final int[] hitCount = new int[1]; scanner.scan("", new ResourceVisitor() { public void accept(File dir, String relativeFileName) { @@ -56,14 +54,19 @@ public class ClasspathScanner { private void check(String base, String relativePath) { boolean hit = false; - for (int i = 0; i < args.length && !hit; i++) - hit = match(args[i], relativePath); + for (int i = 0; i < args.length && !hit; i++) { + hit = relativePath.endsWith(args[i]) || match(args[i], relativePath); + } if (hit) { System.out.println(base + " - " + relativePath); + hitCount[0]++; } } }); + + int exitCode = hitCount[0] > 0 ? 0 : 1; + System.exit(exitCode); } /**