(chores) cleanup exceptions leveldb components (#5894)
- components: camel-leveldb and camel-leveldb-legacy
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 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 @@
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 @@
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 @@
}
} 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 @@
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 @@
try {
return (repo + '\0' + key).getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ throw new RuntimeCamelException(e);
}
}
@@ -471,7 +473,7 @@
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.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 @@
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 @@
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 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 @@
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 @@
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 @@
}
} 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 @@
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 @@
try {
return (repo + '\0' + key).getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ throw new RuntimeCamelException(e);
}
}
@@ -468,7 +470,7 @@
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.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 @@
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 @@
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");