--- old/src/share/classes/sun/management/Agent.java 2017-10-25 00:47:35.173580035 -0700 +++ new/src/share/classes/sun/management/Agent.java 2017-10-25 00:47:34.843550154 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -211,7 +211,7 @@ throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, "No port specified"); } } catch (AgentConfigurationError err) { - error(err.getError(), err.getParams()); + error(err); } } @@ -266,7 +266,7 @@ } } catch (AgentConfigurationError e) { - error(e.getError(), e.getParams()); + error(e); } catch (Exception e) { error(e); } @@ -496,18 +496,6 @@ throw new RuntimeException(keyText); } - public static void error(String key, String[] params) { - if (params == null || params.length == 0) { - error(key); - } else { - StringBuffer message = new StringBuffer(params[0]); - for (int i = 1; i < params.length; i++) { - message.append(" " + params[i]); - } - error(key, message.toString()); - } - } - public static void error(String key, String message) { String keyText = getText(key); System.err.print(getText("agent.err.error") + ": " + keyText); @@ -521,6 +509,23 @@ throw new RuntimeException(e); } + public static void error(AgentConfigurationError e) { + String keyText = getText(e.getError()); + String[] params = e.getParams(); + + System.err.print(getText("agent.err.error") + ": " + keyText); + + if (params != null && params.length != 0) { + StringBuffer message = new StringBuffer(params[0]); + for (int i = 1; i < params.length; i++) { + message.append(" " + params[i]); + } + System.err.println(": " + message); + } + e.printStackTrace(); + throw new RuntimeException(e); + } + public static void warning(String key, String message) { System.err.print(getText("agent.err.warning") + ": " + getText(key)); System.err.println(": " + message);