Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
1.0
-
None
-
None
-
Operating System: Windows NT/2K
Platform: PC
-
17001
Description
DimeBodyPart.send() needs to close the input stream.
My application produces dynamically-generated files and returns their contents
as an Attachment in the SOAP response. Because DimeBodyPart.send() does not
close the InputStream it acquires from the DataHandler, I am unable to delete a
file (wrapped by a FileDataSource) after AXIS serializes the response because
the jvm process still has an open handle on the file. Eventually this will get
gc'd and then I can delete it but I don't want to queue up this work.
By changing this method to something like the following...
void send(java.io.OutputStream os, byte position, DataHandler dh,
final long maxchunk) throws java.io.IOException {
java.io.InputStream in = null;
try {
byte chunknext = 0;
long dataSize = getDataSize();
in = dh.getInputStream();
byte[] readbuf = new byte[64 * 1024];
int bytesread;
sendHeader(os, position, dataSize, (byte) 0);
long totalsent = 0;
do {
bytesread = in.read(readbuf);
if (bytesread > 0)
}
while (bytesread > -1);
os.write(pad, 0, dimePadding(totalsent));
}
finally {
if (in != null) {
try
catch (IOException e )
{ // Ignore. } }
}
}
I am able to reliably delete my files after AXIS has serialized the response.
I haven't investigated whether a similar issue exists for outgoing MIME
attachments (but it makes sense for this to be checked as well).
Thanks!
-Sam
Attachments
Issue Links
- relates to
-
AXIS-2910 DimeBodyPart.send does not close stream for dynamic content
- Resolved