findbugs all over

This commit is contained in:
zzz
2019-10-30 15:26:56 +00:00
parent 3719081469
commit a51ee8e745
7 changed files with 17 additions and 43 deletions

View File

@ -232,7 +232,7 @@ public class TunnelControllerGroup implements ClientApp {
_log.info("Configuring tunnels from " + configFile);
loadControllers(configFile);
} catch (IllegalArgumentException iae) {
if (DEFAULT_CONFIG_FILE.equals(configFile) && !_context.isRouterContext()) {
if (DEFAULT_CONFIG_FILE.equals(configFile.getName()) && !_context.isRouterContext()) {
// for i2ptunnel command line
synchronized (this) {
_controllersLoaded = true;

View File

@ -164,6 +164,7 @@ public class OsfwWorker implements Runnable {
// finalize and close connections
try {
if (socketObj != null)
socketObj.close();
_srvSocket.close();
} catch (IOException e) {

View File

@ -339,12 +339,6 @@ public class Tcpbw100 extends JApplet implements ActionListener {
System.exit(0);
}
final Tcpbw100 applet = new Tcpbw100(useSSL);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
applet.destroy();
System.exit(0);
}
});
applet._bIsApplication = true;
if (args.length > 1) {
applet._sClient = args[1];
@ -933,14 +927,6 @@ public class Tcpbw100 extends JApplet implements ActionListener {
// Add "Options" button
_buttonOptions = new JButton(_resBundDisplayMsgs.getString("options")
+ "...");
_buttonOptions.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
_buttonOptions.setEnabled(false);
// call the Options-window create code
createOptionsWindow();
_buttonOptions.setEnabled(true);
}
});
// If disableOptions is not set, then add button
if (getParameter("disableOptions") == null) {
buttonsPanel.add(_buttonOptions);
@ -1126,14 +1112,6 @@ public class Tcpbw100 extends JApplet implements ActionListener {
_frameOptions.getContentPane().add("South", buttonsPanel);
JButton okButton = new JButton(_resBundDisplayMsgs.getString("ok"));
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
_frameOptions.toBack();
_frameOptions.dispose();
}
});
// place buttons
buttonsPanel.add("West", okButton);
@ -3354,11 +3332,6 @@ public class Tcpbw100 extends JApplet implements ActionListener {
// buffering (older "todo" left as is)
JLabel info = new JLabel(
_resBundDisplayMsgs.getString("information"));
info.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
showBufferedBytesInfo();
}
});
info.setForeground(Color.BLUE);
info.setCursor(new Cursor(Cursor.HAND_CURSOR));
info.setAlignmentY((float) 0.8);
@ -3375,12 +3348,6 @@ public class Tcpbw100 extends JApplet implements ActionListener {
// buffering (older "todo" left as is)
JLabel info = new JLabel(
_resBundDisplayMsgs.getString("information"));
info.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
showBufferedBytesInfo();
}
});
info.setForeground(Color.BLUE);
info.setCursor(new Cursor(Cursor.HAND_CURSOR));
info.setAlignmentY((float) 0.8);

View File

@ -692,11 +692,9 @@ public class SybilRenderer {
int i0 = i >> 8;
int i1 = i & 0xff;
String sip = i0 + "." + i1 + ".0.0/16";
if (buf != null) {
buf.append("<p class=\"sybil_info\"><b>").append(count).append(" routers with IP <a href=\"/netdb?ip=")
.append(sip).append("&amp;sybil\">").append(sip)
.append("</a></b></p>");
}
for (RouterInfo info : ris) {
found = true;
renderRouterInfo(buf, info, null, false, false);

View File

@ -160,8 +160,10 @@ public class CreateLeaseSet2Message extends CreateLeaseSetMessage {
@Override
protected byte[] doWriteMessage() throws I2CPMessageException, IOException {
if (_leaseSet == null)
throw new I2CPMessageException("Unable to write out the message as there is not enough data");
int type = _leaseSet.getType();
if (_sessionId == null || _leaseSet == null ||
if (_sessionId == null ||
(type != DatabaseEntry.KEY_TYPE_META_LS2 && _privateKey == null))
throw new I2CPMessageException("Unable to write out the message as there is not enough data");
int size = 4 // sessionId

View File

@ -812,8 +812,14 @@ class ClientMessageEventListener implements I2CPMessageReader.I2CPMessageEventLi
if (_log.shouldInfo())
_log.info("Got Blinding info");
BlindData bd = message.getBlindData();
if (bd == null) {
// hash or hostname lookup? don't support for now
if (_log.shouldWarn())
_log.warn("Unsupported BlindingInfo type: " + message);
return;
}
SigningPublicKey spk = bd.getUnblindedPubKey();
if (spk == null || bd == null) {
if (spk == null) {
// hash or hostname lookup? don't support for now
if (_log.shouldWarn())
_log.warn("Unsupported BlindingInfo type: " + message);

View File

@ -287,7 +287,7 @@ class InboundMessageDistributor implements GarlicMessageReceiver.CloveReceiver {
// ... and inject it.
if (_log.shouldLog(Log.INFO))
_log.info("Storing garlic RI down tunnel for: " + dsm.getKey() + " sent to: " + _client.toBase32());
_log.info("Storing garlic RI down tunnel for: " + dsm.getKey());
_context.inNetMessagePool().add(dsm, null, null);
}
} else if (_client != null && type == DatabaseSearchReplyMessage.MESSAGE_TYPE) {