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/11/11 23:37:29 UTC

svn commit: r1540872 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/j...

Author: fmui
Date: Mon Nov 11 22:37:29 2013
New Revision: 1540872

URL: http://svn.apache.org/r1540872
Log:
Workbench: better connection problem debugging

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.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/http/AbstractApacheClientHttpInvoker.java?rev=1540872&r1=1540871&r2=1540872&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java Mon Nov 11 22:37:29 2013
@@ -97,6 +97,8 @@ public abstract class AbstractApacheClie
 
     protected Response invoke(UrlBuilder url, String method, String contentType, Map<String, String> headers,
             final Output writer, final BindingSession session, BigInteger offset, BigInteger length) {
+        int respCode = -1;
+
         try {
             // log before connect
             if (LOG.isDebugEnabled()) {
@@ -255,7 +257,7 @@ public abstract class AbstractApacheClie
             HttpEntity entity = response.getEntity();
 
             // get stream, if present
-            int respCode = response.getStatusLine().getStatusCode();
+            respCode = response.getStatusLine().getStatusCode();
             InputStream inputStream = null;
             InputStream errorStream = null;
 
@@ -298,7 +300,8 @@ public abstract class AbstractApacheClie
             return new Response(respCode, response.getStatusLine().getReasonPhrase(), responseHeaders, inputStream,
                     errorStream);
         } catch (IOException e) {
-            throw new CmisConnectionException("Cannot access " + url + ": " + e.getMessage(), e);
+            String status = (respCode > 0 ? " (HTTP status code " + respCode + ")" : "");
+            throw new CmisConnectionException("Cannot access \"" + url + "\"" + status + ": " + e.getMessage(), e);
         }
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.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/http/DefaultHttpInvoker.java?rev=1540872&r1=1540871&r2=1540872&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java Mon Nov 11 22:37:29 2013
@@ -74,6 +74,8 @@ public class DefaultHttpInvoker implemen
 
     private Response invoke(UrlBuilder url, String method, String contentType, Map<String, String> headers,
             Output writer, BindingSession session, BigInteger offset, BigInteger length) {
+        int respCode = -1;
+
         try {
             // log before connect
             if (LOG.isDebugEnabled()) {
@@ -201,7 +203,7 @@ public class DefaultHttpInvoker implemen
             conn.connect();
 
             // get stream, if present
-            int respCode = conn.getResponseCode();
+            respCode = conn.getResponseCode();
             InputStream inputStream = null;
             if ((respCode == 200) || (respCode == 201) || (respCode == 203) || (respCode == 206)) {
                 inputStream = conn.getInputStream();
@@ -221,7 +223,8 @@ public class DefaultHttpInvoker implemen
             return new Response(respCode, conn.getResponseMessage(), conn.getHeaderFields(), inputStream,
                     conn.getErrorStream());
         } catch (Exception e) {
-            throw new CmisConnectionException("Cannot access " + url + ": " + e.getMessage(), e);
+            String status = (respCode > 0 ? " (HTTP status code " + respCode + ")" : "");
+            throw new CmisConnectionException("Cannot access \"" + url + "\"" + status + ": " + e.getMessage(), e);
         }
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java?rev=1540872&r1=1540871&r2=1540872&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java Mon Nov 11 22:37:29 2013
@@ -74,7 +74,7 @@ public class BasicLoginTab extends Abstr
         setLayout(new SpringLayout());
 
         urlField = createTextField(this, "URL:");
-        urlField.setText(System.getProperty(SYSPROP_URL, ""));
+        urlField.setText(System.getProperty(SYSPROP_URL, "").trim());
 
         createBindingButtons(this);
 
@@ -206,7 +206,7 @@ public class BasicLoginTab extends Abstr
 
     @Override
     public Map<String, String> getSessionParameters() {
-        String url = urlField.getText();
+        String url = urlField.getText().trim();
 
         BindingType binding = BindingType.ATOMPUB;
         if (bindingWebServicesButton.isSelected()) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java?rev=1540872&r1=1540871&r2=1540872&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java Mon Nov 11 22:37:29 2013
@@ -114,6 +114,10 @@ public final class ClientHelper {
                 if (cex.getErrorContent() != null) {
                     LOG.error("Error content: " + cex.getErrorContent());
                 }
+
+                if (LOG.isDebugEnabled() && cex.getCause() != null) {
+                    LOG.debug("Cause: " + cex.getCause().toString(), cex.getCause());
+                }
             }
         }