activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-5758
Date Wed, 06 May 2015 19:13:24 GMT
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 <tabish121@gmail.com>
Authored: Wed May 6 15:13:15 2015 -0400
Committer: Timothy Bish <tabish121@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;
     }


Mime
View raw message