Skip to content

Commit

Permalink
fix maybeReadTimeOut throw NullPointerException
Browse files Browse the repository at this point in the history
this commit fix issue:
NullPointerException in maybeReadTimeOut() method can cause Eureka cluster registration inconsistency Netflix#1497
  • Loading branch information
laniakea1990 committed Apr 20, 2023
1 parent efc1cf6 commit 3960977
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,20 @@ private static boolean isNetworkConnectException(Throwable e) {
*/
private static boolean maybeReadTimeOut(Throwable e) {
do {
if (IOException.class.isInstance(e)) {
String message = e.getMessage().toLowerCase();
Matcher matcher = READ_TIME_OUT_PATTERN.matcher(message);
if(matcher.find()) {
return true;
}
try {
if (IOException.class.isInstance(e)) {
# !!!this line may occurs NullPointerException in some scenarios.
String message = e.getMessage().toLowerCase();
Matcher matcher = READ_TIME_OUT_PATTERN.matcher(message);
if(matcher.find()) {
return true;
}
}
e = e.getCause();
} catch (Exception ex) {
logger.error("Unexpected other exception occurs when check if the income param e is socket read time out exception ", ex);
return false;
}
e = e.getCause();
} while (e != null);
return false;
}
Expand Down

0 comments on commit 3960977

Please sign in to comment.