From: Roger Meier Date: Tue, 22 Feb 2011 20:56:45 +0000 (+0000) Subject: THRIFT-1065 JavaScript read-undefined-exceptions2 X-Git-Tag: 0.7.0~174 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=76d55f635784aa9dfae8ce52ce3eb49ba7f90a40;p=common%2Fthrift.git THRIFT-1065 JavaScript read-undefined-exceptions2 Patch: Henrique Mendonca git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1073497 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/js/thrift.js b/lib/js/thrift.js index 3ce1f74c..dc74eb6a 100644 --- a/lib/js/thrift.js +++ b/lib/js/thrift.js @@ -86,25 +86,17 @@ Thrift.TApplicationException = function(message, code){ Thrift.TApplicationException.prototype = { read : function(input){ - - var ftype - var fid - var ret = input.readStructBegin(fname) - - this.fname = ret.fname - while(1){ - ret = input.readFieldBegin() - if(ret.ftype == TType.STOP) + if(ret.ftype == Thrift.Type.STOP) break var fid = ret.fid switch(fid){ case 1: - if( ret.ftype == Type.STRING ){ + if( ret.ftype == Thrift.Type.STRING ){ ret = input.readString() this.message = ret.value } else { @@ -113,7 +105,7 @@ Thrift.TApplicationException.prototype = { break case 2: - if( ret.ftype == Type.I32 ){ + if( ret.ftype == Thrift.Type.I32 ){ ret = input.readI32() this.code = ret.value } else { @@ -127,11 +119,9 @@ Thrift.TApplicationException.prototype = { } input.readFieldEnd() - } input.readStructEnd() - }, write: function(output){ @@ -140,20 +130,19 @@ Thrift.TApplicationException.prototype = { output.writeStructBegin('TApplicationException'); if (this.message) { - output.writeFieldBegin('message', Type.STRING, 1) + output.writeFieldBegin('message', Thrift.Type.STRING, 1) output.writeString(this.getMessage()) output.writeFieldEnd() } if (this.code) { - output.writeFieldBegin('type', Type.I32, 2) + output.writeFieldBegin('type', Thrift.Type.I32, 2) output.writeI32(this.code) output.writeFieldEnd() } output.writeFieldStop() output.writeStructEnd() - }, getCode : function() {