Merge
authorpoonam
Thu, 04 May 2017 19:25:53 +0000
changeset 45010 f5764d8f5502
parent 45008 c5266a7717cf (current diff)
parent 45009 c39425655469 (diff)
child 45011 d47d698f27f6
Merge
--- a/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java	Thu May 04 14:07:58 2017 -0400
+++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java	Thu May 04 19:25:53 2017 +0000
@@ -393,7 +393,7 @@
         } catch (JdpException e) {
             error(e);
         } catch (AgentConfigurationError err) {
-            error(err.getError(), err.getParams());
+            error(err);
         }
     }
 
@@ -454,7 +454,7 @@
             }
 
         } catch (AgentConfigurationError e) {
-            error(e.getError(), e.getParams());
+            error(e);
         } catch (Exception e) {
             error(e);
         }
@@ -665,18 +665,6 @@
         throw new RuntimeException(keyText);
     }
 
-    public static void error(String key, String[] params) {
-        if (params == null || params.length == 0) {
-            error(key);
-        } else {
-            StringBuilder message = new StringBuilder(params[0]);
-            for (int i = 1; i < params.length; i++) {
-                message.append(' ').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);
@@ -690,6 +678,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);