Snap for 7375516 from 5a8e56d80b9abe91e706cd272cfba9cccc35dd5f to sc-release
Change-Id: I0224b86762bb3388e57567c3eaf41d1e74cc6ae4
diff --git a/java/android/compat/testing/Classpaths.java b/java/android/compat/testing/Classpaths.java
index 406176e..3b4efd0 100644
--- a/java/android/compat/testing/Classpaths.java
+++ b/java/android/compat/testing/Classpaths.java
@@ -19,7 +19,7 @@
import static com.google.common.truth.Truth.assertThat;
import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.device.INativeDevice;
import com.android.tradefed.util.CommandResult;
import com.android.tradefed.util.CommandStatus;
import com.android.tradefed.util.FileUtil;
@@ -52,7 +52,7 @@
}
/** Returns on device filepaths to the jars that are part of a given classpath. */
- public static ImmutableList<String> getJarsOnClasspath(ITestDevice device,
+ public static ImmutableList<String> getJarsOnClasspath(INativeDevice device,
ClasspathType classpath) throws DeviceNotAvailableException {
CommandResult shellResult = device.executeShellV2Command("echo $" + classpath);
assertThat(shellResult.getStatus()).isEqualTo(CommandStatus.SUCCESS);
@@ -64,11 +64,14 @@
}
/** Returns classes defined a given jar file on the test device. */
- public static ImmutableSet<ClassDef> getClassDefsFromJar(ITestDevice device,
+ public static ImmutableSet<ClassDef> getClassDefsFromJar(INativeDevice device,
String remoteJarPath) throws DeviceNotAvailableException, IOException {
File jar = null;
try {
- jar = Objects.requireNonNull(device.pullFile(remoteJarPath));
+ jar = device.pullFile(remoteJarPath);
+ if (jar == null) {
+ throw new IllegalStateException("could not pull remote file " + remoteJarPath);
+ }
MultiDexContainer<? extends DexBackedDexFile> container =
DexFileFactory.loadDexContainer(jar, Opcodes.getDefault());
ImmutableSet.Builder<ClassDef> set = ImmutableSet.builder();