Open GergesShamon opened 2 years ago
[1] Overview and Causes Line 343 of KeyTool.java is System.out.println(rb.getString("keytool.error.")+e); And in the rb.getString("keytool.error."), the error occured, which is caused by the absence of a resource named "keytool.error". And the reason for it is that the preceding parseArgs(args); or doCommands(out); threw an exception.
In other words, when the error occurred, the code tried to display the cause of the error, but second error occurred in that code . Therefore, the double error has made it impossible to display the cause of the first error.
If you rewrite A as B, you will be able to display the cause of exception e.
System.out.println(rb.getString("keytool.error.") + e); // A, old line 343 ---> System.out.println("keytool error: " + e); // B, new "line 343"
(KeyTool.java) private static final java.util.ResourceBundle rb = java.util.ResourceBundle.getBundle("sun.security.util.Resources"); private void run(String[] args, PrintStream out) throws Exception { try { parseArgs(args); if (command != null) { doCommands(out); } } catch (Exception e) { System.out.println(rb.getString("keytool.error.") + e); // line 343 if (verbose) { e.printStackTrace(System.out); } if (!debug) { System.exit(1); } else { throw e; }
package sun.security.util;
/**
ResourceBundle
*/ public class Resources extends java.util.ListResourceBundle {
private static final Object[][] contents = { ... // keytool: Running part {"keytool.error.", "keytool error: "}, {"Illegal.option.", "Illegal option: "}, ... }; .... }
[3] The same code as [2] is here in local source : https://github.com/YutakaAoki/KeyTool/blob/master/src/sun/security/util/Resources.java
When to use this command: dalvikvm ^ -cp keytool.dex ^ main ^ -genkeypair ^ -keystore keystore.jks ^ -alias androidkey ^ -validity 10000 ^ -keyalg RSA ^ -keysize 2048 ^ -storepass android ^ -keypass android
This is showing me an error: Android keytool 2019 ported by Yutaka Aoki.
Exception in thread "main" java.util.MissingResourceException: Can't find resource for bundle sun.security.util.Resources, key keytool.error. at java.util.ResourceBundle.getObject(ResourceBundle.java:448) at java.util.ResourceBundle.getString(ResourceBundle.java:405) at sun.security.tools.KeyTool.run(KeyTool.java:343) at sun.security.tools.KeyTool.main(KeyTool.java:333) at main.main(main.java:5)