[thrift] retool oop.erl, fix tBufferedTransportFactory.erl
Summary: oop.erl used to assume that an undef or function_clause meant a method wasn't defined, but sometimes a method does exist and an undef happens while it's executing.
Case in point, getTransport in tBufferedTransportFactory totally didn't work and instead of exiting, oop.erl fell back silently to tTransportFactory, so everywhere I thought I was talking to tBufferedTransport, I was talking directly to the tSocket. borkborkbork.
Blame: all me baby
Reviewed By: eletuchy
Test Plan: channel server works
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665299 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/src/transport/tBufferedTransport.erl b/lib/erl/src/transport/tBufferedTransport.erl
index 48d9fba..3c0a046 100644
--- a/lib/erl/src/transport/tBufferedTransport.erl
+++ b/lib/erl/src/transport/tBufferedTransport.erl
@@ -39,7 +39,7 @@
%%% inspect(This) -> string()
inspect(This) ->
- ?FORMAT_ATTR(transport) ++
+ ?FORMAT_ATTR(transport) ++ ", " ++
?FORMAT_ATTR(wbuf).
%%%
diff --git a/lib/erl/src/transport/tBufferedTransportFactory.erl b/lib/erl/src/transport/tBufferedTransportFactory.erl
index 9746aba..5bc5012 100644
--- a/lib/erl/src/transport/tBufferedTransportFactory.erl
+++ b/lib/erl/src/transport/tBufferedTransportFactory.erl
@@ -51,4 +51,4 @@
%%%
getTransport(_This, Trans) ->
- gen_server:start_link(tBufferedTransport, {new, [Trans]}).
+ oop:start_new(tBufferedTransport, [Trans]).
diff --git a/lib/erl/src/transport/tSocket.erl b/lib/erl/src/transport/tSocket.erl
index c2bf920..c438203 100644
--- a/lib/erl/src/transport/tSocket.erl
+++ b/lib/erl/src/transport/tSocket.erl
@@ -19,7 +19,7 @@
-export([new/0, new/1, new/2,
effectful_setHandle/2, effectful_open/1,
- isOpen/1, write/2, read/2, effectful_close/1]).
+ isOpen/1, effectful_write/2, read/2, effectful_close/1]).
%%%
%%% define attributes
@@ -87,7 +87,7 @@
isOpen(This) ->
oop:get(This, handle) /= nil.
-write(This, Str) ->
+effectful_write(This, Str) ->
Handle = oop:get(This, handle),
Val = gen_tcp:send(Handle, Str),
@@ -100,7 +100,7 @@
{error, _} ->
throw(tTransportException:new(?tTransportException_NOT_OPEN, "in write"));
ok ->
- ok
+ {ok, This}
end.
read(This, Sz) ->
diff --git a/lib/erl/src/transport/tTransport.erl b/lib/erl/src/transport/tTransport.erl
index 6ec115a..a7293be 100644
--- a/lib/erl/src/transport/tTransport.erl
+++ b/lib/erl/src/transport/tTransport.erl
@@ -50,12 +50,13 @@
%%% instance methods
%%%
+e() ->
+ exit('tTransport is abstract').
-
-isOpen(_This) -> nil.
-open(_This) -> nil.
-close(_This) -> nil.
-read(_This, _Sz) -> nil.
+isOpen(_This) -> e(), nil.
+open(_This) -> e(), nil.
+close(_This) -> e(), nil.
+read(_This, _Sz) -> e(), nil.
readAll(This, Sz) ->
readAll_loop(This, Sz, "", 0).
@@ -80,6 +81,7 @@
end.
effectful_write(This, _Buf) ->
+ e(),
{nil, This}.
effectful_flush(This) ->