Revert "resolved conflicts for merge of ad93c622 to master"

This reverts commit 4f6a77d529ae295630e22d4636c2acc2ba2fbb6d, reversing
changes made to bcdbbfebc8f32566d4cb3f66405e89cdb7351992.
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 9631e2d..5b0653e 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -419,9 +419,10 @@
   return true;
 }
 
-static void OpenDexFiles(const std::vector<const char*>& dex_filenames,
-                         const std::vector<const char*>& dex_locations,
-                         std::vector<const DexFile*>& dex_files) {
+static size_t OpenDexFiles(const std::vector<const char*>& dex_filenames,
+                           const std::vector<const char*>& dex_locations,
+                           std::vector<const DexFile*>& dex_files) {
+  size_t failure_count = 0;
   for (size_t i = 0; i < dex_filenames.size(); i++) {
     const char* dex_filename = dex_filenames[i];
     const char* dex_location = dex_locations[i];
@@ -429,10 +430,12 @@
     const DexFile* dex_file = DexFile::Open(dex_filename, dex_location, &error_msg);
     if (dex_file == NULL) {
       LOG(WARNING) << "Failed to open .dex from file '" << dex_filename << "': " << error_msg;
+      ++failure_count;
     } else {
       dex_files.push_back(dex_file);
     }
   }
+  return failure_count;
 }
 
 // The primary goal of the watchdog is to prevent stuck build servers
@@ -892,7 +895,11 @@
   options.push_back(std::make_pair("compiler", reinterpret_cast<void*>(NULL)));
   std::vector<const DexFile*> boot_class_path;
   if (boot_image_option.empty()) {
-    OpenDexFiles(dex_filenames, dex_locations, boot_class_path);
+    size_t failure_count = OpenDexFiles(dex_filenames, dex_locations, boot_class_path);
+    if (failure_count > 0) {
+      LOG(ERROR) << "Failed to open some dex files: " << failure_count;
+      return EXIT_FAILURE;
+    }
     options.push_back(std::make_pair("bootclasspath", &boot_class_path));
   } else {
     options.push_back(std::make_pair(boot_image_option.c_str(), reinterpret_cast<void*>(NULL)));
@@ -964,7 +971,11 @@
       }
       dex_files.push_back(dex_file);
     } else {
-      OpenDexFiles(dex_filenames, dex_locations, dex_files);
+      size_t failure_count = OpenDexFiles(dex_filenames, dex_locations, dex_files);
+      if (failure_count > 0) {
+        LOG(ERROR) << "Failed to open some dex files: " << failure_count;
+        return EXIT_FAILURE;
+      }
     }
 
     // Ensure opened dex files are writable for dex-to-dex transformations.