THRIFT-3407 Refill buffer when JSON closing bracket is missing
This closes #678
diff --git a/lib/nodejs/lib/thrift/json_protocol.js b/lib/nodejs/lib/thrift/json_protocol.js
index e98650c..18fb012 100644
--- a/lib/nodejs/lib/thrift/json_protocol.js
+++ b/lib/nodejs/lib/thrift/json_protocol.js
@@ -418,7 +418,8 @@
}
if (openBracketCount !== 0) {
- throw new Error("Malformed JSON input, mismatched backets");
+ // Missing closing bracket. Can be buffer underrun.
+ throw new InputBufferUnderrunError();
}
//Reconstitute the JSON object and conume the necessary bytes