cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r609735 - in /incubator/cxf/trunk/rt/javascript/src/main: java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java resources/org/apache/cxf/javascript/cxf-utils.js
Date Mon, 07 Jan 2008 18:49:40 GMT
Author: bimargulies
Date: Mon Jan  7 10:49:38 2008
New Revision: 609735

URL: http://svn.apache.org/viewvc?rev=609735&view=rev
Log:
Deal with some error handling quirks of Mozilla.

Modified:
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
    incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=609735&r1=609734&r2=609735&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
Mon Jan  7 10:49:38 2008
@@ -383,7 +383,16 @@
         utils.startIf("this._onerror");
         // Is this a good set of parameters for the error function?
         // Not if we want to process faults, it isn't. To be revisited.
-        utils.appendLine("this._onerror(this.client.req.status, this.client.req.statusText);");
+        utils.appendLine("var httpStatus;");
+        utils.appendLine("var httpStatusText;");
+        utils.appendLine("try {");
+        utils.appendLine(" httpStatus = this.client.req.status;");
+        utils.appendLine(" httpStatusText = this.client.req.statusText;");
+        utils.appendLine("} catch(e) {");
+        utils.appendLine(" httpStatus = -1;");
+        utils.appendLine(" httpStatusText = 'Error opening connection to server';");
+        utils.appendLine("}");
+        utils.appendLine("this._onerror(httpStatus, httpStatusText);");
         utils.endBlock();
         code.append("}\n\n");
         code.append(currentInterfaceClassName + ".prototype." 

Modified: incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js?rev=609735&r1=609734&r2=609735&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
Mon Jan  7 10:49:38 2008
@@ -378,7 +378,19 @@
     this.utils.trace("onreadystatechange " + ready);
 
     if (ready == this.READY_STATE_DONE) {
-        var httpStatus=req.status;
+    	var httpStatus;
+    	try {
+        	httpStatus=req.status;
+    	} catch(e) {
+    		// Firefox throws when there was an error here. 
+    		this.utils.trace("onreadystatechange DONE ERROR retrieving status (connection error?)");
+    		if(this.onerror != null) {
+   			    this.onerror(e);
+    		}
+    		return;
+
+    	}
+    	
         this.utils.trace("onreadystatechange DONE " + httpStatus);
 
         if (httpStatus==200 || httpStatus==0) {



Mime
View raw message