RFR 8160359: Improve jlink logging for cases when a plugin throws exception

Mandy Chung mandy.chung at oracle.com
Wed Nov 30 22:27:23 UTC 2016


> On Nov 30, 2016, at 3:05 AM, Sundararajan Athijegannathan <sundararajan.athijegannathan at oracle.com> wrote:
> 
> Please review fix for https://bugs.openjdk.java.net/browse/JDK-8160359
> 
> jdk webrev: http://cr.openjdk.java.net/~sundar/8160359/webrev.01/


I expect JlinkTask::run method be updated such that it will always print the stack trace when PluginException is caught rather than just printing the message only. 

ImagePluginStack.java

 273             } catch (PluginException pe) {
 274                 if (JlinkTask.DEBUG) {
 275                     System.err.println("Plugin " + p.getName() + " threw exception during transform");
 276                     pe.printStackTrace();
 277                 }
 278                 throw pe;

It might be useful for PluginException to take a plugin name in the constructor so that the exception message is always prepended with the plugin name to help troubleshooting.  If JlinkTask::run is changed as suggested above, is line 273-278 still needed?

 454                         if (JlinkTask.DEBUG) {
 455                             System.err.println("IOException while reading resource: " + res.path());

 456                             ex.printStackTrace();
 457                         }
 458                         throw new PluginException(ex);

Same as above comment and also PluginException should include res.path() in the message.

As Alan mentioned, make/InterimImage.gmk should also be updated.
 
Mandy


More information about the jigsaw-dev mailing list