bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mme...@apache.org
Subject bookkeeper git commit: BOOKKEEPER-925: Fix FindBugs discovered issues in master
Date Wed, 27 Apr 2016 19:11:39 GMT
Repository: bookkeeper
Updated Branches:
  refs/heads/master 696a1515b -> 101de10a8


BOOKKEEPER-925: Fix FindBugs discovered issues in master

Author: Matteo Merli <mmerli@apache.org>

Reviewers: Siddharth Boobna <siddharth.boobna@gmail.com>, Guo Sijie <sijie@apache.org>

Closes #39 from merlimat/bk-925


Project: http://git-wip-us.apache.org/repos/asf/bookkeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/bookkeeper/commit/101de10a
Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/101de10a
Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/101de10a

Branch: refs/heads/master
Commit: 101de10a817d2a0704ce746eaed90cc0d73ca078
Parents: 696a151
Author: Matteo Merli <mmerli@apache.org>
Authored: Wed Apr 27 12:11:27 2016 -0700
Committer: Matteo Merli <mmerli@apache.org>
Committed: Wed Apr 27 12:11:27 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/bookkeeper/bookie/BookieShell.java  | 3 ++-
 .../bookkeeper/bookie/ScanAndCompareGarbageCollector.java    | 8 ++++----
 .../java/org/apache/bookkeeper/client/BookieWatcher.java     | 3 +--
 .../bookkeeper/meta/ZkLedgerUnderreplicationManager.java     | 2 +-
 .../main/java/org/apache/bookkeeper/proto/AuthHandler.java   | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/101de10a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
index 7d49a6a..df31bf2 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
@@ -458,7 +458,8 @@ public class BookieShell implements Tool {
                 while (entries.hasNext()) {
                     LedgerEntry entry = entries.next();
                     HexDump.dump(entry.getEntry(), 0, out, 0);
-                    System.out.println("Entry Id: " + entry.getEntryId() + ", Data: " + new
String(out.toByteArray()));
+                    System.out.println(
+                            "Entry Id: " + entry.getEntryId() + ", Data: " + new String(out.toByteArray(),
UTF_8));
                     out.reset();
                 }
             } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/101de10a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
index 05cd958..c422a89 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
@@ -212,13 +212,13 @@ public class ScanAndCompareGarbageCollector implements GarbageCollector{
                         try {
                             ZkLedgerUnderreplicationManager.releaseUnderreplicatedLedgerLock(zk,
zkLedgersRootPath,
                                     ledgerId);
-                        } catch (Exception e) {
-                            LOG.error("Error removing underreplicated lock for ledger {}",
ledgerId, e);
+                        } catch (Throwable t) {
+                            LOG.error("Exception when removing underreplicated lock for ledger
{}", ledgerId, t);
                         }
                     }
                 });
-            } catch (Exception e) {
-                LOG.error("Exception when iterating through the ledgers to check for over-replication",
e);
+            } catch (Throwable t) {
+                LOG.error("Exception when iterating through the ledgers to check for over-replication",
t);
                 latch.countDown();
             }
         }

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/101de10a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcher.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcher.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcher.java
index 0142827..1e49cf8 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcher.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcher.java
@@ -62,7 +62,6 @@ class BookieWatcher implements Watcher, ChildrenCallback {
 
     public static int ZK_CONNECT_BACKOFF_SEC = 1;
     private static final Set<BookieSocketAddress> EMPTY_SET = new HashSet<BookieSocketAddress>();
-    private static final Boolean BOOLEAN = new Boolean(true);
 
     // Bookie registration path in ZK
     private final String bookieRegistrationPath;
@@ -302,7 +301,7 @@ class BookieWatcher implements Watcher, ChildrenCallback {
      */
     public void quarantineBookie(BookieSocketAddress bookie) {
         if (quarantinedBookies.getIfPresent(bookie) == null) {
-            quarantinedBookies.put(bookie, BOOLEAN);
+            quarantinedBookies.put(bookie, Boolean.TRUE);
             logger.warn("Bookie {} has been quarantined because of read/write errors.", bookie);
         }
     }

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/101de10a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java
index c49c5a2..363b517 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java
@@ -78,7 +78,7 @@ public class ZkLedgerUnderreplicationManager implements LedgerUnderreplicationMa
     static final String LAYOUT="BASIC";
     static final int LAYOUT_VERSION=1;
 
-    public static final byte[] LOCK_DATA = getLockData();
+    private static final byte[] LOCK_DATA = getLockData();
 
     private static class Lock {
         private final String lockZNode;

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/101de10a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/AuthHandler.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/AuthHandler.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/AuthHandler.java
index ab49da7..dd51a68 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/AuthHandler.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/AuthHandler.java
@@ -274,7 +274,7 @@ class AuthHandler {
         public void writeRequested(ChannelHandlerContext ctx,
                                    MessageEvent e)
                 throws Exception {
-            synchronized (waitingForAuth) {
+            synchronized (this) {
                 if (authenticated) {
                     super.writeRequested(ctx, e);
                 } else if (e.getMessage() instanceof BookkeeperProtocol.Request) {
@@ -339,7 +339,7 @@ class AuthHandler {
             @Override
             public void operationComplete(int rc, Void v) {
                 if (rc == BKException.Code.OK) {
-                    synchronized (waitingForAuth) {
+                    synchronized (this) {
                         authenticated = true;
                         MessageEvent e = waitingForAuth.poll();
                         while (e != null) {


Mime
View raw message