You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2015/05/06 21:13:24 UTC
activemq git commit: https://issues.apache.org/jira/browse/AMQ-5758
Repository: activemq
Updated Branches:
refs/heads/master 6a2ffca57 -> 1271d2ea0
https://issues.apache.org/jira/browse/AMQ-5758
Fix for potential NPE.
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/1271d2ea
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/1271d2ea
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/1271d2ea
Branch: refs/heads/master
Commit: 1271d2ea032f234e7c83301a52845ed001c5831a
Parents: 6a2ffca
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed May 6 15:13:15 2015 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed May 6 15:13:15 2015 -0400
----------------------------------------------------------------------
.../util/DefaultIOExceptionHandler.java | 22 +++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/1271d2ea/activemq-broker/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java b/activemq-broker/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java
index cf47f23..bb4e0b2 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java
@@ -46,8 +46,9 @@ import org.slf4j.LoggerFactory;
private String noSpaceMessage = "space";
private String sqlExceptionMessage = ""; // match all
private long resumeCheckSleepPeriod = 5*1000;
- private AtomicBoolean handlingException = new AtomicBoolean(false);
+ private final AtomicBoolean handlingException = new AtomicBoolean(false);
+ @Override
public void handle(IOException exception) {
if (ignoreAllErrors) {
LOG.info("Ignoring IO exception, " + exception, exception);
@@ -69,10 +70,17 @@ import org.slf4j.LoggerFactory;
if (ignoreSQLExceptions) {
Throwable cause = exception;
while (cause != null) {
- String message = cause.getMessage();
- if (cause instanceof SQLException && message.contains(sqlExceptionMessage)) {
- LOG.info("Ignoring SQLException, " + exception, cause);
- return;
+ if (cause instanceof SQLException) {
+ String message = cause.getMessage();
+
+ if (message == null) {
+ message = "";
+ }
+
+ if (message.contains(sqlExceptionMessage)) {
+ LOG.info("Ignoring SQLException, " + exception, cause);
+ return;
+ }
}
cause = cause.getCause();
}
@@ -83,6 +91,7 @@ import org.slf4j.LoggerFactory;
LOG.info("Initiating stop/restart of transports on " + broker + " due to IO exception, " + exception, exception);
new Thread("IOExceptionHandler: stop transports") {
+ @Override
public void run() {
try {
ServiceStopper stopper = new ServiceStopper();
@@ -93,6 +102,7 @@ import org.slf4j.LoggerFactory;
} finally {
// resume again
new Thread("IOExceptionHandler: restart transports") {
+ @Override
public void run() {
try {
while (hasLockOwnership() && isPersistenceAdapterDown()) {
@@ -154,6 +164,7 @@ import org.slf4j.LoggerFactory;
private void stopBroker(Exception exception) {
LOG.info("Stopping " + broker + " due to exception, " + exception, exception);
new Thread("IOExceptionHandler: stopping " + broker) {
+ @Override
public void run() {
try {
if( broker.isRestartAllowed() ) {
@@ -171,6 +182,7 @@ import org.slf4j.LoggerFactory;
return true;
}
+ @Override
public void setBrokerService(BrokerService broker) {
this.broker = broker;
}