Bug fixes from Joe Bronkema.

git-svn-id: https://svn.code.sf.net/p/jode/code/branches/branch_1_1@1311 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
hoenicke 24 years ago
parent b355dc3395
commit 95b75fa705
  1. 11
      jode/ChangeLog
  2. 8
      jode/THANKS
  3. 35
      jode/jode/bytecode/SearchPath.java

@ -1,9 +1,18 @@
2001-04-09 Jochen Hoenicke <jochen@gnu.org>
* jode/bytecode/SearchPath.java: Bug fixes from Joe Bronkema:
(exists): Don't replace '/' with fileSeparator in original
filename; make a copy instead.
(getFile): likewise.
(isDirectory): likewise.
(listFiles): Reset fileNr when a new directory is read.
2001-02-28 Jochen Hoenicke <jochen@gnu.org> 2001-02-28 Jochen Hoenicke <jochen@gnu.org>
* acinclude.m4 (JODE_CHECK_CLASS): Changed "test -e" to "-f" since * acinclude.m4 (JODE_CHECK_CLASS): Changed "test -e" to "-f" since
-e is not supported on all architectures (Solaris) and -f is more -e is not supported on all architectures (Solaris) and -f is more
correct anyway. correct anyway.
Reported by Erik Modén <Erik.Moden@emw.ericsson.se>. Reported by Erik Modén.
2001-02-27 Jochen Hoenicke <jochen@gnu.org> 2001-02-27 Jochen Hoenicke <jochen@gnu.org>

@ -1,3 +1,5 @@
Rolf Howarth <rolf@squarebox.co.uk> for pascal indentaton style. Joe Bronkema <joseph.d.bronkema at lmco.com>
Martin Schmitz <m.schmitz@e-sign.com> for finding many bugs in the obfuscator. Rolf Howarth <rolf at squarebox.co.uk> for pascal indentaton style.
zzzeek <classic@io.com> Erik Modén <Erik.Moden at emw.ericsson.se>
Martin Schmitz <m.schmitz at e-sign.com> for finding many bugs in the obfuscator.
zzzeek <classic at io.com>

@ -309,6 +309,10 @@ public class SearchPath {
} }
public boolean exists(String filename) { public boolean exists(String filename) {
String localFileName =
(java.io.File.separatorChar != '/')
? filename.replace('/', java.io.File.separatorChar)
: filename;
for (int i=0; i<dirs.length; i++) { for (int i=0; i<dirs.length; i++) {
if (zipEntries[i] != null) { if (zipEntries[i] != null) {
if (zipEntries[i].get(filename) != null) if (zipEntries[i].get(filename) != null)
@ -347,11 +351,8 @@ public class SearchPath {
if (ze != null) if (ze != null)
return true; return true;
} else { } else {
if (java.io.File.separatorChar != '/')
filename = filename
.replace('/', java.io.File.separatorChar);
try { try {
File f = new File(dirs[i], filename); File f = new File(dirs[i], localFileName);
if (f.exists()) if (f.exists())
return true; return true;
} catch (SecurityException ex) { } catch (SecurityException ex) {
@ -369,6 +370,10 @@ public class SearchPath {
* @return An InputStream for the file. * @return An InputStream for the file.
*/ */
public InputStream getFile(String filename) throws IOException { public InputStream getFile(String filename) throws IOException {
String localFileName =
(java.io.File.separatorChar != '/')
? filename.replace('/', java.io.File.separatorChar)
: filename;
for (int i=0; i<dirs.length; i++) { for (int i=0; i<dirs.length; i++) {
if (urlzips[i] != null) { if (urlzips[i] != null) {
ZipInputStream zis = new ZipInputStream ZipInputStream zis = new ZipInputStream
@ -431,17 +436,14 @@ public class SearchPath {
if (ze != null) if (ze != null)
return zips[i].getInputStream(ze); return zips[i].getInputStream(ze);
} else { } else {
if (java.io.File.separatorChar != '/')
filename = filename
.replace('/', java.io.File.separatorChar);
try { try {
File f = new File(dirs[i], filename); File f = new File(dirs[i], localFileName);
if (f.exists()) if (f.exists())
return new FileInputStream(f); return new FileInputStream(f);
} catch (SecurityException ex) { } catch (SecurityException ex) {
GlobalOptions.err.println("Warning: SecurityException" GlobalOptions.err.println("Warning: SecurityException"
+ " while accessing " + " while accessing "
+dirs[i]+filename); + dirs[i] + localFileName);
/* ignore and take next element */ /* ignore and take next element */
} }
} }
@ -457,6 +459,10 @@ public class SearchPath {
* @return true, if filename exists and is a directory, false otherwise. * @return true, if filename exists and is a directory, false otherwise.
*/ */
public boolean isDirectory(String filename) { public boolean isDirectory(String filename) {
String localFileName =
(java.io.File.separatorChar != '/')
? filename.replace('/', java.io.File.separatorChar)
: filename;
for (int i=0; i<dirs.length; i++) { for (int i=0; i<dirs.length; i++) {
if (dirs[i] == null) if (dirs[i] == null)
continue; continue;
@ -467,17 +473,14 @@ public class SearchPath {
if (zipEntries[i].containsKey(filename)) if (zipEntries[i].containsKey(filename))
return true; return true;
} else { } else {
if (java.io.File.separatorChar != '/')
filename = filename
.replace('/', java.io.File.separatorChar);
try { try {
File f = new File(dirs[i], filename); File f = new File(dirs[i], localFileName);
if (f.exists()) if (f.exists())
return f.isDirectory(); return f.isDirectory();
} catch (SecurityException ex) { } catch (SecurityException ex) {
GlobalOptions.err.println("Warning: SecurityException" GlobalOptions.err.println("Warning: SecurityException"
+ " while accessing " + " while accessing "
+dirs[i]+filename); + dirs[i] + localFileName);
} }
} }
} }
@ -543,9 +546,11 @@ public class SearchPath {
if (f.exists() && f.isDirectory()) { if (f.exists() && f.isDirectory()) {
currentDir = f; currentDir = f;
files = f.list(); files = f.list();
fileNr = 0;
} }
} catch (SecurityException ex) { } catch (SecurityException ex) {
GlobalOptions.err.println("Warning: SecurityException" GlobalOptions.err.println
("Warning: SecurityException"
+ " while accessing " + " while accessing "
+ dirs[pathNr] + localDirName); + dirs[pathNr] + localDirName);
/* ignore and take next element */ /* ignore and take next element */

Loading…
Cancel
Save