diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-12-12 10:03:29 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-12-12 10:03:29 +0100 |
commit | 15243f5d52cbcef1c2bcddbdfe1faa5fcf83c0a7 (patch) | |
tree | cfb55a8b546ac3abb6a0b5542bb1f7b5eb794815 /js | |
parent | Bump expect/expectall default timeouts (diff) | |
download | ice-15243f5d52cbcef1c2bcddbdfe1faa5fcf83c0a7.tar.bz2 ice-15243f5d52cbcef1c2bcddbdfe1faa5fcf83c0a7.tar.xz ice-15243f5d52cbcef1c2bcddbdfe1faa5fcf83c0a7.zip |
Fixed ICE-6142: oneway batch operations didn't throw
Diffstat (limited to 'js')
-rw-r--r-- | js/src/Ice/ConnectRequestHandler.js | 84 |
1 files changed, 36 insertions, 48 deletions
diff --git a/js/src/Ice/ConnectRequestHandler.js b/js/src/Ice/ConnectRequestHandler.js index f238830bab1..ff6ecdd7c33 100644 --- a/js/src/Ice/ConnectRequestHandler.js +++ b/js/src/Ice/ConnectRequestHandler.js @@ -100,18 +100,11 @@ var ConnectRequestHandler = Ice.Class({ }, prepareBatchRequest: function(os) { - try - { - if(!this.initialized()) - { - this._batchRequestInProgress = true; - this._batchStream.swap(os); - return; - } - } - catch(ex) + if(!this.initialized()) { - throw new RetryException(ex); + this._batchRequestInProgress = true; + this._batchStream.swap(os); + return; } this._connection.prepareBatchRequest(os); }, @@ -295,44 +288,13 @@ var ConnectRequestHandler = Ice.Class({ { Debug.assert(this._connection !== null && !this._initialized); + var exception = null; while(this._requests.length > 0) { var request = this._requests[0]; - if(request.out !== null) - { - try - { - request.out.__send(this._connection, this._compress, this._response); - } - catch(ex) - { - if(ex instanceof RetryException) - { - try - { - // Remove the request handler before retrying. - this._reference.getInstance().requestHandlerFactory().removeRequestHandler( - this._reference, this); - } - catch(exc) - { - // Ignore - } - request.out.__retryException(ex.inner); - } - else if(ex instanceof LocalException) - { - request.out.__completedEx(ex); - } - else - { - throw ex; - } - } - } - else + try { - try + if(request.os !== null) { var os = new BasicStream(request.os.instance, Protocol.currentProtocolEncoding); this._connection.prepareBatchRequest(os); @@ -348,14 +310,39 @@ var ConnectRequestHandler = Ice.Class({ } this._connection.finishBatchRequest(os, this._compress); } - catch(ex) + else + { + request.out.__send(this._connection, this._compress, this._response); + } + } + catch(ex) + { + if(ex instanceof RetryException) + { + exception = ex.inner; + try + { + // Remove the request handler before retrying. + this._reference.getInstance().requestHandlerFactory().removeRequestHandler(this._reference, + this); + } + catch(exc) + { + // Ignore + } + request.out.__retryException(ex.inner); + } + else { + Debug.assert(ex instanceof LocalException); + exception = ex; + request.out.__completedEx(ex); } } this._requests.shift(); } - if(this._reference.getCacheConnection()) + if(this._reference.getCacheConnection() && exception === null) { this._connectionRequestHandler = new ConnectionRequestHandler(this._reference, this._connection, @@ -367,7 +354,8 @@ var ConnectRequestHandler = Ice.Class({ } Debug.assert(!this._initialized); - this._initialized = true; + this._exception = exception; + this._initialized = this._exception !== null; try { // |