From 4f9f2e09c347e0d65c69afbc6ca4c1649a79692a Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 19 Feb 1999 13:12:29 +0000 Subject: [PATCH] bug fixes read table not refusing to overwrite. git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@289 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/obfuscator/PackageIdentifier.java | 33 ++++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/jode/jode/obfuscator/PackageIdentifier.java b/jode/jode/obfuscator/PackageIdentifier.java index be5a536..b96cdff 100644 --- a/jode/jode/obfuscator/PackageIdentifier.java +++ b/jode/jode/obfuscator/PackageIdentifier.java @@ -73,7 +73,7 @@ public class PackageIdentifier extends Identifier { loadedClasses.put(name, ident); } else if (!ClassInfo.exists(fullname)) { throw new IllegalArgumentException - ("Can't find class"+fullname); + ("Can't find class "+fullname); } else { ident = new ClassIdentifier(bundle, this, name, ClassInfo.forName(fullname)); @@ -222,15 +222,25 @@ public class PackageIdentifier extends Identifier { } } - public void writeTable(PrintWriter out) throws IOException { - if (parent != null && getName() != getAlias()) - out.println("" + parent.getFullAlias() + getAlias() - + " = " + getName()); + public void readTable(Hashtable table) { + if (parent != null) + setAlias((String) table.get(parent.getFullName() + 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(); while (enum.hasMoreElements()) { Identifier ident = (Identifier) enum.nextElement(); if (!Obfuscator.shouldStrip || ident.isReachable()) - ident.writeTable(out); + ident.writeTable(table); } } @@ -269,11 +279,12 @@ public class PackageIdentifier extends Identifier { else { try { File file = new File(newDest, ident.getAlias()+".class"); - if (file.exists()) { - Obfuscator.err.println - ("Refuse to overwrite existing class file " - +file.getPath()+". Remove it first."); - } +// if (file.exists()) { +// Obfuscator.err.println +// ("Refuse to overwrite existing class file " +// +file.getPath()+". Remove it first."); +// return; +// } DataOutputStream out = new DataOutputStream (new FileOutputStream(file)); ((ClassIdentifier) ident).storeClass(out);