You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by do...@apache.org on 2015/10/30 11:30:29 UTC

incubator-reef git commit: [REEF-883] Propagate C# stack trace over to Java properly

Repository: incubator-reef
Updated Branches:
  refs/heads/master 94e75b30c -> 6675ea8b1


[REEF-883] Propagate C# stack trace over to Java properly

JIRA:
  [REEF-883](https://issues.apache.org/jira/browse/REEF-883)

Pull request:
  This closes #598


Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/6675ea8b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/6675ea8b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/6675ea8b

Branch: refs/heads/master
Commit: 6675ea8b18c1196bd5025e5f521ac96e37f9647c
Parents: 94e75b3
Author: Andrew Chung <af...@gmail.com>
Authored: Wed Oct 28 16:39:54 2015 -0700
Committer: Dongjoon Hyun <do...@apache.org>
Committed: Fri Oct 30 19:28:36 2015 +0900

----------------------------------------------------------------------
 lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp  |  4 ++
 lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h    |  2 +
 .../cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp | 42 ++++++++++----------
 3 files changed, 27 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/6675ea8b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
index 1bbabab..4a0e42e 100644
--- a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
@@ -133,3 +133,7 @@ JNIEnv* RetrieveEnv(JavaVM* jvm) {
   }
   return env;
 }
+
+String^ FormatJavaExceptionMessage(String^ errorMessage, Exception^ exception) {
+	return String::Concat(errorMessage, Environment::NewLine, exception->StackTrace);
+}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/6675ea8b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
index f926eb4..9ba98b6 100644
--- a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
@@ -63,6 +63,8 @@ jlongArray JavaLongArrayFromManagedLongArray(
 
 JNIEnv* RetrieveEnv(JavaVM* jvm);
 
+String^ FormatJavaExceptionMessage(String^ errorMessage, Exception^ exception);
+
 void HandleClr2JavaError(
   JNIEnv *env,
   String^ errorMessage,

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/6675ea8b/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp b/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp
index 88ce9b8..f57dab2 100644
--- a/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp
+++ b/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp
@@ -131,9 +131,9 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemAl
     ClrSystemHandlerWrapper::Call_ClrSystemAllocatedEvaluatorHandler_OnNext(handle, allocatedEval);
   }
   catch (System::Exception^ ex) {
-    String^ errorMessage = "Exception in Call_clrSystemAllocatedEvaluatorHandler_OnNext";
+    String^ errorMessage = "Exception in Call_clrSystemAllocatedEvaluatorHandler_OnNext:";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    allocatedEval -> OnError(errorMessage);
+    allocatedEval->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -145,14 +145,14 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemAl
 JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemActiveContextHandlerOnNext
 (JNIEnv *env, jclass cls, jlong handle, jobject jactiveContextBridge, jobject jlogger) {
   ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_clrSystemActiveContextHandlerOnNext");
-  ActiveContextClr2Java^ activeContextBrdige = gcnew ActiveContextClr2Java(env, jactiveContextBridge);
+  ActiveContextClr2Java^ activeContextBridge = gcnew ActiveContextClr2Java(env, jactiveContextBridge);
   try {
-    ClrSystemHandlerWrapper::Call_ClrSystemActiveContextHandler_OnNext(handle, activeContextBrdige);
+    ClrSystemHandlerWrapper::Call_ClrSystemActiveContextHandler_OnNext(handle, activeContextBridge);
   }
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemActiveContextHandler_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    activeContextBrdige -> OnError(errorMessage);
+    activeContextBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -171,7 +171,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemEv
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemEvaluatorRequestor_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    evaluatorRequestorBridge -> OnError(errorMessage);
+    evaluatorRequestorBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -191,7 +191,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemTa
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemTaskMessage_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    taskMesageBridge -> OnError(errorMessage);
+    taskMesageBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -210,7 +210,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemFa
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemTaskMessage_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    failedTaskBridge -> OnError(errorMessage);
+    failedTaskBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -229,7 +229,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemRu
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemRunningTask_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    runningTaskBridge -> OnError(errorMessage);
+    runningTaskBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -248,7 +248,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemFa
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemFailedEvaluator_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    failedEvaluatorBridge -> OnError(errorMessage);
+    failedEvaluatorBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -267,7 +267,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemHt
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemHttpServer_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    httpServerClr2Java -> OnError(errorMessage);
+    httpServerClr2Java->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -286,7 +286,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemCo
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemCompletedTask_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    completedTaskBridge -> OnError(errorMessage);
+    completedTaskBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -351,7 +351,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemSu
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemSuspendedTask_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    suspendedTaskBridge -> OnError(errorMessage);
+    suspendedTaskBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -370,7 +370,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemCo
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemCompletedEvaluator_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    completedEvaluatorBridge -> OnError(errorMessage);
+    completedEvaluatorBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -389,7 +389,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemCl
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemClosedContext_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    closedContextBridge -> OnError(errorMessage);
+    closedContextBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -408,7 +408,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemFa
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemFailedContext_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    failedContextBridge -> OnError(errorMessage);
+    failedContextBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -427,7 +427,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemCo
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemContextMessage_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    contextMessageBridge -> OnError(errorMessage);
+    contextMessageBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -462,14 +462,14 @@ JNIEXPORT jlongArray JNICALL Java_org_apache_reef_javabridge_NativeInterop_callC
 JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemDriverRestartActiveContextHandlerOnNext
 (JNIEnv *env, jclass cls, jlong handle, jobject jactiveContextBridge) {
   ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_clrSystemDriverRestartActiveContextHandlerOnNext");
-  ActiveContextClr2Java^ activeContextBrdige = gcnew ActiveContextClr2Java(env, jactiveContextBridge);
+  ActiveContextClr2Java^ activeContextBridge = gcnew ActiveContextClr2Java(env, jactiveContextBridge);
   try {
-    ClrSystemHandlerWrapper::Call_ClrSystemDriverRestartActiveContextHandler_OnNext(handle, activeContextBrdige);
+    ClrSystemHandlerWrapper::Call_ClrSystemDriverRestartActiveContextHandler_OnNext(handle, activeContextBridge);
   }
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemDriverRestartActiveContextHandler_OnNext";
     ManagedLog::LOGGER -> LogError(errorMessage, ex);
-    activeContextBrdige -> OnError(errorMessage);
+    activeContextBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }
 
@@ -488,7 +488,7 @@ JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_clrSystemDr
   catch (System::Exception^ ex) {
     String^ errorMessage = "Exception in Call_ClrSystemDriverRestartRunningTask_OnNext";
     ManagedLog::LOGGER->LogError(errorMessage, ex);
-    runningTaskBridge -> OnError(errorMessage);
+    runningTaskBridge->OnError(FormatJavaExceptionMessage(errorMessage, ex));
   }
 }