Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37898817
en ru br
ALT Linux repos
5.0: 1.3.0-alt1_2jpp5
4.1: 1.3.0-alt1_1jpp1.7
4.0: 1.3.0-alt1_1jpp1.7

Group :: Development/Java
RPM: xml-security

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: xml-security-1.3-nosun.patch
Download


--- ./src/org/apache/xml/security/utils/XMLUtils.java.sav	2006-01-17 21:28:09.000000000 -0500
+++ ./src/org/apache/xml/security/utils/XMLUtils.java	2006-01-17 21:30:02.000000000 -0500
@@ -21,6 +21,7 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.lang.reflect.Method;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -690,4 +691,49 @@
          }
       }
    }
+
+   /**
+    * Worker method to load a class.
+    * Factor out loading classes for future use and JDK differences.
+    * Copied from javax.xml.*.FactoryFinder
+    * @param className name of class to load from
+    * an appropriate classLoader
+    * @return the class asked for
+    * @throws ClassNotFoundException
+    */
+   public static Class classForName(String className)
+           throws ClassNotFoundException {
+
+      ClassLoader classLoader = findClassLoader();
+
+      if (classLoader == null) {
+         return Class.forName(className);
+      }
+       return classLoader.loadClass(className);
+   }
+
+   /**
+    * Worker method to figure out which ClassLoader to use.
+    * For JDK 1.2 and later use the context ClassLoader.
+    * Copied from javax.xml.*.FactoryFinder
+    * @return the appropriate ClassLoader
+    */
+   protected static ClassLoader findClassLoader() {
+
+      Method m = null;
+
+      try {
+         m = Thread.class.getMethod("getContextClassLoader", new Class[]{});
+      } catch (NoSuchMethodException e) {
+
+         // Assume that we are running JDK 1.1, use the current ClassLoader
+         return XMLUtils.class.getClassLoader();
+      }
+
+      try {
+         return (ClassLoader) m.invoke(Thread.currentThread(), new Object[]{});
+      } catch (Exception e) {
+         throw new RuntimeException(e.toString());
+      }
+   }
 }
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin