Repository: incubator-distributedlog
Updated Branches:
  refs/heads/master 53f7b5821 -> deb8d3755


DL-136: Avoid empty catch blocks

* resolves the 9 empty catch blocks in `src/main`
* leaves 49 errors within `src/test` unchanged
  * if we want to resolve those as well let me know, wasn't sure how we wanted 
to handle that

Used an independent checkstyle that looked for [empty catch 
blocks](http://checkstyle.sourceforge.net/config_blocks.html#EmptyBlock). Did a 
quick manual analysis and cannot find any other empty catch blocks in 
`src/main` so cannot rectify the original 22 as stated in the [Kiuwan 
blog](https://www.kiuwan.com/blog/analyzing_distributedlog_twitter-2/).

Author: Brennon York <[email protected]>

Reviewers: Sijie Guo <[email protected]>

Closes #74 from brennonyork/DL-136


Project: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/commit/deb8d375
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/tree/deb8d375
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/diff/deb8d375

Branch: refs/heads/master
Commit: deb8d375543db262ca5e9f5010a54eec6e22581b
Parents: 53f7b58
Author: Brennon York <[email protected]>
Authored: Mon Dec 19 22:20:52 2016 -0800
Committer: Sijie Guo <[email protected]>
Committed: Mon Dec 19 22:20:52 2016 -0800

----------------------------------------------------------------------
 .../distributedlog/benchmark/stream/AsyncReaderBenchmark.java  | 6 ++++++
 .../distributedlog/benchmark/stream/LedgerReadBenchmark.java   | 4 ++++
 .../distributedlog/benchmark/stream/SyncReaderBenchmark.java   | 6 ++++++
 .../twitter/distributedlog/metadata/ZkMetadataResolver.java    | 1 +
 4 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/deb8d375/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/AsyncReaderBenchmark.java
----------------------------------------------------------------------
diff --git 
a/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/AsyncReaderBenchmark.java
 
b/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/AsyncReaderBenchmark.java
index 6fc7e03..5c18705 100644
--- 
a/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/AsyncReaderBenchmark.java
+++ 
b/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/AsyncReaderBenchmark.java
@@ -54,6 +54,8 @@ public class AsyncReaderBenchmark extends 
AbstractReaderBenchmark {
                 try {
                     
TimeUnit.MILLISECONDS.sleep(conf.getZKSessionTimeoutMilliseconds());
                 } catch (InterruptedException e) {
+                    logger.warn("Interrupted from sleep while creating dlm for 
stream {} : ",
+                        streamName, e);
                 }
             }
         }
@@ -120,6 +122,8 @@ public class AsyncReaderBenchmark extends 
AbstractReaderBenchmark {
                 try {
                     
TimeUnit.MILLISECONDS.sleep(conf.getZKSessionTimeoutMilliseconds());
                 } catch (InterruptedException e) {
+                    logger.warn("Interrupted from sleep after reader was 
reassigned null for stream {} : ",
+                        streamName, e);
                 }
                 continue;
             }
@@ -147,6 +151,8 @@ public class AsyncReaderBenchmark extends 
AbstractReaderBenchmark {
             try {
                 
TimeUnit.MILLISECONDS.sleep(conf.getZKSessionTimeoutMilliseconds());
             } catch (InterruptedException e) {
+                logger.warn("Interrupted from sleep while creating reader for 
stream {} : ",
+                    streamName, e);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/deb8d375/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/LedgerReadBenchmark.java
----------------------------------------------------------------------
diff --git 
a/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/LedgerReadBenchmark.java
 
b/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/LedgerReadBenchmark.java
index 7d3083e..0daffd5 100644
--- 
a/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/LedgerReadBenchmark.java
+++ 
b/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/LedgerReadBenchmark.java
@@ -60,6 +60,8 @@ public class LedgerReadBenchmark extends 
AbstractReaderBenchmark {
                 try {
                     
TimeUnit.MILLISECONDS.sleep(conf.getZKSessionTimeoutMilliseconds());
                 } catch (InterruptedException e) {
+                    logger.warn("Interrupted from sleep while creating dlm for 
stream {} : ",
+                        streamName, e);
                 }
             }
         }
@@ -76,6 +78,8 @@ public class LedgerReadBenchmark extends 
AbstractReaderBenchmark {
                 try {
                     
TimeUnit.MILLISECONDS.sleep(conf.getZKSessionTimeoutMilliseconds());
                 } catch (InterruptedException e) {
+                    logger.warn("Interrupted from sleep while geting log 
segments for stream {} : ",
+                        streamName, e);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/deb8d375/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/SyncReaderBenchmark.java
----------------------------------------------------------------------
diff --git 
a/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/SyncReaderBenchmark.java
 
b/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/SyncReaderBenchmark.java
index b21fd50..88755e2 100644
--- 
a/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/SyncReaderBenchmark.java
+++ 
b/distributedlog-benchmark/src/main/java/com/twitter/distributedlog/benchmark/stream/SyncReaderBenchmark.java
@@ -49,6 +49,8 @@ public class SyncReaderBenchmark extends 
AbstractReaderBenchmark {
                 try {
                     
TimeUnit.MILLISECONDS.sleep(conf.getZKSessionTimeoutMilliseconds());
                 } catch (InterruptedException e) {
+                    logger.warn("Interrupted from sleep while creating dlm for 
stream {} : ",
+                        streamName, e);
                 }
             }
         }
@@ -103,6 +105,8 @@ public class SyncReaderBenchmark extends 
AbstractReaderBenchmark {
                 try {
                     
TimeUnit.MILLISECONDS.sleep(conf.getZKSessionTimeoutMilliseconds());
                 } catch (InterruptedException e) {
+                    logger.warn("Interrupted from sleep after reader was 
reassigned null for stream {} : ",
+                        streamName, e);
                 }
                 continue;
             }
@@ -140,6 +144,8 @@ public class SyncReaderBenchmark extends 
AbstractReaderBenchmark {
             try {
                 
TimeUnit.MILLISECONDS.sleep(conf.getZKSessionTimeoutMilliseconds());
             } catch (InterruptedException e) {
+                logger.warn("Interrupted from sleep while creating reader for 
stream {} : ",
+                    streamName, e);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/deb8d375/distributedlog-core/src/main/java/com/twitter/distributedlog/metadata/ZkMetadataResolver.java
----------------------------------------------------------------------
diff --git 
a/distributedlog-core/src/main/java/com/twitter/distributedlog/metadata/ZkMetadataResolver.java
 
b/distributedlog-core/src/main/java/com/twitter/distributedlog/metadata/ZkMetadataResolver.java
index f2be95c..303fbe6 100644
--- 
a/distributedlog-core/src/main/java/com/twitter/distributedlog/metadata/ZkMetadataResolver.java
+++ 
b/distributedlog-core/src/main/java/com/twitter/distributedlog/metadata/ZkMetadataResolver.java
@@ -62,6 +62,7 @@ public class ZkMetadataResolver implements MetadataResolver {
             try {
                 return DLMetadata.deserialize(uri, data);
             } catch (IOException ie) {
+                throw new IOException("Failed to deserialize uri : " + uri);
             }
         }
         throw new IOException("No bkdl config bound under dl path : " + 
dlPath);

Reply via email to