This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 27cbab0 [CAMEL-13128] Cannot install camel-jms Karaf feature
27cbab0 is described below
commit 27cbab03017f509454baa19fe916cef354f026e9
Author: Guillaume Nodet <[email protected]>
AuthorDate: Mon Jan 28 14:00:13 2019 +0100
[CAMEL-13128] Cannot install camel-jms Karaf feature
---
.../apache/camel/util/IntrospectionSupport.java | 13 +++++++++-
.../java/org/apache/camel/util/ObjectHelper.java | 28 ++++++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git
a/components/camel-jms/src/main/java/org/apache/camel/util/IntrospectionSupport.java
b/camel-util/src/main/java/org/apache/camel/util/IntrospectionSupport.java
similarity index 68%
rename from
components/camel-jms/src/main/java/org/apache/camel/util/IntrospectionSupport.java
rename to
camel-util/src/main/java/org/apache/camel/util/IntrospectionSupport.java
index b44fee6..47da9fa 100644
---
a/components/camel-jms/src/main/java/org/apache/camel/util/IntrospectionSupport.java
+++ b/camel-util/src/main/java/org/apache/camel/util/IntrospectionSupport.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.util;
+import java.lang.reflect.Method;
import java.util.Map;
/**
@@ -26,7 +27,17 @@ public final class IntrospectionSupport {
private IntrospectionSupport() {
}
+ /**
+ * @deprecated use {@link
org.apache.camel.support.IntrospectionSupport#extractProperties} instead
+ */
+ @Deprecated
public static Map<String, Object> extractProperties(Map<String, Object>
properties, String optionPrefix) {
- return
org.apache.camel.support.IntrospectionSupport.extractProperties(properties,
optionPrefix);
+ try {
+ Class<?> clazz =
Class.forName("org.apache.camel.support.IntrospectionSupport");
+ Method method = clazz.getMethod("extractProperties", Map.class,
String.class);
+ return (Map) method.invoke(properties, optionPrefix);
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
}
}
diff --git a/camel-util/src/main/java/org/apache/camel/util/ObjectHelper.java
b/camel-util/src/main/java/org/apache/camel/util/ObjectHelper.java
index 68f0c0a..0427fc7 100644
--- a/camel-util/src/main/java/org/apache/camel/util/ObjectHelper.java
+++ b/camel-util/src/main/java/org/apache/camel/util/ObjectHelper.java
@@ -1134,4 +1134,32 @@ public final class ObjectHelper {
&& (FLOAT_NAN.equals(value) || DOUBLE_NAN.equals(value));
}
+ /**
+ * Wraps the caused exception in a {@link RuntimeException} if its not
+ * already such an exception.
+ *
+ * @param e the caused exception
+ * @return the wrapper exception
+ * @deprecated Use {@link
org.apache.camel.CamelRuntimeException#wrapRuntimeCamelException} instead
+ */
+ @Deprecated
+ public static RuntimeException wrapRuntimeCamelException(Throwable e) {
+ try {
+ Class<? extends RuntimeException> clazz = (Class)
Class.forName("org.apache.camel.RuntimeException");
+ if (clazz.isInstance(e)) {
+ // don't double wrap
+ return clazz.cast(e);
+ } else {
+ return clazz.getConstructor(Throwable.class).newInstance(e);
+ }
+ } catch (Throwable t) {
+ // ignore
+ }
+ if (e instanceof RuntimeException) {
+ // don't double wrap
+ return (RuntimeException) e;
+ } else {
+ return new RuntimeException(e);
+ }
+ }
}