Mercurial > hg > truffle
diff mx/FilterTypes.java @ 21635:b311a60991da
more graceful failure in context of stale mx-deployed JDK jars
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 01 Jun 2015 15:01:34 +0200 |
parents | 60154926b513 |
children | b6aadfd3dfbe |
line wrap: on
line diff
--- a/mx/FilterTypes.java Mon Jun 01 15:24:37 2015 +0200 +++ b/mx/FilterTypes.java Mon Jun 01 15:01:34 2015 +0200 @@ -34,7 +34,7 @@ StringBuilder buf = new StringBuilder(); for (int i = 1; i < args.length; ++i) { String serviceName = args[i]; - Class<?> service = Class.forName(serviceName, false, FilterTypes.class.getClassLoader()); + Class<?> service = lookupService(serviceName); if (jvmciServiceInterface.isAssignableFrom(service)) { if (buf.length() != 0) { buf.append('|'); @@ -45,4 +45,18 @@ } System.out.print(buf); } + + private static Class<?> lookupService(String serviceName) { + try { + // This can fail in the case of running against a JDK + // with out of date JVMCI jars. In that case, just print + // a warning sinc the expectation is that the jars will be + // updated later on. + return Class.forName(serviceName, false, FilterTypes.class.getClassLoader()); + } catch (ClassNotFoundException e) { + // Must be stderr to avoid polluting the result being + // written to stdout. + System.err.println(e); + } + } }