read table
not refusing to overwrite.


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@289 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 32cb2027e5
commit 4f9f2e09c3
  1. 31
      jode/jode/obfuscator/PackageIdentifier.java

@ -222,15 +222,25 @@ public class PackageIdentifier extends Identifier {
} }
} }
public void writeTable(PrintWriter out) throws IOException { public void readTable(Hashtable table) {
if (parent != null && getName() != getAlias()) if (parent != null)
out.println("" + parent.getFullAlias() + getAlias() setAlias((String) table.get(parent.getFullName() + getName()));
+ " = " + getName()); Enumeration enum = loadedClasses.elements();
while (enum.hasMoreElements()) {
Identifier ident = (Identifier) enum.nextElement();
if (!Obfuscator.shouldStrip || ident.isReachable())
ident.readTable(table);
}
}
public void writeTable(Hashtable table) {
if (parent != null)
table.put(parent.getFullAlias() + getAlias(), getName());
Enumeration enum = loadedClasses.elements(); Enumeration enum = loadedClasses.elements();
while (enum.hasMoreElements()) { while (enum.hasMoreElements()) {
Identifier ident = (Identifier) enum.nextElement(); Identifier ident = (Identifier) enum.nextElement();
if (!Obfuscator.shouldStrip || ident.isReachable()) if (!Obfuscator.shouldStrip || ident.isReachable())
ident.writeTable(out); ident.writeTable(table);
} }
} }
@ -269,11 +279,12 @@ public class PackageIdentifier extends Identifier {
else { else {
try { try {
File file = new File(newDest, ident.getAlias()+".class"); File file = new File(newDest, ident.getAlias()+".class");
if (file.exists()) { // if (file.exists()) {
Obfuscator.err.println // Obfuscator.err.println
("Refuse to overwrite existing class file " // ("Refuse to overwrite existing class file "
+file.getPath()+". Remove it first."); // +file.getPath()+". Remove it first.");
} // return;
// }
DataOutputStream out = new DataOutputStream DataOutputStream out = new DataOutputStream
(new FileOutputStream(file)); (new FileOutputStream(file));
((ClassIdentifier) ident).storeClass(out); ((ClassIdentifier) ident).storeClass(out);

Loading…
Cancel
Save