ART: Account for multidex location strings in VMClassLoader

To look up resources, look in the unadorned location.

Bug: 16530747
Change-Id: Ia97e39366444f6666a78ade7298d3c22b4b79f8a
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
index f2b8a03..fefddae 100644
--- a/runtime/native/java_lang_VMClassLoader.cc
+++ b/runtime/native/java_lang_VMClassLoader.cc
@@ -62,25 +62,28 @@
  */
 static jstring VMClassLoader_getBootClassPathResource(JNIEnv* env, jclass, jstring javaName, jint index) {
   ScopedUtfChars name(env, javaName);
-  if (name.c_str() == NULL) {
-    return NULL;
+  if (name.c_str() == nullptr) {
+    return nullptr;
   }
 
   const std::vector<const DexFile*>& path = Runtime::Current()->GetClassLinker()->GetBootClassPath();
   if (index < 0 || size_t(index) >= path.size()) {
-    return NULL;
+    return nullptr;
   }
   const DexFile* dex_file = path[index];
-  const std::string& location(dex_file->GetLocation());
+
+  // For multidex locations, e.g., x.jar:classes2.dex, we want to look into x.jar.
+  const std::string& location(dex_file->GetBaseLocation());
+
   std::string error_msg;
   std::unique_ptr<ZipArchive> zip_archive(ZipArchive::Open(location.c_str(), &error_msg));
   if (zip_archive.get() == nullptr) {
     LOG(WARNING) << "Failed to open zip archive '" << location << "': " << error_msg;
-    return NULL;
+    return nullptr;
   }
   std::unique_ptr<ZipEntry> zip_entry(zip_archive->Find(name.c_str(), &error_msg));
-  if (zip_entry.get() == NULL) {
-    return NULL;
+  if (zip_entry.get() == nullptr) {
+    return nullptr;
   }
 
   std::string url;