diff options
author | 2013-10-13 10:44:14 -0700 | |
---|---|---|
committer | 2013-10-21 17:01:11 -0700 | |
commit | 8d31bbd3d6536de12bc20e3d29cfe03fe848f9da (patch) | |
tree | 2373ae08ddddaf1034623df85d647ecf9ac6c831 /runtime/class_linker.h | |
parent | 57e6d8a99058e5c74d5244b68a5f4d53526fa108 (diff) |
Throw IOException at source of failing to open a dex file.
Before is:
java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
Suppressed: java.lang.ClassNotFoundException: GCBench
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 1 more
Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found
... 5 more
And after is:
java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
Suppressed: java.io.IOException: Zip archive '/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar' doesn't contain classes.dex
at dalvik.system.DexFile.openDexFile(Native Method)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexFile.<init>(DexFile.java:59)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:268)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:235)
at dalvik.system.DexPathList.<init>(DexPathList.java:113)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:38)
at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:128)
at java.lang.ClassLoader.access$000(ClassLoader.java:65)
at java.lang.ClassLoader$SystemClassLoader.<clinit>(ClassLoader.java:81)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:137)
Suppressed: java.lang.ClassNotFoundException: GCBench
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 1 more
Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found
... 5 more
Also, move dex file verifier messages out of logs.
In the process the ClassLinker::dex_lock_ needed tidying to cover a smaller
scope. Bug 11301553.
Change-Id: I80058652e11e7ea63457cc01a0cb48afe1c15543
Diffstat (limited to 'runtime/class_linker.h')
-rw-r--r-- | runtime/class_linker.h | 66 |
1 files changed, 29 insertions, 37 deletions
diff --git a/runtime/class_linker.h b/runtime/class_linker.h index 11ba78b36a..0bc1b5f444 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -215,7 +215,7 @@ class ClassLinker { LOCKS_EXCLUDED(dex_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void RegisterOatFile(const OatFile& oat_file) + const OatFile* RegisterOatFile(const OatFile* oat_file) LOCKS_EXCLUDED(dex_lock_); const std::vector<const DexFile*>& GetBootClassPath() { @@ -244,43 +244,37 @@ class ClassLinker { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Generate an oat file from a dex file - bool GenerateOatFile(const std::string& dex_filename, + bool GenerateOatFile(const char* dex_filename, int oat_fd, - const std::string& oat_cache_filename); + const char* oat_cache_filename); + LOCKS_EXCLUDED(Locks::mutator_lock_); - const OatFile* FindOatFileFromOatLocation(const std::string& location) + const OatFile* FindOatFileFromOatLocation(const std::string& location, + std::string* error_msg) LOCKS_EXCLUDED(dex_lock_); - const OatFile* FindOatFileFromOatLocationLocked(const std::string& location) - SHARED_LOCKS_REQUIRED(dex_lock_); - // Finds the oat file for a dex location, generating the oat file if // it is missing or out of date. Returns the DexFile from within the // created oat file. - const DexFile* FindOrCreateOatFileForDexLocation(const std::string& dex_location, + const DexFile* FindOrCreateOatFileForDexLocation(const char* dex_location, uint32_t dex_location_checksum, - const std::string& oat_location) - LOCKS_EXCLUDED(dex_lock_) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - const DexFile* FindOrCreateOatFileForDexLocationLocked(const std::string& dex_location, - uint32_t dex_location_checksum, - const std::string& oat_location) - EXCLUSIVE_LOCKS_REQUIRED(dex_lock_) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + const char* oat_location, + std::string* error_msg) + LOCKS_EXCLUDED(dex_lock_, Locks::mutator_lock_); // Find a DexFile within an OatFile given a DexFile location. Note // that this returns null if the location checksum of the DexFile // does not match the OatFile. - const DexFile* FindDexFileInOatFileFromDexLocation(const std::string& location, - uint32_t location_checksum) - LOCKS_EXCLUDED(dex_lock_) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + const DexFile* FindDexFileInOatFileFromDexLocation(const char* location, + uint32_t location_checksum, + std::string* error_msg) + LOCKS_EXCLUDED(dex_lock_, Locks::mutator_lock_); // Returns true if oat file contains the dex file with the given location and checksum. static bool VerifyOatFileChecksums(const OatFile* oat_file, - const std::string& dex_location, - uint32_t dex_location_checksum) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + const char* dex_location, + uint32_t dex_location_checksum, + std::string* error_msg); // TODO: replace this with multiple methods that allocate the correct managed type. template <class T> @@ -430,8 +424,6 @@ class ClassLinker { EXCLUSIVE_LOCKS_REQUIRED(dex_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool IsDexFileRegisteredLocked(const DexFile& dex_file) const SHARED_LOCKS_REQUIRED(dex_lock_); - void RegisterOatFileLocked(const OatFile& oat_file) EXCLUSIVE_LOCKS_REQUIRED(dex_lock_) - EXCLUSIVE_LOCKS_REQUIRED(dex_lock_); bool InitializeClass(mirror::Class* klass, bool can_run_clinit, bool can_init_parents) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -493,22 +485,22 @@ class ClassLinker { const OatFile* FindOpenedOatFileForDexFile(const DexFile& dex_file) LOCKS_EXCLUDED(dex_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - const OatFile* FindOpenedOatFileFromDexLocation(const std::string& dex_location, + const OatFile* FindOpenedOatFileFromDexLocation(const char* dex_location, uint32_t dex_location_checksum) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, dex_lock_); + LOCKS_EXCLUDED(dex_lock); const OatFile* FindOpenedOatFileFromOatLocation(const std::string& oat_location) - SHARED_LOCKS_REQUIRED(dex_lock_); - const DexFile* FindDexFileInOatLocation(const std::string& dex_location, + LOCKS_EXCLUDED(dex_lock_); + const DexFile* FindDexFileInOatLocation(const char* dex_location, uint32_t dex_location_checksum, - const std::string& oat_location) - EXCLUSIVE_LOCKS_REQUIRED(dex_lock_) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + const char* oat_location, + std::string* error_msg) + LOCKS_EXCLUDED(dex_lock_); - const DexFile* VerifyAndOpenDexFileFromOatFile(const OatFile* oat_file, - const std::string& dex_location, - uint32_t dex_location_checksum) - EXCLUSIVE_LOCKS_REQUIRED(dex_lock_) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + const DexFile* VerifyAndOpenDexFileFromOatFile(const std::string& oat_file_location, + const char* dex_location, + std::string* error_msg, + bool* open_failed) + LOCKS_EXCLUDED(dex_lock_); mirror::ArtMethod* CreateProxyConstructor(Thread* self, SirtRef<mirror::Class>& klass, mirror::Class* proxy_class) |