am 29febc56: Merge change 2454 into donut

Merge commit '29febc56fd523a7b1684ab04f75d6d213a282f11'

* commit '29febc56fd523a7b1684ab04f75d6d213a282f11':
  Reactivating tests disabled because of ClassLoader loop
diff --git a/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassLoaderTest.java b/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassLoaderTest.java
index c9fba59..9b5b17e 100644
--- a/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassLoaderTest.java
+++ b/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassLoaderTest.java
@@ -600,7 +600,6 @@
         method = "getSystemClassLoader",
         args = {}
     )
-    @BrokenTest("Infinite loop in classloader. Actually a known failure.")
     public void test_getSystemClassLoader() {
         // Test for method java.lang.ClassLoader
         // java.lang.ClassLoader.getSystemClassLoader()
diff --git a/libcore/security/src/test/java/tests/security/permissions/JavaLangClassLoaderTest.java b/libcore/security/src/test/java/tests/security/permissions/JavaLangClassLoaderTest.java
index 66302ed..c33bb1b 100644
--- a/libcore/security/src/test/java/tests/security/permissions/JavaLangClassLoaderTest.java
+++ b/libcore/security/src/test/java/tests/security/permissions/JavaLangClassLoaderTest.java
@@ -17,7 +17,6 @@
 package tests.security.permissions;
 
 import dalvik.annotation.AndroidOnly;
-import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestTargets;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
@@ -120,7 +119,6 @@
         )
     })
     @AndroidOnly("uses DexFile")
-    @BrokenTest("Endless loop in ClassLoader. Actually a known failure.")
     public void test_getSystemClassLoader () throws IOException,
             IllegalAccessException, InstantiationException {
         class TestSecurityManager extends SecurityManager {
@@ -142,6 +140,10 @@
         
         File tempFile = Support_Resources.createTempFile(".jar");
         tempFile.delete();
+        tempFile.deleteOnExit();
+        File tempCache = Support_Resources.createTempFile(".dex");
+        tempCache.delete();
+        tempCache.deleteOnExit();
         
         /*
          * The testdex.jar contains the following two classes:
@@ -167,8 +169,10 @@
         
         InputStream is = Support_Resources.getResourceStream("testdex.jar");
         Support_Resources.copyLocalFileto(tempFile, is);
-        DexFile dexfile = new DexFile(tempFile);
-        ClassLoader pcl = Support_ClassLoader.getInstance(new URL(""),
+        DexFile dexfile = DexFile.loadDex(tempFile.getAbsolutePath(),
+                tempCache.getAbsolutePath(), 0);
+        ClassLoader pcl = Support_ClassLoader.getInstance(
+                new URL(Support_Resources.getResourceURL("testdex.jar")),
                 ClassLoader.getSystemClassLoader());
         
         Class<?> testClass = dexfile.loadClass(
diff --git a/libcore/security/src/test/java/tests/security/permissions/JavaLangThreadTest.java b/libcore/security/src/test/java/tests/security/permissions/JavaLangThreadTest.java
index 0e5b43c..e71cec0 100644
--- a/libcore/security/src/test/java/tests/security/permissions/JavaLangThreadTest.java
+++ b/libcore/security/src/test/java/tests/security/permissions/JavaLangThreadTest.java
@@ -143,8 +143,6 @@
         args = {}
     )
     @AndroidOnly("RI impl differs from RI spec, Android impl does not.")
-    @BrokenTest("Suffers from endless loop in getClassLoader(), actually a"
-            + "@KnownFailure, but we don't want to hang the test harness")
     public void test_getContextClassLoader() {
         class TestSecurityManager extends SecurityManager {
             boolean called;
diff --git a/libcore/support/src/test/java/tests/support/resource/Support_Resources.java b/libcore/support/src/test/java/tests/support/resource/Support_Resources.java
index f15f618..53a8925 100644
--- a/libcore/support/src/test/java/tests/support/resource/Support_Resources.java
+++ b/libcore/support/src/test/java/tests/support/resource/Support_Resources.java
@@ -147,17 +147,11 @@
      * @return - resource input stream
      */
     public static InputStream getResourceStream(String name) {
-//ATTENTION:
-//    Against class.getResourceStream(name) the name can start with a "/".
-//    Against classLoader.getResourceStream NOT!
         
-        InputStream is;
-//        is = Support_Resources.class.getClassLoader().getResourceAsStream(name); This would work without leading "/"
-        is = Support_Resources.class.getResourceAsStream(name);
-//        is = ClassLoader.getSystemClassLoader().getResourceAsStream(name); This would work without leading "/"
+        InputStream is = Support_Resources.class.getResourceAsStream(name);
 
         if (is == null) {
-            name = "/tests/resources/" + name;
+            name = RESOURCE_PACKAGE + name;
             is = Support_Resources.class.getResourceAsStream(name);
             if (is == null) {
                 throw new RuntimeException("Failed to load resource: " + name);