diff --git a/.travis.yml b/.travis.yml index 9bec0b6..36701b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,8 @@ sudo: false language: node_js node_js: - - '5' + - '6' - '4' - - '3' - - '2' - - '1' - - '0.12' - - '0.10' script: - "npm run ci" after_script: diff --git a/lib/v1/decoder.js b/lib/v1/decoder.js index bc04fc6..46efb18 100644 --- a/lib/v1/decoder.js +++ b/lib/v1/decoder.js @@ -423,7 +423,7 @@ proto.readObject = function (withType) { debug('read object finish'); // java.lang.NoClassDefFoundError - if (/Exception$/.test(type) || /^java\.lang\.\w+Error$/.test(type)) { + if (type.endsWith('Exception') || (type.startsWith('java.lang.') && type.endsWith('Error'))) { result.$ = new JavaExceptionError(result, withType); } diff --git a/lib/v2/decoder.js b/lib/v2/decoder.js index 8d8db34..82a9c5d 100644 --- a/lib/v2/decoder.js +++ b/lib/v2/decoder.js @@ -571,7 +571,7 @@ proto.readObject = function (withType) { } else { this.throwError('readObject', code); } - + var cls = this.classes[ref]; debug('readObject %s, ref: %s', cls.name, ref); @@ -590,7 +590,7 @@ proto.readObject = function (withType) { } } - if (/Exception$/.test(cls.name)) { + if (cls.name.endsWith('Exception')) { result.$ = new JavaExceptionError(result, withType); } @@ -759,7 +759,7 @@ utils.addByteCodes(BYTE_CODES, [ * v2.0 * ``` * map ::= M(x4d) [type] (value value)* Z - * + * * @see http://hessian.caucho.com/doc/hessian-serialization.html##map * ``` * Represents serialized maps and can represent objects. @@ -801,7 +801,7 @@ proto.readMap = function (withType) { this._addRef(result); this._readMap(result.$, withType); - if (/Exception$/.test(type)) { + if (type.endsWith('Exception')) { result.$ = new JavaExceptionError(result); } diff --git a/package.json b/package.json index 1e5769e..82af3d9 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,6 @@ "should": "5" }, "engines": { - "node": ">= 0.10.0" + "node": ">= 4" } }