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 2023/07/13 12:59:48 UTC
[camel] branch main updated: [CAMEL-19563] Refactor raw generic type usage: Fix ReflectionHelper
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 9e5faf7986b [CAMEL-19563] Refactor raw generic type usage: Fix ReflectionHelper
9e5faf7986b is described below
commit 9e5faf7986b3a5be71e4ee7285d74304d3280712
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Jul 13 14:59:28 2023 +0200
[CAMEL-19563] Refactor raw generic type usage: Fix ReflectionHelper
---
.../main/java/org/apache/camel/util/ReflectionHelper.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/core/camel-util/src/main/java/org/apache/camel/util/ReflectionHelper.java b/core/camel-util/src/main/java/org/apache/camel/util/ReflectionHelper.java
index c8918dbc1a1..82a965e78e3 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/ReflectionHelper.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/ReflectionHelper.java
@@ -179,7 +179,12 @@ public final class ReflectionHelper {
public static void setField(Field f, Object instance, Object value) {
try {
- boolean oldAccessible = f.canAccess(instance);
+ boolean oldAccessible = false;
+ try {
+ oldAccessible = f.canAccess(instance);
+ } catch (Exception e) {
+ // ignore
+ }
boolean shouldSetAccessible = !Modifier.isPublic(f.getModifiers()) && !oldAccessible;
if (shouldSetAccessible) {
f.setAccessible(true);
@@ -195,7 +200,12 @@ public final class ReflectionHelper {
public static Object getField(Field f, Object instance) {
try {
- boolean oldAccessible = f.canAccess(instance);
+ boolean oldAccessible = false;
+ try {
+ oldAccessible = f.canAccess(instance);
+ } catch (Exception e) {
+ // ignore
+ }
boolean shouldSetAccessible = !Modifier.isPublic(f.getModifiers()) && !oldAccessible;
if (shouldSetAccessible) {
f.setAccessible(true);