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

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/johnzon.git


The following commit(s) were added to refs/heads/master by this push:
     new a82526c  JOHNZON-315 skip Package.getPackage if it does not work
a82526c is described below

commit a82526cdc659a0ae14eb2803529d723e1636b96f
Author: Romain Manni-Bucau <[email protected]>
AuthorDate: Thu Jun 4 07:22:13 2020 +0200

    JOHNZON-315 skip Package.getPackage if it does not work
---
 .../apache/johnzon/jsonb/DefaultPropertyVisibilityStrategy.java  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/DefaultPropertyVisibilityStrategy.java
 
b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/DefaultPropertyVisibilityStrategy.java
index e5a5b86..467b563 100644
--- 
a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/DefaultPropertyVisibilityStrategy.java
+++ 
b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/DefaultPropertyVisibilityStrategy.java
@@ -32,6 +32,7 @@ import javax.json.bind.config.PropertyVisibilityStrategy;
 
 class DefaultPropertyVisibilityStrategy implements 
javax.json.bind.config.PropertyVisibilityStrategy {
     private final ConcurrentMap<Class<?>, PropertyVisibilityStrategy> 
strategies = new ConcurrentHashMap<>();
+    private volatile boolean skipGetpackage;
 
     @Override
     public boolean isVisible(final Field field) {
@@ -75,7 +76,13 @@ class DefaultPropertyVisibilityStrategy implements 
javax.json.bind.config.Proper
                 break;
             }
             final String parentPack = name.substring(0, end);
-            p = Package.getPackage(parentPack);
+            if (!skipGetpackage) {
+                try {
+                    p = Package.getPackage(parentPack);
+                } catch (final Error unsupported) {
+                    skipGetpackage = true; // graalvm likely
+                }
+            }
             if (p == null) {
                 try {
                     p = 
ofNullable(type.getClassLoader()).orElseGet(ClassLoader::getSystemClassLoader)

Reply via email to