Revision: 6658 http://sourceforge.net/p/jump-pilot/code/6658 Author: edso Date: 2020-12-23 14:38:26 +0000 (Wed, 23 Dec 2020) Log Message: ----------- replace stack with a more informative message printed to STDOUT
Modified Paths: -------------- core/trunk/src/com/vividsolutions/jump/workbench/plugin/PlugInClassLoader.java Modified: core/trunk/src/com/vividsolutions/jump/workbench/plugin/PlugInClassLoader.java =================================================================== --- core/trunk/src/com/vividsolutions/jump/workbench/plugin/PlugInClassLoader.java 2020-12-22 12:34:31 UTC (rev 6657) +++ core/trunk/src/com/vividsolutions/jump/workbench/plugin/PlugInClassLoader.java 2020-12-23 14:38:26 UTC (rev 6658) @@ -2,6 +2,8 @@ import java.io.File; import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; @@ -140,8 +142,14 @@ return Paths.get(s).toRealPath().toUri().toURL(); } catch (InvalidPathException | IOException ignore) { // malformed path string or class path element does not exist - // we cannot use Logger during VM init, so we simply print to STDERR - ignore.printStackTrace(System.err); + // we _cannot_ use Logger during VM init, so we have to print to STDERR + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + ignore.printStackTrace(pw); + String stack = sw.toString(); + // print first line of stack only containing Exception class name and message + int index = stack.indexOf("\n"); + System.err.println("Problem adding classpath entry '"+s+"': "+stack.substring(0, index>0?index:stack.length())); return null; } } _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel