diff --git a/.travis.yml b/.travis.yml index 839e7c3..18f507a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,7 @@ sudo: false language: node_js node_js: - - '5' + - '6' - '4' - - '0.12' - - '0.10' script: "make test-cov" after_script: "npm i codecov && codecov" diff --git a/lib/v1/decoder.js b/lib/v1/decoder.js index e3ec64d..46efb18 100644 --- a/lib/v1/decoder.js +++ b/lib/v1/decoder.js @@ -417,13 +417,13 @@ proto.readObject = function (withType) { // property name will auto transfer to a String type. debug('read object prop: %j with type: %s', key, withType); if (!/^this\$\d+$/.test(key)) { - result.$[key] = value; + result.$[key] = value; } } 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 eea03a1..08d1811 100644 --- a/lib/v2/decoder.js +++ b/lib/v2/decoder.js @@ -514,7 +514,7 @@ proto.readObject = function (withType) { } } - if (/Exception$/.test(cls.name)) { + if (cls.name.endsWith('Exception')) { result.$ = new JavaExceptionError(result, withType); } @@ -770,7 +770,7 @@ proto.readMap = function (withType) { this._addRef(result); this._readMap(result.$, withType); - if (/Exception$/.test(type)) { + if (type.endsWith('Exception')) { result.$ = new JavaExceptionError(result); }