Hi!

First of all, thank you for your great work in xml-security

I wrote a simple Java Applet to sign XML documents in the client
machine.  It run flawlessly as a standalone Java Application, but in a
restricted Java Applet container (browser) I got a
ClassNotFoundException for
org.apache.xml.security.transforms.implementations.TransformBase64Decode
when calling the Init.init() method.   For some reason that I don't
understand, the classLoader returned in Transform.register(..) can't see
that class, even considering that it is in the same .jar file of the
caller (Transform).

After trying to understand the issue without no sucess, I finally gave
up and added a fallback code to handle this case when the classloader
can't see the Transform implementation.  

Patch attached.

-- 
Franco Catrin L.  TUXPAN Software S.A.
http://www.tuxpan.com/fcatrin
Index: src/org/apache/xml/security/transforms/Transform.java
===================================================================
--- src/org/apache/xml/security/transforms/Transform.java	(revisión: 706374)
+++ src/org/apache/xml/security/transforms/Transform.java	(copia de trabajo)
@@ -240,13 +240,30 @@
             });
 
         try {
-	    transformClassHash.put
+			transformClassHash.put
                 (algorithmURI, Class.forName(implementingClass, true, cl));
-	} catch (ClassNotFoundException e) {
+			return;
+		} catch (ClassNotFoundException e) {
+            
+        }
+		cl = (ClassLoader) AccessController.doPrivileged(
+            new PrivilegedAction() {
+                public Object run() {
+                    return Transform.class.getClassLoader();
+                }
+            });
+
+        try {
+			transformClassHash.put
+                (algorithmURI, Class.forName(implementingClass, true, cl));
+			return;
+		} catch (ClassNotFoundException e) {
             throw new RuntimeException(e);
         }
     }
 
+
+
     /**
      * Returns the URI representation of Transformation algorithm
      *

Reply via email to