jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1529072 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java
Date Fri, 04 Oct 2013 02:52:50 GMT
Author: pmouawad
Date: Fri Oct  4 02:52:49 2013
New Revision: 1529072

URL: http://svn.apache.org/r1529072
Log:
Log command line when it fails

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java?rev=1529072&r1=1529071&r2=1529072&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java Fri Oct  4 02:52:49
2013
@@ -104,7 +104,7 @@ public class KeyToolUtils {
         try {
             int exitVal = nativeCommand.run(arguments);
             if (exitVal != 0) {
-                throw new IOException("Command failed, code: " + exitVal + "\n" + nativeCommand.getOutResult());
+                throw new IOException("Command :'"+formatCommand(arguments)+"' failed, code:
" + exitVal + "\n" + nativeCommand.getOutResult());
             }
         } catch (InterruptedException e) {
             throw new IOException("Command was interrupted\n" + nativeCommand.getOutResult(),
e);
@@ -112,6 +112,22 @@ public class KeyToolUtils {
     }
 
     /**
+     * Formats arguments
+     * @param arguments
+     * @return String command line
+     */
+    private static String formatCommand(List<String> arguments) {
+        StringBuilder builder = new StringBuilder();
+        for (String string : arguments) {
+            builder.append("\"").append(string).append("\"").append(" ");
+        }
+        if(arguments.size()>0) {
+            builder.setLength(builder.length()-1);
+        }
+        return builder.toString();
+    }
+
+    /**
      * Creates a self-signed Root CA certificate and an intermediate CA certificate
      * (signed by the Root CA certificate) that can be used to sign server certificates.
      * The Root CA certificate file is exported to the same directory as the keystore



Mime
View raw message