Joel Bartley wrote:
> I think an appropriate fix would be to read in the data from the ZipEntry
> within the try block above, store it in a byte array and then return it
> wrappered in a ByteArrayOutputStream. It shouldn't be difficult. I'll try to
> work up a
> patch to do this and post it later today.
>
And here's the patch. I installed stock JServ 1.1 and was able to reproduce
the reported problem. Then I applied this patch and getResourceAsStream()
worked again.
--- orig/org/apache/java/lang/AdaptiveClassLoader.java Wed Jan 19 17:12:00 2000
+++ new/org/apache/java/lang/AdaptiveClassLoader.java Wed Jan 19 17:09:56 2000
@@ -656,18 +656,28 @@
*/
private InputStream loadResourceFromZipfile(File file, String name) {
ZipFile zipfile = null;
+ InputStream resourceStream = null;
try {
zipfile = new ZipFile(file);
ZipEntry entry = zipfile.getEntry(name);
if (entry != null) {
- return zipfile.getInputStream(entry);
+ long length = entry.getSize();
+ resourceStream = zipfile.getInputStream(entry);
+ byte[] data = loadBytesFromStream(resourceStream, (int)length);
+ return new ByteArrayInputStream(data);
} else {
return null;
}
} catch(IOException e) {
return null;
} finally {
+ if ( resourceStream != null ) {
+ try {
+ resourceStream.close();
+ } catch ( IOException ignored ) {
+ }
+ }
if ( zipfile != null ) {
try {
zipfile.close();
--
Joel Bartley
IBM Global Services
Burlington, VT
[EMAIL PROTECTED]
The views expressed above belong to me and do not
necessarily represent those of IBM.
���������������������������������������������N�.n�+��������Zr������x�v�,��&N�����r��{�ڽ�ڥ�!{��b���"�ݢ�r����b���ӭ����m��������Zr���?����f���m�_Ϯ��zk��:'�
+�)��� ��(