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 3ce1f74..dc74eb6 100644
--- a/lib/js/thrift.js
+++ b/lib/js/thrift.js
@@ -86,25 +86,17 @@
 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 @@
                     
                     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 @@
             }
             
             input.readFieldEnd()
-            
         }
         
         input.readStructEnd()
-        
     },
     
     write: function(output){
@@ -140,20 +130,19 @@
         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() {