Author: kclark
Date: Tue Jun 17 18:11:52 2008
New Revision: 668973

URL: http://svn.apache.org/viewvc?rev=668973&view=rev
Log:
Fix exception handling inside Socket#read

Also remove the useless shebang

Modified:
    incubator/thrift/trunk/lib/rb/lib/thrift/transport/socket.rb

Modified: incubator/thrift/trunk/lib/rb/lib/thrift/transport/socket.rb
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/lib/thrift/transport/socket.rb?rev=668973&r1=668972&r2=668973&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/lib/thrift/transport/socket.rb (original)
+++ incubator/thrift/trunk/lib/rb/lib/thrift/transport/socket.rb Tue Jun 17 
18:11:52 2008
@@ -1,5 +1,3 @@
-#!/usr/bin/env ruby
-#
 # Copyright (c) 2006- Facebook
 # Distributed under the Thrift Software License
 #
@@ -46,13 +44,13 @@
     def read(sz)
       begin
         data = @handle.recv(sz)
-        if (data.length == 0)
-          raise TransportException.new("Socket: Could not read #{sz} bytes 
from [EMAIL PROTECTED]:[EMAIL PROTECTED]")
-        end
-        return data
       rescue StandardError
         raise TransportException.new(TransportException::NOT_OPEN)
       end
+      if (data.length == 0)
+        raise TransportException.new(TransportException::UNKNOWN, "Socket: 
Could not read #{sz} bytes from [EMAIL PROTECTED]:[EMAIL PROTECTED]")
+      end
+      return data
     end
 
     def close


Reply via email to