Permalink
Browse files

Include library path information in BaseDexClassLoader for better err…

…or reporting in Runtime.loadLibrary

(cherry-pick of b6a576f43f1c23bb92493590a04bf9c72f092438.)

Change-Id: I6f34862327cf99d8c6f9a7e9aa3aeab47985969b
  • Loading branch information...
1 parent 8438df1 commit 75245fcfe3555e4dd06939b9bae366fd3e43b658 @bdcgoogle bdcgoogle committed with enh Apr 2, 2012
@@ -28,6 +28,9 @@
/** originally specified path (just used for {@code toString()}) */
private final String originalPath;
+ /** originally specified library path (just used for {@code toString()}) */
+ private final String originalLibraryPath;
+
/** structured lists of path elements */
private final DexPathList pathList;
@@ -49,6 +52,7 @@ public BaseDexClassLoader(String dexPath, File optimizedDirectory,
super(parent);
this.originalPath = dexPath;
+ this.originalLibraryPath = libraryPath;
this.pathList =
new DexPathList(this, dexPath, libraryPath, optimizedDirectory);
}
@@ -123,6 +127,7 @@ protected synchronized Package getPackage(String name) {
@Override
public String toString() {
- return getClass().getName() + "[" + originalPath + "]";
+ return getClass().getName()
+ + "[dexPath=" + originalPath + ",libraryPath=" + originalLibraryPath + "]";
}
}
@@ -362,8 +362,9 @@ void loadLibrary(String libraryName, ClassLoader loader) {
if (loader != null) {
String filename = loader.findLibrary(libraryName);
if (filename == null) {
- throw new UnsatisfiedLinkError("Couldn't load " + libraryName + ": " +
- "findLibrary returned null");
+ throw new UnsatisfiedLinkError("Couldn't load " + libraryName
+ + " from loader " + loader
+ + ": findLibrary returned null");
}
String error = nativeLoad(filename, loader);
if (error != null) {

0 comments on commit 75245fc

Please sign in to comment.