THRIFT-1065 JavaScript read-undefined-exceptions2
authorRoger Meier <roger@apache.org>
Tue, 22 Feb 2011 20:56:45 +0000 (20:56 +0000)
committerRoger Meier <roger@apache.org>
Tue, 22 Feb 2011 20:56:45 +0000 (20:56 +0000)
Patch: Henrique Mendonca

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1073497 13f79535-47bb-0310-9956-ffa450edef68

lib/js/thrift.js

index 3ce1f74..dc74eb6 100644 (file)
@@ -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() {