Menu

#6 ZKBManager fails to export to OutputStream

open
nobody
None
5
2005-05-10
2005-05-10
Anonymous
No

Exporting to an OutputStream via org.mandarax.zkb.ZKBManager
fails in Mandarax 3.4. The problem is that the getIOManager()
function does not return the correct value for an OutputStream. The
original code is:

private IOManager getIOManager(Object object) {
if (object instanceof File) {
File f = (File)object;
if (f.isDirectory()) return DIR_IO;
else return ZIP_IO;
}
else if (object instanceof InputStream) return ZIP_IO;
else if (object instanceof URL) return ZIP_IO;
return null;
}

A fix is the following:

private IOManager getIOManager(Object object) {
if (object instanceof File) {
File f = (File)object;
if (f.isDirectory()) return DIR_IO;
else return ZIP_IO;
}
else if (object instanceof InputStream || object instanceof
OutputStream) return ZIP_IO;
else if (object instanceof URL) return ZIP_IO;
return null;
}

I have tested with the fix, and it works.

Discussion


Log in to post a comment.