# HG changeset patch # User Doug Simon # Date 1433163694 -7200 # Node ID b311a60991da7c771b22a068ece86d01375e4149 # Parent 0a2fc09f6ed6dd44763f02d0e75f020863412190 more graceful failure in context of stale mx-deployed JDK jars diff -r 0a2fc09f6ed6 -r b311a60991da mx/FilterTypes.java --- 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); + } + } } diff -r 0a2fc09f6ed6 -r b311a60991da mx/mx_graal.py --- a/mx/mx_graal.py Mon Jun 01 15:24:37 2015 +0200 +++ b/mx/mx_graal.py Mon Jun 01 15:01:34 2015 +0200 @@ -555,7 +555,7 @@ """ _, binDir = mx._compile_mx_class('FilterTypes', os.pathsep.join(classpath), myDir=dirname(__file__)) cmd = [mx.java().java, '-cp', mx._cygpathU2W(os.pathsep.join([binDir] + classpath)), 'FilterTypes', 'com.oracle.jvmci.service.Service'] + serviceImplNames - services = subprocess.check_output(cmd, stderr=subprocess.PIPE) + services = subprocess.check_output(cmd) if len(services) == 0: return [] return services.split('|')