You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2017/12/19 16:56:01 UTC

[sling-org-apache-sling-commons-classloader] branch master updated: SLING-7319: Bootdelegate sun.reflect. and jdk.internal.reflect. to prevent NCDF on reflection when not bootdelegated by the framework.

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

pauls pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-classloader.git


The following commit(s) were added to refs/heads/master by this push:
     new 5a8e153  SLING-7319: Bootdelegate sun.reflect. and jdk.internal.reflect. to prevent NCDF on reflection when not bootdelegated by the framework.
5a8e153 is described below

commit 5a8e15390770a158ed310a600b965233af80b85f
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Tue Dec 19 17:55:47 2017 +0100

    SLING-7319: Bootdelegate sun.reflect. and jdk.internal.reflect. to prevent NCDF on reflection when not bootdelegated by the framework.
---
 .../apache/sling/commons/classloader/impl/ClassLoaderFacade.java | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/main/java/org/apache/sling/commons/classloader/impl/ClassLoaderFacade.java b/src/main/java/org/apache/sling/commons/classloader/impl/ClassLoaderFacade.java
index f60a34b..c43b53f 100644
--- a/src/main/java/org/apache/sling/commons/classloader/impl/ClassLoaderFacade.java
+++ b/src/main/java/org/apache/sling/commons/classloader/impl/ClassLoaderFacade.java
@@ -146,6 +146,15 @@ public class ClassLoaderFacade extends ClassLoader implements DynamicClassLoader
                 }
             }
         }
+        if (name.startsWith("sun.reflect.") || name.startsWith("jdk.internal.reflect.")) {
+            try {
+                return ClassLoader.getSystemClassLoader().loadClass(name);
+            } catch (ClassNotFoundException cnfe) {
+                // we just ignore this and throw our own exception
+            } catch (Throwable t) {
+                logger.error("Exception while trying to load class " + name + " from class loader " + ClassLoader.getSystemClassLoader(), t);
+            }
+        }
         throw new ClassNotFoundException(name);
     }
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].