forked from I2P_Developers/i2p.i2p
lint: don't catch Exception, catch RuntimeException or checked exception.
omits SAM, BOB, reflection, commented-out code, and a few other places
This commit is contained in:
@@ -158,7 +158,7 @@ public class GarlicClove extends DataStructureImpl {
|
||||
if (m.length <= 0)
|
||||
throw new RuntimeException("foo, returned 0 length");
|
||||
out.write(m);
|
||||
} catch (Exception e) {
|
||||
} catch (RuntimeException e) {
|
||||
throw new DataFormatException("Unable to write the clove: " + _msg + " to " + out, e);
|
||||
}
|
||||
DataHelper.writeLong(out, 4, _cloveId);
|
||||
@@ -187,7 +187,7 @@ public class GarlicClove extends DataStructureImpl {
|
||||
byte m[] = _msg.toByteArray();
|
||||
System.arraycopy(m, 0, rv, offset, m.length);
|
||||
offset += m.length;
|
||||
} catch (Exception e) { throw new RuntimeException("Unable to write: " + _msg + ": " + e.getMessage()); }
|
||||
} catch (RuntimeException e) { throw new RuntimeException("Unable to write: " + _msg + ": " + e.getMessage()); }
|
||||
DataHelper.toLong(rv, offset, 4, _cloveId);
|
||||
offset += 4;
|
||||
DataHelper.toDate(rv, offset, _expiration.getTime());
|
||||
|
||||
@@ -59,7 +59,7 @@ public class I2NPMessageHandler {
|
||||
_lastSize = msg.readBytes(in, type, _messageBuffer);
|
||||
} catch (I2NPMessageException ime) {
|
||||
throw ime;
|
||||
} catch (Exception e) {
|
||||
} catch (RuntimeException e) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Error reading the stream", e);
|
||||
throw new I2NPMessageException("Unknown error reading the " + msg.getClass().getSimpleName(), e);
|
||||
@@ -131,7 +131,7 @@ public class I2NPMessageHandler {
|
||||
cur += _lastSize;
|
||||
} catch (I2NPMessageException ime) {
|
||||
throw ime;
|
||||
} catch (Exception e) {
|
||||
} catch (RuntimeException e) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Error reading the stream", e);
|
||||
throw new I2NPMessageException("Unknown error reading the " + msg.getClass().getSimpleName(), e);
|
||||
|
||||
@@ -163,7 +163,7 @@ public class I2NPMessageReader {
|
||||
_log.warn("IO Error handling message", ioe);
|
||||
_listener.disconnected(I2NPMessageReader.this);
|
||||
cancelRunner();
|
||||
} catch (Exception e) {
|
||||
} catch (RuntimeException e) {
|
||||
_log.log(Log.CRIT, "error reading msg!", e);
|
||||
_listener.readError(I2NPMessageReader.this, e);
|
||||
_listener.disconnected(I2NPMessageReader.this);
|
||||
|
||||
@@ -724,7 +724,10 @@ public class RouterInfo extends DatabaseEntry {
|
||||
System.err.println("Router info " + args[i] + " is invalid");
|
||||
fail = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (IOException e) {
|
||||
System.err.println("Error reading " + args[i] + ": " + e);
|
||||
fail = true;
|
||||
} catch (DataFormatException e) {
|
||||
System.err.println("Error reading " + args[i] + ": " + e);
|
||||
fail = true;
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user