diff options
author | Ian Rogers <irogers@google.com> | 2013-10-13 10:44:14 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2013-10-21 17:01:11 -0700 |
commit | 8d31bbd3d6536de12bc20e3d29cfe03fe848f9da (patch) | |
tree | 2373ae08ddddaf1034623df85d647ecf9ac6c831 /runtime/zip_archive.h | |
parent | 57e6d8a99058e5c74d5244b68a5f4d53526fa108 (diff) | |
download | art-8d31bbd3d6536de12bc20e3d29cfe03fe848f9da.tar.gz art-8d31bbd3d6536de12bc20e3d29cfe03fe848f9da.tar.bz2 art-8d31bbd3d6536de12bc20e3d29cfe03fe848f9da.zip |
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/zip_archive.h')
-rw-r--r-- | runtime/zip_archive.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/runtime/zip_archive.h b/runtime/zip_archive.h index d9ccba2cce..8ff952baab 100644 --- a/runtime/zip_archive.h +++ b/runtime/zip_archive.h @@ -19,6 +19,7 @@ #include <stdint.h> #include <zlib.h> +#include <string> #include "base/logging.h" #include "base/stringpiece.h" @@ -36,9 +37,9 @@ class MemMap; class ZipEntry { public: - bool ExtractToFile(File& file); - bool ExtractToMemory(uint8_t* begin, size_t size); - MemMap* ExtractToMemMap(const char* entry_filename); + bool ExtractToFile(File& file, std::string* error_msg); + bool ExtractToMemory(uint8_t* begin, size_t size, std::string* error_msg); + MemMap* ExtractToMemMap(const char* entry_filename, std::string* error_msg); uint32_t GetUncompressedLength(); uint32_t GetCrc32(); @@ -109,8 +110,8 @@ class ZipArchive { static const int32_t kGPFUnsupportedMask = (kGPFEncryptedFlag); // return new ZipArchive instance on success, NULL on error. - static ZipArchive* Open(const std::string& filename); - static ZipArchive* OpenFromFd(int fd); + static ZipArchive* Open(const char* filename, std::string* error_msg); + static ZipArchive* OpenFromFd(int fd, const char* filename, std::string* error_msg); ZipEntry* Find(const char* name) const; @@ -119,11 +120,14 @@ class ZipArchive { } private: - explicit ZipArchive(int fd) : fd_(fd), num_entries_(0), dir_offset_(0) {} + explicit ZipArchive(int fd, const char* filename) + : fd_(fd), num_entries_(0), dir_offset_(0), filename_(filename) {} - bool MapCentralDirectory(); - bool Parse(); + bool MapCentralDirectory(std::string* error_msg); + bool Parse(std::string* error_msg); void Close(); + std::string ErrorStringPrintf(const char* fmt, ...) + __attribute__((__format__(__printf__, 2, 3))) COLD_ATTR; int fd_; uint16_t num_entries_; @@ -131,6 +135,8 @@ class ZipArchive { UniquePtr<MemMap> dir_map_; typedef SafeMap<StringPiece, const byte*> DirEntries; DirEntries dir_entries_; + // Containing file for error reporting. + const std::string filename_; friend class ZipEntry; |