Do not use Paths.get on ZipEntry names.
Paths.get uses the system encoding to encode all strings. Therefore,
if the system encoding is not UTF-8 we get in trouble.
R=sgjesse@google.com, zerny@google.com
Bug: 109992855
Change-Id: Ie460f08e1c2862f43eef97dc7a80313a73ae079f
diff --git a/src/test/apiUsageSample/com/android/tools/apiusagesample/R8ApiUsageSample.java b/src/test/apiUsageSample/com/android/tools/apiusagesample/R8ApiUsageSample.java
index 2c2e8d7..7bce10a 100644
--- a/src/test/apiUsageSample/com/android/tools/apiusagesample/R8ApiUsageSample.java
+++ b/src/test/apiUsageSample/com/android/tools/apiusagesample/R8ApiUsageSample.java
@@ -382,8 +382,9 @@
ZipInputStream zip = new ZipInputStream(Files.newInputStream(file), StandardCharsets.UTF_8);
ZipEntry entry;
while (null != (entry = zip.getNextEntry())) {
- if (isClassFile(Paths.get(entry.getName()))) {
- Origin origin = new ArchiveEntryOrigin(entry.getName(), zipOrigin);
+ String name = entry.getName();
+ if (isClassFile(name)) {
+ Origin origin = new ArchiveEntryOrigin(name, zipOrigin);
classfiles.add(new ClassFileContent(origin, readBytes(zip)));
}
}