From a031787eced0bc6b17ef8bd98d0b0cc7b755b0a9 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Sat, 3 May 2014 07:37:52 -0500 Subject: [PATCH] switch from URI to Paths --- .../src/main/java/brut/androlib/Androlib.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java index a566e1b5..2ab94739 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java @@ -560,31 +560,28 @@ public class Androlib { // create filesystem Path path = Paths.get(outFile.getAbsolutePath()); - URI apkFileSystem = new URI("jar", outFile.toURI().toString(), null); // loop through files inside for (Map.Entry entry : files.entrySet()) { file = new File(mPath.toFile(), entry.getKey()); if (file.isFile() && file.exists()) { - insertFolder(apkFileSystem, zip_properties, file.getParentFile(), entry.getValue(), mPath.toAbsolutePath()); - insertFile(apkFileSystem, zip_properties, file, entry.getValue(), mPath.toAbsolutePath()); + insertFolder(path, zip_properties, file.getParentFile(), entry.getValue(), mPath.toAbsolutePath()); + insertFile(path, zip_properties, file, entry.getValue(), mPath.toAbsolutePath()); } } } catch (IOException ex) { throw new AndrolibException(ex); - } catch (URISyntaxException ex) { - throw new AndrolibException(ex); } } } - private void insertFile(URI apkFileSystem, Map zip_properties, File insert, String method, Path location) + private void insertFile(Path apkPath, Map zip_properties, File insert, String method, Path location) throws AndrolibException, IOException { // ZipFileSystem only writes at .close() // http://mail.openjdk.java.net/pipermail/nio-dev/2012-July/001764.html - try(FileSystem fs = FileSystems.newFileSystem(apkFileSystem, zip_properties)) { + try(FileSystem fs = FileSystems.newFileSystem(apkPath, null)) { Path root = fs.getPath("/"); @@ -597,10 +594,10 @@ public class Androlib { } } - private void insertFolder(URI apkFileSystem, Map zip_properties, File insert, String method, Path location) + private void insertFolder(Path apkPath, Map zip_properties, File insert, String method, Path location) throws AndrolibException, IOException { - try(FileSystem fs = FileSystems.newFileSystem(apkFileSystem, zip_properties)) { + try(FileSystem fs = FileSystems.newFileSystem(apkPath, null)) { Path root = fs.getPath("/"); Path dest = fs.getPath(root.toString(), insert.getAbsolutePath().replace(location.toString(),""));