You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/04/19 13:38:39 UTC

[cxf] 08/09: Porting SAAJ 1.4 changes from WSS4J

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit ae0e2ba3df88cc33c9d5ba0b212a230491c56b1a
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Thu Apr 19 12:39:04 2018 +0100

    Porting SAAJ 1.4 changes from WSS4J
---
 .../main/java/org/apache/cxf/helpers/DOMUtils.java | 31 +++++++++++++++-------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/helpers/DOMUtils.java b/core/src/main/java/org/apache/cxf/helpers/DOMUtils.java
index 908cb2c..56ecae9 100644
--- a/core/src/main/java/org/apache/cxf/helpers/DOMUtils.java
+++ b/core/src/main/java/org/apache/cxf/helpers/DOMUtils.java
@@ -67,7 +67,19 @@ public final class DOMUtils {
 
 
     static {
-        if (JavaUtils.isJava9Compatible()) {
+        try {
+            Method[] methods = DOMUtils.class.getClassLoader().
+                loadClass("com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl").getMethods();
+            for (Method method : methods) {
+                if (method.getName().equals("register")) {
+                    //this is the 1.4+ SAAJ impl
+                    setJava9SAAJ(true);
+                    break;
+                }
+            }
+        } catch (ClassNotFoundException cnfe) {
+            LogUtils.getL7dLogger(DOMUtils.class).finest(
+                "can't load class com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl");
 
             try {
                 Method[] methods = DOMUtils.class.getClassLoader().
@@ -79,11 +91,10 @@ public final class DOMUtils {
                         break;
                     }
                 }
-            } catch (ClassNotFoundException cnfe) {
+            } catch (ClassNotFoundException cnfe1) {
                 LogUtils.getL7dLogger(DOMUtils.class).finest(
                     "can't load class com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl");
             }
-
         }
     }
 
@@ -152,17 +163,17 @@ public final class DOMUtils {
             throw new RuntimeException(e);
         }
     }
-    
+
     private static synchronized Document createEmptyDocument() {
         if (emptyDocument == null) {
             emptyDocument = createDocument();
-            
+
             // uncomment this to see if anything is actually setting anything into the empty doc
             /*
             final Document doc  = createDocument();
             emptyDocument = (Document)org.apache.cxf.common.util.ProxyHelper.getProxy(
-                DOMUtils.class.getClassLoader(), 
-                new Class<?>[] {Document.class}, 
+                DOMUtils.class.getClassLoader(),
+                new Class<?>[] {Document.class},
                 new java.lang.reflect.InvocationHandler() {
                     @Override
                     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
@@ -177,9 +188,9 @@ public final class DOMUtils {
         return emptyDocument;
     }
     /**
-     * Returns a static Document that should always be "empty".  It's useful as a factory for 
-     * for creating Elements and other nodes that will be traversed later and don't need to 
-     * be attached into a document 
+     * Returns a static Document that should always be "empty".  It's useful as a factory for
+     * for creating Elements and other nodes that will be traversed later and don't need to
+     * be attached into a document
      * @return
      */
     public static Document getEmptyDocument() {

-- 
To stop receiving notification emails like this one, please contact
coheigea@apache.org.