chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1625486 - /chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/JreWssMUTube.java
Date Wed, 17 Sep 2014 08:28:04 GMT
Author: fmui
Date: Wed Sep 17 08:28:04 2014
New Revision: 1625486

URL: http://svn.apache.org/r1625486
Log:
CMIS-841: Web Services client: fixed Java 8 issue

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/JreWssMUTube.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/JreWssMUTube.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/JreWssMUTube.java?rev=1625486&r1=1625485&r2=1625486&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/JreWssMUTube.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/JreWssMUTube.java
Wed Sep 17 08:28:04 2014
@@ -18,9 +18,12 @@
  */
 package org.apache.chemistry.opencmis.commons.impl.tube.client;
 
+import java.lang.reflect.Method;
+
 import javax.xml.namespace.QName;
 
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.tube.AbstractJreWssTube;
 
 import com.sun.xml.internal.ws.api.SOAPVersion;
@@ -56,20 +59,31 @@ public class JreWssMUTube extends Abstra
             return super.processResponse(response);
         }
 
-        HeaderList headers = (HeaderList) response.getMessage().getHeaders();
+        Object headersObject = response.getMessage().getHeaders();
+
+        if (headersObject instanceof HeaderList) {
+            HeaderList headers = (HeaderList) headersObject;
 
-        for (int i = 0; i < headers.size(); i++) {
-            if (!headers.isUnderstood(i)) {
-                Header header = headers.get(i);
-                if (!header.isIgnorable(soapVersion, soapVersion.implicitRoleSet)) {
-                    QName qName = new QName(header.getNamespaceURI(), header.getLocalPart());
-                    if (WSSE.equals(qName)) {
-                        checkSecurityHeader(header);
-                    } else {
-                        throw new CmisConnectionException("MustUnderstand header is not understood:
" + qName);
+            for (int i = 0; i < headers.size(); i++) {
+                if (!headers.isUnderstood(i)) {
+                    Header header = headers.get(i);
+                    if (!header.isIgnorable(soapVersion, soapVersion.implicitRoleSet)) {
+                        QName qName = new QName(header.getNamespaceURI(), header.getLocalPart());
+                        if (WSSE.equals(qName)) {
+                            checkSecurityHeader(header);
+                        } else {
+                            throw new CmisConnectionException("MustUnderstand header is not
understood: " + qName);
+                        }
                     }
                 }
             }
+        } else {
+            try {
+                Method m = headersObject.getClass().getMethod("understood", QName.class);
+                m.invoke(headersObject, WSSE);
+            } catch (Exception e) {
+                throw new CmisRuntimeException("Could not mark WSSE header as understood.",
e);
+            }
         }
 
         return super.processResponse(response);



Mime
View raw message