log tweaks

This commit is contained in:
zzz
2013-09-22 14:13:50 +00:00
parent 89034e1f9d
commit 6fede7f524
2 changed files with 10 additions and 2 deletions

View File

@ -326,7 +326,10 @@ public class KeyStoreUtil {
if (success) {
try {
success = getPrivateKey(ks, ksPW, alias, keyPW) != null;
if (!success)
error("Key gen failed to get private key", null);
} catch (Exception e) {
error("Key gen failed to get private key", e);
success = false;
}
}
@ -458,6 +461,11 @@ public class KeyStoreUtil {
}
private static void log(I2PAppContext ctx, int level, String msg, Throwable t) {
if (level >= Log.WARN && !ctx.isRouterContext()) {
System.out.println(msg);
if (t != null)
t.printStackTrace();
}
Log l = ctx.logManager().getLog(KeyStoreUtil.class);
l.log(level, msg, t);
}

View File

@ -695,13 +695,13 @@ public class SU3File {
alias, "I2P", 3652, type.getBaseAlgorithm().getName(),
keylen, keypw);
if (!success) {
System.err.println("Error writing keys:");
System.err.println("Error creating keys for " + alias);
return false;
}
File outfile = new File(publicKeyFile);
success = KeyStoreUtil.exportCert(ksFile, KeyStoreUtil.DEFAULT_KEYSTORE_PASSWORD, alias, outfile);
if (!success) {
System.err.println("Error writing keys:");
System.err.println("Error writing public key for " + alias + " to " + outfile);
return false;
}
return true;