handle decompress error by propogating the IOE (thanks nickster for bug report)

This commit is contained in:
jrandom
2004-06-13 19:30:31 +00:00
committed by zzz
parent fed8369a5f
commit 95c33e88ed
2 changed files with 22 additions and 21 deletions

View File

@@ -10,6 +10,7 @@ package net.i2p.client;
*/
import java.io.InputStream;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Properties;
@@ -86,10 +87,15 @@ class I2PSessionImpl2 extends I2PSessionImpl {
*/
public byte[] receiveMessage(int msgId) throws I2PSessionException {
byte compressed[] = super.receiveMessage(msgId);
if (SHOULD_COMPRESS)
return DataHelper.decompress(compressed);
else
if (SHOULD_COMPRESS) {
try {
return DataHelper.decompress(compressed);
} catch (IOException ioe) {
throw new I2PSessionException("Error decompressing message", ioe);
}
} else {
return compressed;
}
}
private boolean sendBestEffort(Destination dest, byte payload[], SessionKey keyUsed, Set tagsSent)