You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/04/13 11:31:50 UTC
svn commit: r1467580 - in /camel/branches/camel-2.10.x: ./
camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
Author: davsclaus
Date: Sat Apr 13 09:31:49 2013
New Revision: 1467580
URL: http://svn.apache.org/r1467580
Log:
CAMEL-6260: Setting options on endpoint now set accessible with reflection to allow setting on package visibile classes. Thanks to Jury Matveentsev for the patch.
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1467578
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?rev=1467580&r1=1467579&r2=1467580&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java Sat Apr 13 09:31:49 2013
@@ -179,13 +179,17 @@ public final class IntrospectionSupport
try {
// must be properties which have setters
if (isGetter(method) && hasSetter(target, method)) {
+ // we may want to set options on classes that has package view visibility, so override the accessible
+ method.setAccessible(true);
Object value = method.invoke(target);
String name = getGetterShorthandName(method);
properties.put(optionPrefix + name, value);
rc = true;
}
} catch (Exception e) {
- // ignore
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Error invoking getter method " + method + ". This exception is ignored.", e);
+ }
}
}
@@ -376,6 +380,8 @@ public final class IntrospectionSupport
try {
// If the type is null or it matches the needed type, just use the value directly
if (value == null || parameterType.isAssignableFrom(ref.getClass())) {
+ // we may want to set options on classes that has package view visibility, so override the accessible
+ setter.setAccessible(true);
setter.invoke(target, ref);
if (LOG.isDebugEnabled()) {
LOG.debug("Configured property: {} on bean: {} with value: {}", new Object[]{name, target, ref});
@@ -384,6 +390,8 @@ public final class IntrospectionSupport
} else {
// We need to convert it
Object convertedValue = convert(typeConverter, parameterType, ref);
+ // we may want to set options on classes that has package view visibility, so override the accessible
+ setter.setAccessible(true);
setter.invoke(target, convertedValue);
if (LOG.isDebugEnabled()) {
LOG.debug("Configured property: {} on bean: {} with value: {}", new Object[]{name, target, ref});
@@ -402,6 +410,8 @@ public final class IntrospectionSupport
}
}
// ignore exceptions as there could be another setter method where we could type convert successfully
+ } catch (SecurityException e) {
+ typeConversionFailed = e;
} catch (NoTypeConversionAvailableException e) {
typeConversionFailed = e;
} catch (IllegalArgumentException e) {