-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix connection problem for ipv6 peer #670
Conversation
Warnings are found on analyzing the commit 3eb9aae. 2 warnings:
We recommend to address them as possible, for example, update outdated dependencies, fix the tool's configuration, configure If you are struggling with these errors or warnings, feel free to ask us via chat. 💬 |
@@ -92,10 +93,12 @@ public void retrySendMessage() { | |||
errorCode = ChannelMessageError.NODES_UNREACHABLE.getError(); | |||
throw new Exception(" Failed to send message,all retry failed "); | |||
} | |||
String host = getFromConnection().getHost(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Found 'DU'-anomaly for variable 'host' (lines '96'-'143'). (view)
Rule | Ruleset | Priority |
---|---|---|
DataflowAnomalyAnalysis |
Error Prone | 5 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -92,10 +93,12 @@ public void retrySendMessage() { | |||
errorCode = ChannelMessageError.NODES_UNREACHABLE.getError(); | |||
throw new Exception(" Failed to send message,all retry failed "); | |||
} | |||
String host = getFromConnection().getHost(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid unused local variables such as 'host'. (view)
Rule | Ruleset | Priority |
---|---|---|
UnusedLocalVariable |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -92,10 +93,12 @@ public void retrySendMessage() { | |||
errorCode = ChannelMessageError.NODES_UNREACHABLE.getError(); | |||
throw new Exception(" Failed to send message,all retry failed "); | |||
} | |||
String host = getFromConnection().getHost(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
src/main/java/org/fisco/bcos/channel/client/ChannelResponseCallback2.java
Outdated
Show resolved
Hide resolved
@@ -299,6 +300,13 @@ public void init() { | |||
String IP = connectionStr.substring(0, index); | |||
String port = connectionStr.substring(index + 1); | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -299,6 +300,13 @@ public void init() { | |||
String IP = connectionStr.substring(0, index); | |||
String port = connectionStr.substring(index + 1); | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); | |||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
IP = Inet6Address.getByName(IP).getHostAddress(); | ||
} catch (Exception e) { | ||
throw new IllegalArgumentException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] New exception is thrown in catch block, original stack trace may be lost (view)
Rule | Ruleset | Priority |
---|---|---|
PreserveStackTrace |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -95,7 +96,8 @@ public void retrySendMessage() { | |||
|
|||
ChannelHandlerContext ctx = | |||
fromChannelConnections.getNetworkConnectionByHost( | |||
getFromConnection().getHost(), getFromConnection().getPort()); | |||
Inet6Address.getByName(getFromConnection().getHost()).getHostAddress(), | |||
getFromConnection().getPort()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -106,7 +108,7 @@ public void retrySendMessage() { | |||
|
|||
logger.debug( | |||
"send message to {}:{} success ", | |||
fromConnection.getHost(), | |||
Inet6Address.getByName(fromConnection.getHost()).getHostAddress(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -3,6 +3,7 @@ | |||
import io.netty.buffer.ByteBuf; | |||
import io.netty.channel.ChannelHandlerContext; | |||
import io.netty.util.Timeout; | |||
import java.net.Inet6Address; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid unused imports such as 'java.net.Inet6Address' (view)
Rule | Ruleset | Priority |
---|---|---|
UnusedImports |
Best Practices | 4 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -95,7 +96,8 @@ public void retrySendMessage() { | |||
|
|||
ChannelHandlerContext ctx = | |||
fromChannelConnections.getNetworkConnectionByHost( | |||
getFromConnection().getHost(), getFromConnection().getPort()); | |||
getFromConnection().getHost(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
String endpoint = ""; | ||
try { | ||
endpoint = Inet6Address.getByName(host).getHostAddress() + ":" + port; | ||
} catch (Exception e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
String endpoint = ""; | ||
try { | ||
endpoint = Inet6Address.getByName(host).getHostAddress() + ":" + port; | ||
} catch (Exception e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
String endpoint = ""; | ||
try { | ||
endpoint = Inet6Address.getByName(host).getHostAddress() + ":" + port; | ||
} catch (Exception e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -299,6 +318,13 @@ public void init() { | |||
String IP = connectionStr.substring(0, index); | |||
String port = connectionStr.substring(index + 1); | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -299,6 +318,13 @@ public void init() { | |||
String IP = connectionStr.substring(0, index); | |||
String port = connectionStr.substring(index + 1); | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); | |||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
IP = Inet6Address.getByName(IP).getHostAddress(); | ||
} catch (Exception e) { | ||
throw new IllegalArgumentException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] New exception is thrown in catch block, original stack trace may be lost (view)
Rule | Ruleset | Priority |
---|---|---|
PreserveStackTrace |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
String peer = connectionInfo.getHost() + ":" + connectionInfo.getPort(); | ||
ChannelHandlerContext ctx = networkConnections.get(peer); | ||
for (Map.Entry<String, ChannelHandlerContext> entry : networkConnections.entrySet()) { | ||
String peer = entry.getKey(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Found 'DD'-anomaly for variable 'peer' (lines '598'-'598'). (view)
Rule | Ruleset | Priority |
---|---|---|
DataflowAnomalyAnalysis |
Error Prone | 5 |
References:
You can close this issue if no need to fix it. Learn more.
String peer = connectionInfo.getHost() + ":" + connectionInfo.getPort(); | ||
ChannelHandlerContext ctx = networkConnections.get(peer); | ||
for (Map.Entry<String, ChannelHandlerContext> entry : networkConnections.entrySet()) { | ||
String peer = entry.getKey(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Found 'DU'-anomaly for variable 'peer' (lines '598'-'611'). (view)
Rule | Ruleset | Priority |
---|---|---|
DataflowAnomalyAnalysis |
Error Prone | 5 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
endpoint = Inet6Address.getByName(host).getHostAddress() + ":" + port; | ||
} catch (Exception e) { | ||
logger.error("invalid host string format, value: " + host); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Logger calls should be surrounded by log level guards. (view)
Rule | Ruleset | Priority |
---|---|---|
GuardLogStatement |
Best Practices | 2 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -299,6 +315,13 @@ public void init() { | |||
String IP = connectionStr.substring(0, index); | |||
String port = connectionStr.substring(index + 1); | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -299,6 +315,13 @@ public void init() { | |||
String IP = connectionStr.substring(0, index); | |||
String port = connectionStr.substring(index + 1); | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); | |||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
IP = Inet6Address.getByName(IP).getHostAddress(); | ||
} catch (Exception e) { | ||
throw new IllegalArgumentException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] New exception is thrown in catch block, original stack trace may be lost (view)
Rule | Ruleset | Priority |
---|---|---|
PreserveStackTrace |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
String peer = connectionInfo.getHost() + ":" + connectionInfo.getPort(); | ||
ChannelHandlerContext ctx = networkConnections.get(peer); | ||
for (Map.Entry<String, ChannelHandlerContext> entry : networkConnections.entrySet()) { | ||
String peer = entry.getKey(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Found 'DD'-anomaly for variable 'peer' (lines '595'-'595'). (view)
Rule | Ruleset | Priority |
---|---|---|
DataflowAnomalyAnalysis |
Error Prone | 5 |
References:
You can close this issue if no need to fix it. Learn more.
String peer = connectionInfo.getHost() + ":" + connectionInfo.getPort(); | ||
ChannelHandlerContext ctx = networkConnections.get(peer); | ||
for (Map.Entry<String, ChannelHandlerContext> entry : networkConnections.entrySet()) { | ||
String peer = entry.getKey(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Found 'DU'-anomaly for variable 'peer' (lines '595'-'608'). (view)
Rule | Ruleset | Priority |
---|---|---|
DataflowAnomalyAnalysis |
Error Prone | 5 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -304,6 +320,13 @@ public void init() { | |||
" Invalid configuration, invalid IP string format, value: " + IP); | |||
} | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -304,6 +320,13 @@ public void init() { | |||
" Invalid configuration, invalid IP string format, value: " + IP); | |||
} | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); | |||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
IP = Inet6Address.getByName(IP).getHostAddress(); | ||
} catch (Exception e) { | ||
throw new IllegalArgumentException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] New exception is thrown in catch block, original stack trace may be lost (view)
Rule | Ruleset | Priority |
---|---|---|
PreserveStackTrace |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
endpoint = Inet6Address.getByName(host).getHostAddress() + ":" + port; | ||
} catch (Exception e) { | ||
logger.error("invalid host string format, value: " + host); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint = host + ":" + port;
try { | ||
endpoint = Inet6Address.getByName(host).getHostAddress() + ":" + port; | ||
} catch (Exception e) { | ||
logger.error("invalid host string format, value: " + host); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint = host + ":" + port
try { | ||
endpoint = Inet6Address.getByName(host).getHostAddress() + ":" + port; | ||
} catch (Exception e) { | ||
logger.error("invalid host string format, value: " + host); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint = host + ":" + port
host = Inet6Address.getByName(host).getHostAddress(); | ||
endpoint = host + ":" + port; | ||
} catch (Exception e) { | ||
logger.error("invalid host string format, value: " + host); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Logger calls should be surrounded by log level guards. (view)
Rule | Ruleset | Priority |
---|---|---|
GuardLogStatement |
Best Practices | 2 |
References:
You can close this issue if no need to fix it. Learn more.
host = Inet6Address.getByName(host).getHostAddress(); | ||
endpoint = host + ":" + port; | ||
} catch (Exception e) { | ||
logger.error("invalid host string format, value: " + host); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Logger calls should be surrounded by log level guards. (view)
Rule | Ruleset | Priority |
---|---|---|
GuardLogStatement |
Best Practices | 2 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -245,7 +246,13 @@ public ChannelHandlerContext randomNetworkConnection( | |||
} | |||
|
|||
public ChannelHandlerContext getNetworkConnectionByHost(String host, Integer port) { | |||
String endpoint = host + ":" + port; | |||
String endpoint = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Found 'DD'-anomaly for variable 'endpoint' (lines '249'-'252'). (view)
Rule | Ruleset | Priority |
---|---|---|
DataflowAnomalyAnalysis |
Error Prone | 5 |
References:
You can close this issue if no need to fix it. Learn more.
String endpoint = host + ":" + port; | ||
String endpoint = ""; | ||
try { | ||
host = Inet6Address.getByName(host).getHostAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
host = Inet6Address.getByName(host).getHostAddress(); | ||
endpoint = host + ":" + port; | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
String endpoint = host + ":" + port; | ||
String endpoint = ""; | ||
try { | ||
host = Inet6Address.getByName(host).getHostAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
host = Inet6Address.getByName(host).getHostAddress(); | ||
endpoint = host + ":" + port; | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -304,6 +323,13 @@ public void init() { | |||
" Invalid configuration, invalid IP string format, value: " + IP); | |||
} | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -304,6 +323,13 @@ public void init() { | |||
" Invalid configuration, invalid IP string format, value: " + IP); | |||
} | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); | |||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
IP = Inet6Address.getByName(IP).getHostAddress(); | ||
} catch (Exception e) { | ||
throw new IllegalArgumentException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] New exception is thrown in catch block, original stack trace may be lost (view)
Rule | Ruleset | Priority |
---|---|---|
PreserveStackTrace |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
String peer = connectionInfo.getHost() + ":" + connectionInfo.getPort(); | ||
ChannelHandlerContext ctx = networkConnections.get(peer); | ||
for (Map.Entry<String, ChannelHandlerContext> entry : networkConnections.entrySet()) { | ||
String peer = entry.getKey(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Found 'DD'-anomaly for variable 'peer' (lines '595'-'595'). (view)
Rule | Ruleset | Priority |
---|---|---|
DataflowAnomalyAnalysis |
Error Prone | 5 |
References:
You can close this issue if no need to fix it. Learn more.
String peer = connectionInfo.getHost() + ":" + connectionInfo.getPort(); | ||
ChannelHandlerContext ctx = networkConnections.get(peer); | ||
for (Map.Entry<String, ChannelHandlerContext> entry : networkConnections.entrySet()) { | ||
String peer = entry.getKey(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Found 'DU'-anomaly for variable 'peer' (lines '595'-'608'). (view)
Rule | Ruleset | Priority |
---|---|---|
DataflowAnomalyAnalysis |
Error Prone | 5 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -304,6 +320,13 @@ public void init() { | |||
" Invalid configuration, invalid IP string format, value: " + IP); | |||
} | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -304,6 +320,13 @@ public void init() { | |||
" Invalid configuration, invalid IP string format, value: " + IP); | |||
} | |||
|
|||
try { | |||
IP = Inet6Address.getByName(IP).getHostAddress(); | |||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
IP = Inet6Address.getByName(IP).getHostAddress(); | ||
} catch (Exception e) { | ||
throw new IllegalArgumentException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] New exception is thrown in catch block, original stack trace may be lost (view)
Rule | Ruleset | Priority |
---|---|---|
PreserveStackTrace |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -260,12 +266,22 @@ public ChannelHandlerContext getNetworkConnectionByHost(String host, Integer por | |||
*/ | |||
public ChannelHandlerContext setAndGetNetworkConnectionByHost( | |||
String host, Integer port, ChannelHandlerContext ctx) { | |||
try { | |||
host = Inet6Address.getByName(host).getHostAddress(); | |||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
host = Inet6Address.getByName(host).getHostAddress(); | ||
} catch (Exception e) { | ||
logger.error("invalid host string format, value: " + host); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Logger calls should be surrounded by log level guards. (view)
Rule | Ruleset | Priority |
---|---|---|
GuardLogStatement |
Best Practices | 2 |
References:
You can close this issue if no need to fix it. Learn more.
String endpoint = host + ":" + port; | ||
return networkConnections.put(endpoint, ctx); | ||
} | ||
|
||
public void removeNetworkConnectionByHost( | ||
String host, Integer port, ChannelHandlerContext ctx) { | ||
try { | ||
host = Inet6Address.getByName(host).getHostAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Potential violation of Law of Demeter (method chain calls) (view)
Rule | Ruleset | Priority |
---|---|---|
LawOfDemeter |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
String endpoint = host + ":" + port; | ||
return networkConnections.put(endpoint, ctx); | ||
} | ||
|
||
public void removeNetworkConnectionByHost( | ||
String host, Integer port, ChannelHandlerContext ctx) { | ||
try { | ||
host = Inet6Address.getByName(host).getHostAddress(); | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block (view)
Rule | Ruleset | Priority |
---|---|---|
AvoidCatchingGenericException |
Design | 3 |
References:
You can close this issue if no need to fix it. Learn more.
try { | ||
host = Inet6Address.getByName(host).getHostAddress(); | ||
} catch (Exception e) { | ||
logger.error("invalid host string format, value: " + host); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Logger calls should be surrounded by log level guards. (view)
Rule | Ruleset | Priority |
---|---|---|
GuardLogStatement |
Best Practices | 2 |
References:
You can close this issue if no need to fix it. Learn more.
Fix the problem that web3sdk cannot connect to IPv6 node probabilistically