zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r1612458 - in /zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/ src/java/main/org/apache/zookeeper/server/ src/java/main/org/apache/zookeeper/server/persistence/ src/java/main/org/apache/zookeeper/server/quorum/
Date Tue, 22 Jul 2014 04:51:18 GMT
Author: phunt
Date: Tue Jul 22 04:51:17 2014
New Revision: 1612458

URL: http://svn.apache.org/r1612458
Log:
ZOOKEEPER-1981. Fix Dodgy Code Warnings identified by findbugs 2.0.3 (Hongchao Deng via phunt)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1612458&r1=1612457&r2=1612458&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Tue Jul 22 04:51:17 2014
@@ -723,6 +723,9 @@ BUGFIXES:
   ZOOKEEPER-1979. Fix Performance Warnings found by Findbugs 2.0.3
   (Hongchao Deng via phunt)
 
+  ZOOKEEPER-1981. Fix Dodgy Code Warnings identified by findbugs 2.0.3
+  (Hongchao Deng via phunt)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports,

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java?rev=1612458&r1=1612457&r2=1612458&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java Tue Jul 22 04:51:17
2014
@@ -2493,6 +2493,9 @@ public class ZooKeeper {
             rmReq.setType(watcherType.getIntValue());
             request = rmReq;
             break;
+        default:
+            LOG.warn("unknown type " + opCode);
+            break;
         }
         return request;
     }

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java?rev=1612458&r1=1612457&r2=1612458&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java Tue
Jul 22 04:51:17 2014
@@ -696,6 +696,9 @@ public class PrepRequestProcessor extend
                 request.setTxn(new CheckVersionTxn(path, checkAndIncVersion(nodeRecord.stat.getVersion(),
                         checkVersionRequest.getVersion(), path)));
                 break;
+            default:
+                LOG.warn("unknown type " + type);
+                break;
         }
     }
 
@@ -843,6 +846,9 @@ public class PrepRequestProcessor extend
                 zks.sessionTracker.checkSession(request.sessionId,
                         request.getOwner());
                 break;
+            default:
+                LOG.warn("unknown type " + request.type);
+                break;
             }
         } catch (KeeperException e) {
             if (request.getHdr() != null) {

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java?rev=1612458&r1=1612457&r2=1612458&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java
(original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java
Tue Jul 22 04:51:17 2014
@@ -676,8 +676,6 @@ public class FileTxnLog implements TxnLo
                 crc.update(bytes, 0, bytes.length);
                 if (crcValue != crc.getValue())
                     throw new IOException(CRC_ERROR);
-                if (bytes == null || bytes.length == 0)
-                    return false;
                 hdr = new TxnHeader();
                 record = SerializeUtils.deserializeTxn(bytes, hdr);
             } catch (EOFException e) {

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java?rev=1612458&r1=1612457&r2=1612458&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java
(original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java
Tue Jul 22 04:51:17 2014
@@ -276,6 +276,9 @@ public class AuthFastLeaderElection impl
                     case 2:
                         ackstate = QuorumPeer.ServerState.FOLLOWING;
                         break;
+                    default:
+                        LOG.warn("unknown type " + responseBuffer.getInt());
+                        break;
                     }
 
                     Vote current = self.getCurrentVote();
@@ -698,6 +701,9 @@ public class AuthFastLeaderElection impl
                         LOG.warn("Exception while sending ack: ", e);
                     }
                     break;
+                default:
+                    LOG.warn("unknown type " + m.type);
+                    break;
                 }
             }
         }

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java?rev=1612458&r1=1612457&r2=1612458&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java Tue Jul
22 04:51:17 2014
@@ -163,6 +163,9 @@ public class Follower extends Learner{
         case Leader.SYNC:
             fzk.sync();
             break;
+        default:
+            LOG.warn("unknown type " + qp.getType());
+            break;
         }
     }
 



Mime
View raw message