mirror of
https://github.com/corda/corda.git
synced 2025-06-18 07:08:15 +00:00
fix ClassCastException in ZipFile.getInputStream
This was being thrown when the parameter passed was a JarFile.MyJarEntry, not a ZipFile.MyZipEntry, yet we cast it to the latter.
This commit is contained in:
@ -33,7 +33,7 @@ public class JarFile extends ZipFile {
|
|||||||
return (JarEntry) getEntry(JarEntryFactory.Instance, name);
|
return (JarEntry) getEntry(JarEntryFactory.Instance, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class MyJarEntry extends JarEntry {
|
private static class MyJarEntry extends JarEntry implements MyEntry {
|
||||||
public final Window window;
|
public final Window window;
|
||||||
public final int pointer;
|
public final int pointer;
|
||||||
|
|
||||||
@ -65,6 +65,10 @@ public class JarFile extends ZipFile {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int pointer() {
|
||||||
|
return pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class JarEntryFactory implements EntryFactory {
|
private static class JarEntryFactory implements EntryFactory {
|
||||||
|
@ -83,7 +83,7 @@ public class ZipFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InputStream getInputStream(ZipEntry entry) throws IOException {
|
public InputStream getInputStream(ZipEntry entry) throws IOException {
|
||||||
int pointer = ((MyZipEntry) entry).pointer;
|
int pointer = ((MyEntry) entry).pointer();
|
||||||
int method = compressionMethod(window, pointer);
|
int method = compressionMethod(window, pointer);
|
||||||
int size = compressedSize(window, pointer);
|
int size = compressedSize(window, pointer);
|
||||||
InputStream in = new MyInputStream(file, fileData(window, pointer), size);
|
InputStream in = new MyInputStream(file, fileData(window, pointer), size);
|
||||||
@ -245,7 +245,11 @@ public class ZipFile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class MyZipEntry extends ZipEntry {
|
protected interface MyEntry {
|
||||||
|
public int pointer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class MyZipEntry extends ZipEntry implements MyEntry {
|
||||||
public final Window window;
|
public final Window window;
|
||||||
public final int pointer;
|
public final int pointer;
|
||||||
|
|
||||||
@ -277,6 +281,10 @@ public class ZipFile {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int pointer() {
|
||||||
|
return pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected interface EntryFactory {
|
protected interface EntryFactory {
|
||||||
|
Reference in New Issue
Block a user