You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2013/05/25 22:55:22 UTC

svn commit: r1486363 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ chemistry-opencmis-workbench/chemistry-opencmis-workbench/src...

Author: fmui
Date: Sat May 25 20:55:21 2013
New Revision: 1486363

URL: http://svn.apache.org/r1486363
Log:
attempt to identify the WSDL parsing issues

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java?rev=1486363&r1=1486362&r2=1486363&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java Sat May 25 20:55:21 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
 
+import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.ref.SoftReference;
@@ -77,7 +78,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -124,13 +124,13 @@ public abstract class AbstractPortProvid
         ACL_SERVICE("ACLService", false, ACLService.class, ACLServicePort.class,
                 SessionParameter.WEBSERVICES_ACL_SERVICE, SessionParameter.WEBSERVICES_ACL_SERVICE_ENDPOINT);
 
-        private String name;
-        private QName qname;
-        private boolean handlesContent;
-        private Class<? extends Service> serviceClass;
-        private Class<?> portClass;
-        private String wsdlKey;
-        private String endpointKey;
+        private final String name;
+        private final QName qname;
+        private final boolean handlesContent;
+        private final Class<? extends Service> serviceClass;
+        private final Class<?> portClass;
+        private final String wsdlKey;
+        private final String endpointKey;
 
         CmisWebSerivcesService(String localname, boolean handlesContent, Class<? extends Service> serviceClass,
                 Class<?> port11Class, String wsdlKey, String endpointKey) {
@@ -173,18 +173,18 @@ public abstract class AbstractPortProvid
     }
 
     static class CmisServiceHolder {
-        private CmisWebSerivcesService service;
+        private final CmisWebSerivcesService service;
         private SoftReference<Service> serviceObject;
-        private URL endpointUrl;
+        private final URL endpointUrl;
 
-        public CmisServiceHolder(CmisWebSerivcesService service, URL endpointUrl) throws Exception {
+        public CmisServiceHolder(final CmisWebSerivcesService service, final URL endpointUrl) throws Exception {
             this.service = service;
             this.endpointUrl = endpointUrl;
             this.serviceObject = new SoftReference<Service>(createServiceObject());
         }
 
         private Service createServiceObject() throws Exception {
-            Constructor<? extends Service> serviceConstructor = service.getServiceClass().getConstructor(
+            final Constructor<? extends Service> serviceConstructor = service.getServiceClass().getConstructor(
                     new Class<?>[] { URL.class, QName.class });
             return serviceConstructor.newInstance(new Object[] { null, service.getQName() });
         }
@@ -217,8 +217,8 @@ public abstract class AbstractPortProvid
     protected boolean useClientCompression;
     protected String acceptLanguage;
 
-    private ReentrantLock portObjectLock = new ReentrantLock();
-    private EnumMap<CmisWebSerivcesService, LinkedList<SoftReference<BindingProvider>>> portObjectCache = new EnumMap<CmisWebSerivcesService, LinkedList<SoftReference<BindingProvider>>>(
+    private final ReentrantLock portObjectLock = new ReentrantLock();
+    private final EnumMap<CmisWebSerivcesService, LinkedList<SoftReference<BindingProvider>>> portObjectCache = new EnumMap<CmisWebSerivcesService, LinkedList<SoftReference<BindingProvider>>>(
             CmisWebSerivcesService.class);
 
     public BindingSession getSession() {
@@ -228,10 +228,10 @@ public abstract class AbstractPortProvid
     public void setSession(BindingSession session) {
         this.session = session;
 
-        Object compression = session.get(SessionParameter.COMPRESSION);
+        final Object compression = session.get(SessionParameter.COMPRESSION);
         useCompression = (compression != null) && Boolean.parseBoolean(compression.toString());
 
-        Object clientCompression = session.get(SessionParameter.CLIENT_COMPRESSION);
+        final Object clientCompression = session.get(SessionParameter.CLIENT_COMPRESSION);
         useClientCompression = (clientCompression != null) && Boolean.parseBoolean(clientCompression.toString());
 
         if (session.get(CmisBindingsHelper.ACCEPT_LANGUAGE) instanceof String) {
@@ -397,7 +397,7 @@ public abstract class AbstractPortProvid
     // ---- internal ----
 
     @SuppressWarnings("unchecked")
-    protected BindingProvider getPortObject(CmisWebSerivcesService service) {
+    protected BindingProvider getPortObject(final CmisWebSerivcesService service) {
         Map<CmisWebSerivcesService, CmisServiceHolder> serviceMap = (Map<CmisWebSerivcesService, CmisServiceHolder>) session
                 .get(SpiSessionParameter.SERVICES);
 
@@ -452,7 +452,7 @@ public abstract class AbstractPortProvid
     /**
      * Creates a service object.
      */
-    protected CmisServiceHolder initServiceObject(CmisWebSerivcesService service) {
+    protected CmisServiceHolder initServiceObject(final CmisWebSerivcesService service) {
         if (LOG.isDebugEnabled()) {
             LOG.debug("Initializing Web Service " + service.getServiceName() + "...");
         }
@@ -500,7 +500,7 @@ public abstract class AbstractPortProvid
     /**
      * Reads the URL and extracts the endpoint URL of the given service.
      */
-    private URL getEndpointUrlFromWsdl(String wsdlUrl, CmisWebSerivcesService service) {
+    private URL getEndpointUrlFromWsdl(final String wsdlUrl, final CmisWebSerivcesService service) {
         InputStream wsdlStream;
         URL url;
 
@@ -534,18 +534,18 @@ public abstract class AbstractPortProvid
 
         // parse the WSDL
         try {
-            Document doc = XMLUtils.parseDomDocument(wsdlStream);
+            final Document doc = XMLUtils.parseDomDocument(new BufferedInputStream(wsdlStream, 16 * 1024));
 
             NodeList serivceList = doc.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "service");
             for (int i = 0; i < serivceList.getLength(); i++) {
                 Element serviceNode = (Element) serivceList.item(i);
 
-                Attr attr = serviceNode.getAttributeNode("name");
-                if (attr == null) {
+                String name = serviceNode.getAttribute("name");
+                if (name == null) {
                     continue;
                 }
 
-                if (!service.getQName().getLocalPart().equals(attr.getValue())) {
+                if (!service.getQName().getLocalPart().equals(name)) {
                     continue;
                 }
 
@@ -564,13 +564,13 @@ public abstract class AbstractPortProvid
 
                 Element address = (Element) addressList.item(0);
 
-                attr = address.getAttributeNode("location");
-                if (attr == null) {
+                String location = address.getAttribute("location");
+                if (location == null) {
                     throw new CmisRuntimeException("This service has no endpoint address: " + service.getServiceName());
                 }
 
                 try {
-                    return new URL(attr.getValue());
+                    return new URL(location);
                 } catch (MalformedURLException e) {
                     throw new CmisRuntimeException("This service provides an invalid endpoint address: "
                             + service.getServiceName());
@@ -649,7 +649,7 @@ public abstract class AbstractPortProvid
     /**
      * Creates a simple port object from a CmisServiceHolder object.
      */
-    protected BindingProvider createPortObjectFromServiceHolder(CmisServiceHolder serviceHolder,
+    protected BindingProvider createPortObjectFromServiceHolder(final CmisServiceHolder serviceHolder,
             WebServiceFeature... features) throws Exception {
         portObjectLock.lock();
         try {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties?rev=1486363&r1=1486362&r2=1486363&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties Sat May 25 20:55:21 2013
@@ -17,4 +17,4 @@ log4j.rootLogger=info, logframe
 
 log4j.appender.logframe = org.apache.chemistry.opencmis.workbench.ClientWriterAppender
 log4j.appender.logframe.layout = org.apache.log4j.EnhancedPatternLayout
-log4j.appender.logframe.layout.ConversionPattern = > %d{HH:mm:ss} %5.5p %40.40c: %m%n%throwable{15}
\ No newline at end of file
+log4j.appender.logframe.layout.ConversionPattern = > %d{HH:mm:ss} %5.5p %40.40c: %m%n%throwable{50}
\ No newline at end of file