summaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
Diffstat (limited to 'js/src')
-rw-r--r--js/src/Ice/Buffer.js14
-rw-r--r--js/src/Ice/ConnectionI.js14
-rw-r--r--js/src/Ice/Exception.js15
-rw-r--r--js/src/Ice/IncomingAsync.js77
-rw-r--r--js/src/Ice/ObjectAdapterFactory.js2
-rw-r--r--js/src/Ice/PropertyNames.js3
-rw-r--r--js/src/Ice/Stream.js4
-rw-r--r--js/src/Ice/TraceUtil.js19
8 files changed, 82 insertions, 66 deletions
diff --git a/js/src/Ice/Buffer.js b/js/src/Ice/Buffer.js
index d6f395629ba..499d8726cdc 100644
--- a/js/src/Ice/Buffer.js
+++ b/js/src/Ice/Buffer.js
@@ -371,12 +371,12 @@ class Buffer
s = decodeURIComponent(escape(s));
return s;
}
-
+
get position()
{
return this._position;
}
-
+
set position(value)
{
if(value >= 0 && value <= this._limit)
@@ -384,12 +384,12 @@ class Buffer
this._position = value;
}
}
-
+
get limit()
{
return this._limit;
}
-
+
set limit(value)
{
if(value <= this.capacity)
@@ -401,17 +401,17 @@ class Buffer
}
}
}
-
+
get capacity()
{
return this.b === null ? 0 : this.b.byteLength;
}
-
+
get remaining()
{
return this._limit - this._position;
}
-
+
//
// Create a native buffer from an array of bytes.
//
diff --git a/js/src/Ice/ConnectionI.js b/js/src/Ice/ConnectionI.js
index 1bf5c7d0b28..d937186a6fb 100644
--- a/js/src/Ice/ConnectionI.js
+++ b/js/src/Ice/ConnectionI.js
@@ -1729,9 +1729,10 @@ class ConnectionI
}
return AsyncStatus.Sent;
}
+
message.doAdopt();
- this._writeStream.swap(stream);
+ this._writeStream.swap(message.stream);
this._sendStreams.push(message);
this.scheduleTimeout(SocketOperation.Write, this._endpoint.timeout());
@@ -1930,9 +1931,18 @@ class ConnectionI
{
this.invokeException(ex, invokeNum);
}
+ else if(ex instanceof Ice.ServantError)
+ {
+ // Ignore
+ }
else
{
- throw ex;
+ //
+ // An Error was raised outside of servant code (i.e., by Ice code).
+ // Attempt to log the error and clean up.
+ //
+ this._logger.error("unexpected exception:\n" + ex.toString());
+ this.invokeException(requestId, new Ice.UnknownException(ex), invokeNum, false);
}
}
}
diff --git a/js/src/Ice/Exception.js b/js/src/Ice/Exception.js
index 3ad61513fa7..14d9472df16 100644
--- a/js/src/Ice/Exception.js
+++ b/js/src/Ice/Exception.js
@@ -51,6 +51,17 @@ const toString = function(key, object, objectTable, ident)
return s;
};
+class ServantError extends Error
+{
+ constructor(cause)
+ {
+ super();
+ this.cause = cause;
+ }
+}
+
+Ice.ServantError = ServantError;
+
//
// Ice.Exception
//
@@ -99,7 +110,7 @@ class Exception extends Error
this._inToStringAlready = false;
return s;
}
-
+
static captureStackTrace(object)
{
const stack = new Error().stack;
@@ -112,7 +123,7 @@ class Exception extends Error
Object.defineProperty(object, "stack", {
get: function()
{
- return stack;
+ return stack;
}
});
}
diff --git a/js/src/Ice/IncomingAsync.js b/js/src/Ice/IncomingAsync.js
index 76e4a29666b..4ef1526eb44 100644
--- a/js/src/Ice/IncomingAsync.js
+++ b/js/src/Ice/IncomingAsync.js
@@ -150,22 +150,7 @@ class IncomingAsync
this._instance.initializationData().logger.warning(s.join(""));
}
- servantLocatorFinished()
- {
- Debug.assert(this._locator !== null && this._servant !== null);
- try
- {
- this._locator.finished(this._current, this._servant, this._cookie.value);
- return true;
- }
- catch(ex)
- {
- this.handleException(ex);
- }
- return false;
- }
-
- handleException(ex)
+ handleException(ex, amd)
{
Debug.assert(this._connection !== null);
@@ -366,6 +351,11 @@ class IncomingAsync
{
this._connection.sendNoResponse();
}
+
+ if(!amd)
+ {
+ throw new Ice.ServantError(ex);
+ }
}
this._connection = null;
@@ -431,7 +421,7 @@ class IncomingAsync
catch(ex)
{
this.skipReadParams(); // Required for batch requests.
- this.handleException(ex);
+ this.handleException(ex, false);
return;
}
}
@@ -457,7 +447,7 @@ class IncomingAsync
catch(ex)
{
this.skipReadParams(); // Required for batch requests.
- this.handleException(ex);
+ this.handleException(ex, false);
return;
}
}
@@ -468,16 +458,16 @@ class IncomingAsync
let promise = this._servant._iceDispatch(this, this._current);
if(promise !== null)
{
- promise.then(() => this.response(), (ex) => this.exception(ex));
+ promise.then(() => this.completed(null, true), (ex) => this.completed(ex, true));
return;
}
Debug.assert(!this._response || this._os !== null);
- this.response();
+ this.completed(null, false);
}
catch(ex)
{
- this.exception(ex);
+ this.completed(ex, false);
}
}
@@ -512,18 +502,31 @@ class IncomingAsync
this._current.encoding = this._is.skipEncapsulation();
}
- response()
+ completed(exc, amd)
{
try
{
- if(this._locator !== null && !this.servantLocatorFinished())
+ if(this._locator !== null && !this.servantLocatorFinished(amd))
{
- return;
+ Debug.assert(this._locator !== null && this._servant !== null);
+ try
+ {
+ this._locator.finished(this._current, this._servant, this._cookie.value);
+ }
+ catch(ex)
+ {
+ this.handleException(ex, amd);
+ return;
+ }
}
Debug.assert(this._connection !== null);
- if(this._response)
+ if(exc != null)
+ {
+ this.handleException(exc, amd);
+ }
+ else if(this._response)
{
this._connection.sendResponse(this._os);
}
@@ -534,26 +537,18 @@ class IncomingAsync
}
catch(ex)
{
- this._connection.invokeException(ex, 1);
- }
- this._connection = null;
- }
-
- exception(exc)
- {
- try
- {
- if(this._locator !== null && !this.servantLocatorFinished())
+ if(ex instanceof Ice.LocalException)
{
- return;
+ this._connection.invokeException(ex, 1);
+ }
+ else
+ {
+ throw ex;
}
- this.handleException(exc);
- }
- catch(ex)
- {
- this._connection.invokeException(ex, 1);
}
+ this._connection = null;
}
+
}
Ice.IncomingAsync = IncomingAsync;
diff --git a/js/src/Ice/ObjectAdapterFactory.js b/js/src/Ice/ObjectAdapterFactory.js
index 2115358984a..d68aa5ff46e 100644
--- a/js/src/Ice/ObjectAdapterFactory.js
+++ b/js/src/Ice/ObjectAdapterFactory.js
@@ -48,7 +48,7 @@ class ObjectAdapterFactory
this._instance = null;
this._communicator = null;
- this._shutdownPromise = _Promise.all(this._adapters.map(adapter => adapter.deactivate()));
+ _Promise.all(this._adapters.map(adapter => adapter.deactivate())).then(() => this._shutdownPromise.resolve());
return this._shutdownPromise;
}
diff --git a/js/src/Ice/PropertyNames.js b/js/src/Ice/PropertyNames.js
index 835a981434d..7271a5973c2 100644
--- a/js/src/Ice/PropertyNames.js
+++ b/js/src/Ice/PropertyNames.js
@@ -6,7 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue Feb 28 15:01:12 2017
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Mar 23 15:24:16 2017
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -80,6 +80,7 @@ PropertyNames.IceProps =
new Property("/^Ice\.BatchAutoFlush/", true, null),
new Property("/^Ice\.BatchAutoFlushSize/", false, null),
new Property("/^Ice\.ChangeUser/", false, null),
+ new Property("/^Ice\.ClassGraphDepthMax/", false, null),
new Property("/^Ice\.ClientAccessPolicyProtocol/", false, null),
new Property("/^Ice\.Compression\.Level/", false, null),
new Property("/^Ice\.CollectObjects/", false, null),
diff --git a/js/src/Ice/Stream.js b/js/src/Ice/Stream.js
index 85386ff8786..8ac72046c6e 100644
--- a/js/src/Ice/Stream.js
+++ b/js/src/Ice/Stream.js
@@ -1252,7 +1252,7 @@ class InputStream
{
if(this._encapsStack !== null)
{
- Debug.assert(this._encapsStack.next);
+ Debug.assert(this._encapsStack.next === null);
this._encapsStack.next = this._encapsCache;
this._encapsCache = this._encapsStack;
this._encapsCache.reset();
@@ -1840,7 +1840,7 @@ class InputStream
//
this._encapsStack.decoder.readValue.call(
this._encapsStack.decoder,
- obj =>
+ cb === null ? null : obj =>
{
if(obj !== null && !(obj instanceof T))
{
diff --git a/js/src/Ice/TraceUtil.js b/js/src/Ice/TraceUtil.js
index eee9a10d7b1..05452817e2f 100644
--- a/js/src/Ice/TraceUtil.js
+++ b/js/src/Ice/TraceUtil.js
@@ -25,18 +25,8 @@ const Protocol = Ice.Protocol;
const StringUtil = Ice.StringUtil;
const OperationMode = Ice.OperationMode;
const Identity = Ice.Identity;
-
const slicingIds = new Map();
-function traceSlicing(kind, typeId, slicingCat, logger)
-{
- if(!slicingIds.has(typeId))
- {
- logger.trace(slicingCat, `unknown ${kind} type \`${typeId}'`);
- slicingIds.set(typeId, 1);
- }
-}
-
function printIdentityFacetOperation(s, stream)
{
let toStringMode = Ice.ToStringMode.Unicode;
@@ -366,6 +356,15 @@ function getMessageTypeAsString(type)
class TraceUtil
{
+ static traceSlicing(kind, typeId, slicingCat, logger)
+ {
+ if(!slicingIds.has(typeId))
+ {
+ logger.trace(slicingCat, `unknown ${kind} type \`${typeId}'`);
+ slicingIds.set(typeId, 1);
+ }
+ }
+
static traceSend(stream, logger, traceLevels)
{
if(traceLevels.protocol >= 1)