Repository: qpid-broker-j
Updated Branches:
  refs/heads/master f877df106 -> d31e478a4


QPID-8081: [Broker-J] [Logback] Defensive guard against null activeFile


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/d31e478a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/d31e478a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/d31e478a

Branch: refs/heads/master
Commit: d31e478a490e1398c85587bf0de2883ea8b9c3d8
Parents: f877df1
Author: Keith Wall <kw...@apache.org>
Authored: Fri Feb 2 12:17:40 2018 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Fri Feb 2 12:17:40 2018 +0000

----------------------------------------------------------------------
 .../apache/qpid/server/logging/logback/AppenderUtils.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d31e478a/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/AppenderUtils.java
----------------------------------------------------------------------
diff --git 
a/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/AppenderUtils.java
 
b/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/AppenderUtils.java
index 16fd87d..2de5161 100644
--- 
a/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/AppenderUtils.java
+++ 
b/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/AppenderUtils.java
@@ -116,7 +116,7 @@ public class AppenderUtils
     {
         private final boolean _rollOnRestart;
         private final FileSize _maxFileSize;
-        private boolean _isFirst = true;
+        private volatile boolean _isFirst = true;
 
         public DailyTriggeringPolicy(boolean isRollOnRestart, String 
maxFileSize)
         {
@@ -141,7 +141,7 @@ public class AppenderUtils
             if (_rollOnRestart && _isFirst)
             {
                 _isFirst = false;
-                if (activeFile.exists() && activeFile.length() == 0)
+                if (activeFile != null && activeFile.exists() && 
activeFile.length() == 0)
                 {
                     computeNextCheck();
                     return false;
@@ -161,7 +161,7 @@ public class AppenderUtils
     {
         private final boolean _rollOnRestart;
         private final FileSize _maxFileSize;
-        private boolean _isFirst = true;
+        private volatile boolean _isFirst = true;
 
         public SizeTriggeringPolicy(boolean isRollOnRestart, String 
maxFileSize)
         {
@@ -177,7 +177,7 @@ public class AppenderUtils
             if (_rollOnRestart && _isFirst)
             {
                 _isFirst = false;
-                return activeFile.exists() && activeFile.length() != 0l;
+                return activeFile != null && activeFile.exists() && 
activeFile.length() != 0;
             }
             else
             {
@@ -193,7 +193,7 @@ public class AppenderUtils
 
     static class SimpleRollingPolicy extends FixedWindowRollingPolicy
     {
-        private int _maxFiles;
+        private final int _maxFiles;
 
         public SimpleRollingPolicy(int maxHistory)
         {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to