Remove dex2oat warnings by providing "." class path defaulting only to JNI callers

Change-Id: Ibc532b4a6e72ad92d7b537896447949a2a764166
diff --git a/src/dalvik_system_VMRuntime.cc b/src/dalvik_system_VMRuntime.cc
index 5dcbb41..76da622 100644
--- a/src/dalvik_system_VMRuntime.cc
+++ b/src/dalvik_system_VMRuntime.cc
@@ -98,12 +98,21 @@
   return toStringArray(env, Runtime::Current()->GetProperties());
 }
 
+// This is for backward compatibility with dalvik which returned the
+// meaningless "." when no boot classpath or classpath was
+// specified. Unfortunately, some tests were using java.class.path to
+// lookup relative file locations, so they are counting on this to be
+// ".", presumably some applications or libraries could have as well.
+const char* DefaultToDot(const std::string& class_path) {
+  return class_path.empty() ? "." : class_path.c_str();
+}
+
 jstring VMRuntime_bootClassPath(JNIEnv* env, jobject) {
-  return env->NewStringUTF(Runtime::Current()->GetBootClassPath().c_str());
+  return env->NewStringUTF(DefaultToDot(Runtime::Current()->GetBootClassPath()));
 }
 
 jstring VMRuntime_classPath(JNIEnv* env, jobject) {
-  return env->NewStringUTF(Runtime::Current()->GetClassPath().c_str());
+  return env->NewStringUTF(DefaultToDot(Runtime::Current()->GetClassPath()));
 }
 
 jstring VMRuntime_vmVersion(JNIEnv* env, jobject) {
diff --git a/src/runtime.cc b/src/runtime.cc
index 726b30c..6cb874f 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -259,14 +259,10 @@
   const char* boot_class_path = getenv("BOOTCLASSPATH");
   if (boot_class_path != NULL) {
     parsed->boot_class_path_ = boot_class_path;
-  } else {
-    parsed->boot_class_path_ = ".";
   }
   const char* class_path = getenv("CLASSPATH");
   if (class_path != NULL) {
     parsed->class_path_ = class_path;
-  } else {
-    parsed->class_path_ = ".";
   }
 #ifdef NDEBUG
   // -Xcheck:jni is off by default for regular builds...