This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new f76b32c  (chores) cleanup exceptions leveldb components (#5894)
f76b32c is described below

commit f76b32c2f9d57a1c228bf966903cf1a9d076d384
Author: Otavio Rodolfo Piske <orpi...@users.noreply.github.com>
AuthorDate: Sat Jul 31 07:34:54 2021 +0200

    (chores) cleanup exceptions leveldb components (#5894)
    
    - components: camel-leveldb and camel-leveldb-legacy
---
 .../component/leveldb/LevelDBAggregationRepository.java    | 14 ++++++++------
 .../org/apache/camel/component/leveldb/LevelDBFile.java    |  5 +++--
 .../component/leveldb/LevelDBAggregationRepository.java    | 14 ++++++++------
 .../org/apache/camel/component/leveldb/LevelDBFile.java    |  5 +++--
 4 files changed, 22 insertions(+), 16 deletions(-)

diff --git 
a/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java
 
b/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java
index 2d1d648..fc60dbb 100644
--- 
a/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java
+++ 
b/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java
@@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.spi.RecoverableAggregationRepository;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.support.service.ServiceSupport;
@@ -126,7 +127,7 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
                 return codec.unmarshallExchange(camelContext, new Buffer(rc));
             }
         } catch (IOException e) {
-            throw new RuntimeException("Error adding to repository " + 
repositoryName + " with key " + key, e);
+            throw new RuntimeCamelException("Error adding to repository " + 
repositoryName + " with key " + key, e);
         }
 
         return null;
@@ -145,7 +146,7 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
                 answer = codec.unmarshallExchange(camelContext, new 
Buffer(rc));
             }
         } catch (IOException e) {
-            throw new RuntimeException("Error getting key " + key + " from 
repository " + repositoryName, e);
+            throw new RuntimeCamelException("Error getting key " + key + " 
from repository " + repositoryName, e);
         }
 
         LOG.debug("Getting key  [{}] -> {}", key, answer);
@@ -182,7 +183,7 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
             }
 
         } catch (IOException e) {
-            throw new RuntimeException("Error removing key " + key + " from 
repository " + repositoryName, e);
+            throw new RuntimeCamelException("Error removing key " + key + " 
from repository " + repositoryName, e);
         }
     }
 
@@ -292,7 +293,8 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
                 answer = codec.unmarshallExchange(camelContext, new 
Buffer(rc));
             }
         } catch (IOException e) {
-            throw new RuntimeException("Error recovering exchangeId " + 
exchangeId + " from repository " + repositoryName, e);
+            throw new RuntimeCamelException(
+                    "Error recovering exchangeId " + exchangeId + " from 
repository " + repositoryName, e);
         }
 
         LOG.debug("Recovering exchangeId [{}] -> {}", exchangeId, answer);
@@ -460,7 +462,7 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
         try {
             return (repo + '\0' + key).getBytes("UTF-8");
         } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
+            throw new RuntimeCamelException(e);
         }
     }
 
@@ -471,7 +473,7 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
             try {
                 return new String(value, "UTF-8");
             } catch (UnsupportedEncodingException var2) {
-                throw new RuntimeException(var2);
+                throw new RuntimeCamelException(var2);
             }
         }
     }
diff --git 
a/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
 
b/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
index 9fdb09d..6c72a1b 100644
--- 
a/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
+++ 
b/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
@@ -22,6 +22,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.Service;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
@@ -180,7 +181,7 @@ public class LevelDBFile implements Service {
             DBFactory factory = getFactory();
             db = factory.open(getFile(), options);
         } catch (IOException ioe) {
-            throw new RuntimeException("Error opening LevelDB with file " + 
getFile(), ioe);
+            throw new RuntimeCamelException("Error opening LevelDB with file " 
+ getFile(), ioe);
         }
     }
 
@@ -197,7 +198,7 @@ public class LevelDBFile implements Service {
                     LOG.debug("Using {} implementation of 
org.iq80.leveldb.DBFactory", factory.getClass().getName());
                 }
                 return factory;
-            } catch (Throwable ignored) {
+            } catch (Exception ignored) {
             }
         }
         throw new IllegalStateException("Can't find implementation of 
org.iq80.leveldb.DBFactory");
diff --git 
a/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java
 
b/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java
index cd0b062..7ecccb1 100644
--- 
a/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java
+++ 
b/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java
@@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.spi.RecoverableAggregationRepository;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.support.service.ServiceSupport;
@@ -123,7 +124,7 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
                 return codec().unmarshallExchange(camelContext, rc);
             }
         } catch (IOException e) {
-            throw new RuntimeException("Error adding to repository " + 
repositoryName + " with key " + key, e);
+            throw new RuntimeCamelException("Error adding to repository " + 
repositoryName + " with key " + key, e);
         }
 
         return null;
@@ -142,7 +143,7 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
                 answer = codec().unmarshallExchange(camelContext, rc);
             }
         } catch (IOException e) {
-            throw new RuntimeException("Error getting key " + key + " from 
repository " + repositoryName, e);
+            throw new RuntimeCamelException("Error getting key " + key + " 
from repository " + repositoryName, e);
         }
 
         LOG.debug("Getting key  [{}] -> {}", key, answer);
@@ -179,7 +180,7 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
             }
 
         } catch (IOException e) {
-            throw new RuntimeException("Error removing key " + key + " from 
repository " + repositoryName, e);
+            throw new RuntimeCamelException("Error removing key " + key + " 
from repository " + repositoryName, e);
         }
     }
 
@@ -289,7 +290,8 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
                 answer = codec().unmarshallExchange(camelContext, rc);
             }
         } catch (IOException e) {
-            throw new RuntimeException("Error recovering exchangeId " + 
exchangeId + " from repository " + repositoryName, e);
+            throw new RuntimeCamelException(
+                    "Error recovering exchangeId " + exchangeId + " from 
repository " + repositoryName, e);
         }
 
         LOG.debug("Recovering exchangeId [{}] -> {}", exchangeId, answer);
@@ -457,7 +459,7 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
         try {
             return (repo + '\0' + key).getBytes("UTF-8");
         } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
+            throw new RuntimeCamelException(e);
         }
     }
 
@@ -468,7 +470,7 @@ public class LevelDBAggregationRepository extends 
ServiceSupport implements Reco
             try {
                 return new String(value, "UTF-8");
             } catch (UnsupportedEncodingException var2) {
-                throw new RuntimeException(var2);
+                throw new RuntimeCamelException(var2);
             }
         }
     }
diff --git 
a/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
 
b/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
index 229055f..20a4270 100644
--- 
a/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
+++ 
b/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
@@ -22,6 +22,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.Service;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
@@ -180,7 +181,7 @@ public class LevelDBFile implements Service {
             DBFactory factory = getFactory();
             db = factory.open(getFile(), options);
         } catch (IOException ioe) {
-            throw new RuntimeException("Error opening LevelDB with file " + 
getFile(), ioe);
+            throw new RuntimeCamelException("Error opening LevelDB with file " 
+ getFile(), ioe);
         }
     }
 
@@ -197,7 +198,7 @@ public class LevelDBFile implements Service {
                     LOG.debug("Using {} implementation of 
org.iq80.leveldb.DBFactory", factory.getClass().getName());
                 }
                 return factory;
-            } catch (Throwable ignored) {
+            } catch (Exception ignored) {
             }
         }
         throw new IllegalStateException("Can't find implementation of 
org.iq80.leveldb.DBFactory");

Reply via email to