resolved conflicts for merge of f78109f6 to dalvik-dev
(git cherry-pick -m 1 8a6e388c11d8ee72a0af23e6091239e2f58bc968)
Change-Id: Ie07e5901d5a127b6d6840b05da5dfd5c2b967048
diff --git a/luni/src/main/native/java_lang_ProcessManager.cpp b/luni/src/main/native/java_lang_ProcessManager.cpp
index 783fbd1..6556dc8 100644
--- a/luni/src/main/native/java_lang_ProcessManager.cpp
+++ b/luni/src/main/native/java_lang_ProcessManager.cpp
@@ -28,6 +28,8 @@
#include "cutils/log.h"
#include "jni.h"
+#include "ExecStrings.h"
+#include "JNIHelp.h"
#include "JniConstants.h"
#include "JNIHelp.h"
#include "Portability.h"
@@ -208,8 +210,8 @@
jobject inDescriptor, jobject outDescriptor, jobject errDescriptor,
jboolean redirectErrorStream) {
- // Copy commands into char*[].
- char** commands = convertStrings(env, javaCommands);
+ ExecStrings commands(env, javaCommands);
+ ExecStrings environment(env, javaEnvironment);
// Extract working directory string.
const char* workingDirectory = NULL;
@@ -217,32 +219,14 @@
workingDirectory = env->GetStringUTFChars(javaWorkingDirectory, NULL);
}
- // Convert environment array.
- char** environment = convertStrings(env, javaEnvironment);
-
- pid_t result = ExecuteProcess(env, commands, environment, workingDirectory,
+ pid_t result = ExecuteProcess(env, commands.get(), environment.get(), workingDirectory,
inDescriptor, outDescriptor, errDescriptor, redirectErrorStream);
- // Temporarily clear exception so we can clean up.
- jthrowable exception = env->ExceptionOccurred();
- env->ExceptionClear();
-
- freeStrings(env, javaEnvironment, environment);
-
// Clean up working directory string.
if (javaWorkingDirectory != NULL) {
env->ReleaseStringUTFChars(javaWorkingDirectory, workingDirectory);
}
- freeStrings(env, javaCommands, commands);
-
- // Re-throw exception if present.
- if (exception != NULL) {
- if (env->Throw(exception) < 0) {
- ALOGE("Error rethrowing exception!");
- }
- }
-
return result;
}