summaryrefslogtreecommitdiff
path: root/runtime/java_vm_ext.h
diff options
context:
space:
mode:
author Richard Uhler <ruhler@google.com> 2016-10-11 15:06:38 +0100
committer Richard Uhler <ruhler@google.com> 2016-10-19 16:37:47 +0100
commitda0a69edb24122d3d35ce1483c5ab94de919d714 (patch)
tree7216e6a19b1a9f3ca9da28d61c717ad9086d994e /runtime/java_vm_ext.h
parent278ec18934045477f0340b4aa6564f003a1e190d (diff)
Return error message if IndirectReferenceTable construction fails.
Previously if there was an error when constructing the IndirectReferenceTable, the error message was lost. Now expose and include the error message when throwing an exception related to failures to construct the IndirectReferenceTable. The error message is propagated through JVMEnvExt, JavaVMExt, and Runtime::Init as well. Bug: 32013594 Test: Added new 151-OpenFileLimit runtest. Test: m test-art-host, m test-art-target Change-Id: I3692f6928c9570358571bce634569d6f14cdeb05
Diffstat (limited to 'runtime/java_vm_ext.h')
-rw-r--r--runtime/java_vm_ext.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/runtime/java_vm_ext.h b/runtime/java_vm_ext.h
index 05717f41e7..9e37f1178c 100644
--- a/runtime/java_vm_ext.h
+++ b/runtime/java_vm_ext.h
@@ -43,7 +43,14 @@ using GetEnvHook = jint (*)(JavaVMExt* vm, /*out*/void** new_env, jint version);
class JavaVMExt : public JavaVM {
public:
- JavaVMExt(Runtime* runtime, const RuntimeArgumentMap& runtime_options);
+ // Creates a new JavaVMExt object.
+ // Returns nullptr on error, in which case error_msg is set to a message
+ // describing the error.
+ static std::unique_ptr<JavaVMExt> Create(Runtime* runtime,
+ const RuntimeArgumentMap& runtime_options,
+ std::string* error_msg);
+
+
~JavaVMExt();
bool ForceCopy() const {
@@ -192,6 +199,10 @@ class JavaVMExt : public JavaVM {
static bool IsBadJniVersion(int version);
private:
+ // The constructor should not be called directly. It may leave the object in
+ // an erroneous state, and the result needs to be checked.
+ JavaVMExt(Runtime* runtime, const RuntimeArgumentMap& runtime_options, std::string* error_msg);
+
// Return true if self can currently access weak globals.
bool MayAccessWeakGlobalsUnlocked(Thread* self) const REQUIRES_SHARED(Locks::mutator_lock_);
bool MayAccessWeakGlobals(Thread* self) const