geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject [50/50] [abbrv] incubator-geode git commit: GEODE-14: Fixed missing ChildFirstURLClassLoader
Date Mon, 21 Dec 2015 18:05:18 GMT
GEODE-14: Fixed missing ChildFirstURLClassLoader


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/71e1b1ff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/71e1b1ff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/71e1b1ff

Branch: refs/heads/feature/GEODE-14
Commit: 71e1b1fff5a5ed196315919c6a64262652b96fab
Parents: cf95428
Author: Jens Deppe <jdeppe@pivotal.io>
Authored: Mon Dec 21 10:03:28 2015 -0800
Committer: Jens Deppe <jdeppe@pivotal.io>
Committed: Mon Dec 21 10:03:28 2015 -0800

----------------------------------------------------------------------
 .../session/filter/ChildFirstClassLoader.java   | 77 --------------------
 .../modules/junit/ChildFirstClassLoader.java    | 76 +++++++++++++++++++
 .../modules/junit/PerTestClassLoaderRunner.java |  2 +-
 3 files changed, 77 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/71e1b1ff/modules/gemfire-modules-session-external/src/test/java/com/gemstone/gemfire/modules/session/filter/ChildFirstClassLoader.java
----------------------------------------------------------------------
diff --git a/modules/gemfire-modules-session-external/src/test/java/com/gemstone/gemfire/modules/session/filter/ChildFirstClassLoader.java
b/modules/gemfire-modules-session-external/src/test/java/com/gemstone/gemfire/modules/session/filter/ChildFirstClassLoader.java
deleted file mode 100644
index a8d9a7d..0000000
--- a/modules/gemfire-modules-session-external/src/test/java/com/gemstone/gemfire/modules/session/filter/ChildFirstClassLoader.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-package com.gemstone.gemfire.modules.session.filter;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-public class ChildFirstClassLoader extends URLClassLoader {
-
-  public ChildFirstClassLoader() {
-    super(new URL[]{});
-  }
-
-  public ChildFirstClassLoader(URL[] urls) {
-    super(urls);
-  }
-
-  public ChildFirstClassLoader(URL[] urls, ClassLoader parent) {
-    super(urls, parent);
-  }
-
-  @Override
-  public void addURL(URL url) {
-    super.addURL(url);
-  }
-
-  @Override
-  public Class loadClass(String name) throws ClassNotFoundException {
-    return loadClass(name, false);
-  }
-
-  /**
-   * We override the parent-first behavior established by
-   * java.lang.Classloader.
-   */
-  @Override
-  protected Class loadClass(String name, boolean resolve)
-      throws ClassNotFoundException {
-    Class c = null;
-
-    if (name.startsWith("com.gemstone")) {
-      // First, check if the class has already been loaded
-      c = findLoadedClass(name);
-
-      // if not loaded, search the local (child) resources
-      if (c == null) {
-        try {
-          c = findClass(name);
-        } catch (ClassNotFoundException cnfe) {
-          // ignore
-        }
-      }
-    }
-
-    // if we could not find it, delegate to parent
-    // Note that we don't attempt to catch any ClassNotFoundException
-    if (c == null) {
-      if (getParent() != null) {
-        c = getParent().loadClass(name);
-      } else {
-        c = getSystemClassLoader().loadClass(name);
-      }
-    }
-
-    if (resolve) {
-      resolveClass(c);
-    }
-
-    return c;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/71e1b1ff/modules/gemfire-modules-session-integration-test/src/test/java/com/gemstone/gemfire/modules/junit/ChildFirstClassLoader.java
----------------------------------------------------------------------
diff --git a/modules/gemfire-modules-session-integration-test/src/test/java/com/gemstone/gemfire/modules/junit/ChildFirstClassLoader.java
b/modules/gemfire-modules-session-integration-test/src/test/java/com/gemstone/gemfire/modules/junit/ChildFirstClassLoader.java
new file mode 100644
index 0000000..b566d05
--- /dev/null
+++ b/modules/gemfire-modules-session-integration-test/src/test/java/com/gemstone/gemfire/modules/junit/ChildFirstClassLoader.java
@@ -0,0 +1,76 @@
+/*=========================================================================
+ * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.gemstone.gemfire.modules.junit;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class ChildFirstClassLoader extends URLClassLoader {
+
+  public ChildFirstClassLoader() {
+    super(new URL[]{});
+  }
+
+  public ChildFirstClassLoader(URL[] urls) {
+    super(urls);
+  }
+
+  public ChildFirstClassLoader(URL[] urls, ClassLoader parent) {
+    super(urls, parent);
+  }
+
+  @Override
+  public void addURL(URL url) {
+    super.addURL(url);
+  }
+
+  @Override
+  public Class loadClass(String name) throws ClassNotFoundException {
+    return loadClass(name, false);
+  }
+
+  /**
+   * We override the parent-first behavior established by
+   * java.lang.Classloader.
+   */
+  @Override
+  protected Class loadClass(String name, boolean resolve)
+      throws ClassNotFoundException {
+    Class c = null;
+
+    if (name.startsWith("com.gemstone")) {
+      // First, check if the class has already been loaded
+      c = findLoadedClass(name);
+
+      // if not loaded, search the local (child) resources
+      if (c == null) {
+        try {
+          c = findClass(name);
+        } catch (ClassNotFoundException cnfe) {
+          // ignore
+        }
+      }
+    }
+
+    // if we could not find it, delegate to parent
+    // Note that we don't attempt to catch any ClassNotFoundException
+    if (c == null) {
+      if (getParent() != null) {
+        c = getParent().loadClass(name);
+      } else {
+        c = getSystemClassLoader().loadClass(name);
+      }
+    }
+
+    if (resolve) {
+      resolveClass(c);
+    }
+
+    return c;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/71e1b1ff/modules/gemfire-modules-session-integration-test/src/test/java/com/gemstone/gemfire/modules/junit/PerTestClassLoaderRunner.java
----------------------------------------------------------------------
diff --git a/modules/gemfire-modules-session-integration-test/src/test/java/com/gemstone/gemfire/modules/junit/PerTestClassLoaderRunner.java
b/modules/gemfire-modules-session-integration-test/src/test/java/com/gemstone/gemfire/modules/junit/PerTestClassLoaderRunner.java
index 254ff3d..fce6471 100644
--- a/modules/gemfire-modules-session-integration-test/src/test/java/com/gemstone/gemfire/modules/junit/PerTestClassLoaderRunner.java
+++ b/modules/gemfire-modules-session-integration-test/src/test/java/com/gemstone/gemfire/modules/junit/PerTestClassLoaderRunner.java
@@ -95,7 +95,7 @@ public class PerTestClassLoaderRunner extends NamedRunner {
       }
     }
 
-    ClassLoader classLoader = new ChildFirstURLClassLoader(
+    ClassLoader classLoader = new ChildFirstClassLoader(
         urls.toArray(new URL[]{}),
         Thread.currentThread().getContextClassLoader()
     );


Mime
View raw message