I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 80e3c96f authored by zzz's avatar zzz
Browse files

LeaseSet: Better error messages when decode fails (ticket #2108)

parent dc13ed6c
No related branches found
No related tags found
No related merge requests found
...@@ -490,7 +490,8 @@ public class LeaseSet extends DatabaseEntry { ...@@ -490,7 +490,8 @@ public class LeaseSet extends DatabaseEntry {
// _log.warn("decrypting lease: " + _destination.calculateHash()); // _log.warn("decrypting lease: " + _destination.calculateHash());
int size = _leases.size(); int size = _leases.size();
if (size < 2) if (size < 2)
throw new DataFormatException("Bad number of leases for decryption"); throw new DataFormatException("Bad number of leases decrypting " + _destination.toBase32() +
" - is this destination encrypted?");
int datalen = DATA_LEN * size; int datalen = DATA_LEN * size;
ByteArrayOutputStream baos = new ByteArrayOutputStream(datalen); ByteArrayOutputStream baos = new ByteArrayOutputStream(datalen);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
...@@ -539,10 +540,12 @@ public class LeaseSet extends DatabaseEntry { ...@@ -539,10 +540,12 @@ public class LeaseSet extends DatabaseEntry {
_decrypted = true; _decrypted = true;
} catch (DataFormatException dfe) { } catch (DataFormatException dfe) {
Log log = I2PAppContext.getGlobalContext().logManager().getLog(LeaseSet.class); Log log = I2PAppContext.getGlobalContext().logManager().getLog(LeaseSet.class);
log.error("Error decrypting lease: " + _destination.calculateHash(), dfe); log.error("Error decrypting " + _destination.toBase32() +
" - is this destination encrypted?", dfe);
} catch (IOException ioe) { } catch (IOException ioe) {
Log log = I2PAppContext.getGlobalContext().logManager().getLog(LeaseSet.class); Log log = I2PAppContext.getGlobalContext().logManager().getLog(LeaseSet.class);
log.error("Error decrypting lease: " + _destination.calculateHash(), ioe); log.error("Error decrypting " + _destination.toBase32() +
" - is this destination encrypted?", ioe);
} }
} }
_checked = true; _checked = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment