RMMSecurity / dex2jar

Automatically exported from code.google.com/p/dex2jar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

d2j-decrpyt-strings.sh fails to work if it has to create directories in output jar

GoogleCodeExporter opened this issue · comments

The problem is in jar-rename/src/main/java/p/rn/util/FileOut.java

The relevant code is:

112         public void write(boolean isDir, String name, InputStream is, 
Object nameObject) throws IOException {
113             ZipEntry ze = buildEntry(name, nameObject);
114             if ( ze == null ) return; // we got null, so this was a 
directory and check() created it for us
115 
116             zos.putNextEntry(ze);
117             if (!isDir) {
118                 IOUtils.copy(is, zos);
119             }
120             zos.closeEntry();
121         }
122 
123         private ZipEntry buildEntry(String name, Object nameObject) throws 
IOException {
124             int i = name.lastIndexOf('/');
125             if (i > 0) {
126                 check(name.substring(0, i));
127                 if ( i == name.length() - 1 ) {
128                         // checked dirs, they're already created. don't 
create more!
129                         // return null here so calling code wont try to 
create entry
130                         return null;
131                 }
132             }
133             if (nameObject instanceof ZipEntry) {
134                 ZipEntry ze = (ZipEntry) nameObject;
135                 if (name.equals(ze.getName())) {
136                     ZipEntry nZe = new ZipEntry(name);
137                     nZe.setComment(ze.getComment());
138                     nZe.setTime(ze.getTime());
139                     return nZe;

There is probably a cleaner way to fix this, but I am unfamiliar with the code 
and hacked this out in 5 minutes.

Original issue reported on code.google.com by tekpr...@gmail.com on 28 Dec 2012 at 10:07