Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.osgi.tests/bundles_src')
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/classloader.hooks.a/org/eclipse/osgi/tests/classloader/hooks/a/TestHookConfigurator.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/classloader.hooks.a/org/eclipse/osgi/tests/classloader/hooks/a/TestHookConfigurator.java b/bundles/org.eclipse.osgi.tests/bundles_src/classloader.hooks.a/org/eclipse/osgi/tests/classloader/hooks/a/TestHookConfigurator.java
index 61e86e9a0..0daec7d29 100644
--- a/bundles/org.eclipse.osgi.tests/bundles_src/classloader.hooks.a/org/eclipse/osgi/tests/classloader/hooks/a/TestHookConfigurator.java
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/classloader.hooks.a/org/eclipse/osgi/tests/classloader/hooks/a/TestHookConfigurator.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.osgi.tests.classloader.hooks.a;
+import java.net.URL;
+import java.util.NoSuchElementException;
import org.eclipse.osgi.container.Module;
import org.eclipse.osgi.internal.hookregistry.ClassLoaderHook;
import org.eclipse.osgi.internal.hookregistry.HookConfigurator;
@@ -27,6 +29,8 @@ public class TestHookConfigurator implements HookConfigurator {
private static final String RECURSION_LOAD = "classloader.hooks.a.recursion.load";
private static final String RECURSION_LOAD_SUPPORTED = "classloader.hooks.a.recursion.load.supported";
private static final String FILTER_CLASS_PATHS = "classloader.hooks.a.filter.class.paths";
+ private static final String PREVENT_RESOURCE_LOAD_PRE = "classloader.hooks.a.fail.resource.load.pre";
+ private static final String PREVENT_RESOURCE_LOAD_POST = "classloader.hooks.a.fail.resource.load.post";
final ThreadLocal<Boolean> doingRecursionLoad = new ThreadLocal<Boolean>() {
protected Boolean initialValue() {
return false;
@@ -81,6 +85,20 @@ public class TestHookConfigurator implements HookConfigurator {
}
return super.getClassPathEntries(name, manager);
}
+
+ @Override
+ public void preFindLocalResource(String name, ClasspathManager manager) {
+ if (Boolean.getBoolean(PREVENT_RESOURCE_LOAD_PRE)) {
+ throw new NoSuchElementException();
+ }
+ }
+
+ @Override
+ public void postFindLocalResource(String name, URL resource, ClasspathManager manager) {
+ if (Boolean.getBoolean(PREVENT_RESOURCE_LOAD_POST)) {
+ throw new NoSuchElementException();
+ }
+ }
});
}
}

Back to the top