ART: Fix GetSystemProperty
Align with VMRuntime.getClassPath to emit "." for an empty path.
Bug: 31455788
Test: manual
Change-Id: Iaf828034d414f45c20960ab6fd0ceb598362c6f1
diff --git a/runtime/openjdkjvmti/ti_properties.cc b/runtime/openjdkjvmti/ti_properties.cc
index 4f4f013..fd67c59 100644
--- a/runtime/openjdkjvmti/ti_properties.cc
+++ b/runtime/openjdkjvmti/ti_properties.cc
@@ -145,6 +145,11 @@
return result;
}
+// See dalvik_system_VMRuntime.cpp.
+static const char* DefaultToDot(const std::string& class_path) {
+ return class_path.empty() ? "." : class_path.c_str();
+}
+
jvmtiError PropertiesUtil::GetSystemProperty(jvmtiEnv* env,
const char* property,
char** value_ptr) {
@@ -168,7 +173,7 @@
}
if (strcmp(property, kPropertyClassPath) == 0) {
- return Copy(env, art::Runtime::Current()->GetClassPathString().c_str(), value_ptr);
+ return Copy(env, DefaultToDot(art::Runtime::Current()->GetClassPathString()), value_ptr);
}
for (size_t i = 0; i != kPropertiesSize; ++i) {