You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2012/05/08 11:19:56 UTC

svn commit: r1335388 - in /santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security: c14n/implementations/Canonicalizer11.java c14n/implementations/CanonicalizerBase.java utils/JavaUtils.java utils/XalanXPathAPI.java

Author: coheigea
Date: Tue May  8 09:19:56 2012
New Revision: 1335388

URL: http://svn.apache.org/viewvc?rev=1335388&view=rev
Log:
More minor cleanup work

Modified:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer11.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerBase.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/JavaUtils.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XalanXPathAPI.java

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer11.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer11.java?rev=1335388&r1=1335387&r2=1335388&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer11.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer11.java Tue May  8 09:19:56 2012
@@ -466,9 +466,8 @@ public abstract class Canonicalizer11 ex
         String rauthority = r.getAuthority();
         String rpath = r.getPath();
         String rquery = r.getQuery();
-        String rfragment = null;
 
-        String tscheme, tauthority, tpath, tquery, tfragment;
+        String tscheme, tauthority, tpath, tquery;
         if (rscheme != null && rscheme.equals(bscheme)) {
             rscheme = null;
         }
@@ -512,8 +511,7 @@ public abstract class Canonicalizer11 ex
             }
             tscheme = bscheme;
         }
-        tfragment = rfragment;
-        return new URI(tscheme, tauthority, tpath, tquery, tfragment).toString();
+        return new URI(tscheme, tauthority, tpath, tquery, null).toString();
     }
 
     private static String removeDotSegments(String path) {

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerBase.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerBase.java?rev=1335388&r1=1335387&r2=1335388&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerBase.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerBase.java Tue May  8 09:19:56 2012
@@ -624,14 +624,10 @@ public abstract class CanonicalizerBase 
         }
         //Obtain all the parents of the element
         List<Element> parents = new ArrayList<Element>(10);
-        Element parent = (Element) n1;
-        while (parent != null) {
-            parents.add(parent);
-            Node n = parent.getParentNode();
-            if (n == null || Node.ELEMENT_NODE != n.getNodeType()) {
-                break;
-            }
-            parent = (Element)n;
+        Node parent = n1;
+        while (parent != null && Node.ELEMENT_NODE == parent.getNodeType()) {
+            parents.add((Element)parent);
+            parent = parent.getParentNode();
         }
         //Visit them in reverse order.
         ListIterator<Element> it = parents.listIterator(parents.size());

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/JavaUtils.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/JavaUtils.java?rev=1335388&r1=1335387&r2=1335388&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/JavaUtils.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/JavaUtils.java Tue May  8 09:19:56 2012
@@ -67,12 +67,12 @@ public class JavaUtils {
 
             refBytes = baos.toByteArray();
         } finally {
-            if (fisRef != null) {
-                fisRef.close();
-            }
             if (baos != null) {
                 baos.close();
             }
+            if (fisRef != null) {
+                fisRef.close();
+            }
         }
 
         return refBytes;

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XalanXPathAPI.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XalanXPathAPI.java?rev=1335388&r1=1335387&r2=1335388&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XalanXPathAPI.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XalanXPathAPI.java Tue May  8 09:19:56 2012
@@ -150,9 +150,9 @@ public class XalanXPathAPI implements XP
         try {
             Constructor<?> constructor = XPath.class.getConstructor(classes);
             xpath = (XPath) constructor.newInstance(objects);
-        } catch (Throwable t) {
+        } catch (Exception ex) {
             if (log.isDebugEnabled()) {
-                log.debug(t);
+                log.debug(ex);
             }
         }
         if (xpath == null) {
@@ -173,23 +173,23 @@ public class XalanXPathAPI implements XP
             Class<?>[] args = {String.class, Expression.class};
             Method installFunction = FunctionTable.class.getMethod("installFunction", args);
             if ((installFunction.getModifiers() & Modifier.STATIC) != 0) {
-                Object []params = {"here", new FuncHere()};
+                Object[] params = {"here", new FuncHere()};
                 installFunction.invoke(null, params);
                 installed = true;
             }
-        } catch (Throwable t) {
-            log.debug("Error installing function using the static installFunction method", t);
+        } catch (Exception ex) {
+            log.debug("Error installing function using the static installFunction method", ex);
         }
         if (!installed) {
             try {
                 funcTable = new FunctionTable();
                 Class<?>[] args = {String.class, Class.class};
                 Method installFunction = FunctionTable.class.getMethod("installFunction", args);
-                Object []params = {"here", FuncHere.class};
+                Object[] params = {"here", FuncHere.class};
                 installFunction.invoke(funcTable, params);
                 installed = true;
-            } catch (Throwable t) {
-                log.debug("Error installing function using the static installFunction method", t);
+            } catch (Exception ex) {
+                log.debug("Error installing function using the static installFunction method", ex);
             }
         }
         if (log.isDebugEnabled()) {