diff --git a/router/java/src/net/i2p/router/startup/CreateRouterInfoJob.java b/router/java/src/net/i2p/router/startup/CreateRouterInfoJob.java index 5fbce84cd6a06133c6027ad6da0c47ab0f3c0cd5..459cd0fb3ae2a8d07959a34cd208efb562cd1124 100644 --- a/router/java/src/net/i2p/router/startup/CreateRouterInfoJob.java +++ b/router/java/src/net/i2p/router/startup/CreateRouterInfoJob.java @@ -98,9 +98,9 @@ public class CreateRouterInfoJob extends JobImpl { _log.info("Router info created and stored at " + ifile.getAbsolutePath() + " with private keys stored at " + kfile.getAbsolutePath() + " [" + info + "]"); } catch (DataFormatException dfe) { - _log.error("Error building the new router information", dfe); + _log.log(Log.CRIT, "Error building the new router information", dfe); } catch (IOException ioe) { - _log.error("Error writing out the new router information", ioe); + _log.log(Log.CRIT, "Error writing out the new router information", ioe); } finally { if (fos1 != null) try { fos1.close(); } catch (IOException ioe) {} if (fos2 != null) try { fos2.close(); } catch (IOException ioe) {} diff --git a/router/java/src/net/i2p/router/startup/LoadRouterInfoJob.java b/router/java/src/net/i2p/router/startup/LoadRouterInfoJob.java index f3428c4474886f08dc6a8b9edca93cf5fcf6f086..94b4f1d2eda8bc2227827cd91ae2299b4ba6c48a 100644 --- a/router/java/src/net/i2p/router/startup/LoadRouterInfoJob.java +++ b/router/java/src/net/i2p/router/startup/LoadRouterInfoJob.java @@ -68,11 +68,18 @@ public class LoadRouterInfoJob extends JobImpl { FileInputStream fis1 = null; FileInputStream fis2 = null; try { - if (_infoExists) { + // if we have a routerinfo but no keys, things go bad in a hurry: + // CRIT ...rkdb.PublishLocalRouterInfoJob: Internal error - signing private key not known? rescheduling publish for 30s + // CRIT net.i2p.router.Router : Internal error - signing private key not known? wtf + // CRIT ...sport.udp.EstablishmentManager: Error in the establisher java.lang.NullPointerException + // at net.i2p.router.transport.udp.PacketBuilder.buildSessionConfirmedPacket(PacketBuilder.java:574) + // so pretend the RI isn't there if there is no keyfile + if (_infoExists && _keysExist) { fis1 = new FileInputStream(rif); info = new RouterInfo(); info.readBytes(fis1); _log.debug("Reading in routerInfo from " + rif.getAbsolutePath() + " and it has " + info.getAddresses().size() + " addresses"); + _us = info; } if (_keysExist) { @@ -91,17 +98,15 @@ public class LoadRouterInfoJob extends JobImpl { getContext().keyManager().setPublicKey(pubkey); //info.getIdentity().getPublicKey()); getContext().keyManager().setSigningPublicKey(signingPubKey); // info.getIdentity().getSigningPublicKey()); } - - _us = info; } catch (IOException ioe) { - _log.error("Error reading the router info from " + rif.getAbsolutePath() + " and the keys from " + rkf.getAbsolutePath(), ioe); + _log.log(Log.CRIT, "Error reading the router info from " + rif.getAbsolutePath() + " and the keys from " + rkf.getAbsolutePath(), ioe); _us = null; rif.delete(); rkf.delete(); _infoExists = false; _keysExist = false; } catch (DataFormatException dfe) { - _log.error("Corrupt router info or keys at " + rif.getAbsolutePath() + " / " + rkf.getAbsolutePath(), dfe); + _log.log(Log.CRIT, "Corrupt router info or keys at " + rif.getAbsolutePath() + " / " + rkf.getAbsolutePath(), dfe); _us = null; rif.delete(); rkf.delete(); diff --git a/router/java/src/net/i2p/router/startup/RebuildRouterInfoJob.java b/router/java/src/net/i2p/router/startup/RebuildRouterInfoJob.java index fda82de8e595e3a84fb3a6999406de0c7995f27a..e3daf60ea44d7fec76f55b3b11eef195c44d1936 100644 --- a/router/java/src/net/i2p/router/startup/RebuildRouterInfoJob.java +++ b/router/java/src/net/i2p/router/startup/RebuildRouterInfoJob.java @@ -107,7 +107,7 @@ public class RebuildRouterInfoJob extends JobImpl { ident.setSigningPublicKey(signingPubKey); info.setIdentity(ident); } catch (Exception e) { - _log.error("Error reading in the key data from " + keyFile.getAbsolutePath(), e); + _log.log(Log.CRIT, "Error reading in the key data from " + keyFile.getAbsolutePath(), e); if (fis != null) try { fis.close(); } catch (IOException ioe) {} fis = null; keyFile.delete(); @@ -129,7 +129,7 @@ public class RebuildRouterInfoJob extends JobImpl { info.sign(getContext().keyManager().getSigningPrivateKey()); } catch (DataFormatException dfe) { - _log.error("Error rebuilding the new router info", dfe); + _log.log(Log.CRIT, "Error rebuilding the new router info", dfe); return; } @@ -138,9 +138,9 @@ public class RebuildRouterInfoJob extends JobImpl { fos = new FileOutputStream(infoFile); info.writeBytes(fos); } catch (DataFormatException dfe) { - _log.error("Error rebuilding the router information", dfe); + _log.log(Log.CRIT, "Error rebuilding the router information", dfe); } catch (IOException ioe) { - _log.error("Error writing out the rebuilt router information", ioe); + _log.log(Log.CRIT, "Error writing out the rebuilt router information", ioe); } finally { if (fos != null) try { fos.close(); } catch (IOException ioe) {} }