THRIFT-1011. as3: Error generating package imports when using classes from other packages
Patch: Usman Ismail
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1075916 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/as3/src/org/apache/thrift/TApplicationError.as b/lib/as3/src/org/apache/thrift/TApplicationError.as
index 039d9b9..93ef946 100644
--- a/lib/as3/src/org/apache/thrift/TApplicationError.as
+++ b/lib/as3/src/org/apache/thrift/TApplicationError.as
@@ -40,6 +40,7 @@
public static const WRONG_METHOD_NAME:int = 3;
public static const BAD_SEQUENCE_ID:int = 4;
public static const MISSING_RESULT:int = 5;
+ public static const INTERNAL_ERROR:int = 6;
public function TApplicationError(type:int = UNKNOWN, message:String = "") {
super(message, type);
diff --git a/lib/as3/src/org/apache/thrift/transport/THttpClient.as b/lib/as3/src/org/apache/thrift/transport/THttpClient.as
index a63e314..435f911 100644
--- a/lib/as3/src/org/apache/thrift/transport/THttpClient.as
+++ b/lib/as3/src/org/apache/thrift/transport/THttpClient.as
@@ -27,6 +27,7 @@
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
+ import flash.system.Capabilities;
import flash.utils.ByteArray;
/**
@@ -38,14 +39,19 @@
private var request_:URLRequest = null;
private var requestBuffer_:ByteArray = new ByteArray();
private var responseBuffer_:ByteArray = null;
+ private var traceBuffers_:Boolean = Capabilities.isDebugger;
+
public function getBuffer():ByteArray {
return requestBuffer_;
}
- public function THttpClient(request:URLRequest):void {
+ public function THttpClient(request:URLRequest, traceBuffers:Boolean=true):void {
request.contentType = "application/x-thrift";
request_ = request;
+ if(traceBuffers == false) {
+ traceBuffers_ = traceBuffers;
+ }
}
public override function open():void {
@@ -64,9 +70,16 @@
}
try {
responseBuffer_.readBytes(buf, off, len);
+ if (traceBuffers_) {
+ dumpBuffer(buf, "READ");
+ }
return len;
}
catch (e:EOFError) {
+ if (traceBuffers_) {
+ dumpBuffer(requestBuffer_, "FAILED-RESPONSE-REQUEST");
+ dumpBuffer(responseBuffer_, "FAILED-RESPONSE");
+ }
throw new TTransportError(TTransportError.UNKNOWN, "No more data available.");
}
return 0;
@@ -81,6 +94,9 @@
if (callback != null) {
loader.addEventListener(Event.COMPLETE, function(event:Event):void {
responseBuffer_ = URLLoader(event.target).data;
+ if (traceBuffers_) {
+ dumpBuffer(responseBuffer_, "RESPONSE_BUFFER");
+ }
callback(null);
responseBuffer_ = null;
});
@@ -99,5 +115,20 @@
request_.data = requestBuffer_;
loader.load(request_);
}
+
+ private function dumpBuffer(buf:ByteArray, prefix:String):String {
+ var debugString : String = prefix + " BUFFER ";
+ if (buf != null) {
+ debugString += "length: " + buf.length + ", ";
+ for (var i : int = 0; i < buf.length; i++) {
+ debugString += "[" + buf[i].toString(16) + "]";
+ }
+ } else {
+ debugString = "null";
+ }
+ trace(debugString);
+ return debugString;
+ }
+
}
}
diff --git a/lib/cocoa/src/TSharedProcessorFactory.h b/lib/cocoa/src/TSharedProcessorFactory.h
index d3e55c4..cf4a462 100644
--- a/lib/cocoa/src/TSharedProcessorFactory.h
+++ b/lib/cocoa/src/TSharedProcessorFactory.h
@@ -23,5 +23,5 @@
@interface TSharedProcessorFactory : NSObject <TProcessorFactory> {
id<TProcessor> mSharedProcessor;
}
-
+- (id) initWithSharedProcessor: (id<TProcessor>) sharedProcessor;
@end