Dear Friends,
I am Exceptions while i run the below code...
Exception is
java.io.IOException: Stream closed|
[10:56:45:593]|[07-23-2009]|[SYSOUT]|[INFO]|[15]|: at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)|
[10:56:45:593]|[07-23-2009]|[SYSOUT]|[INFO]|[15]|: at java.io.BufferedInputStream.read(BufferedInputStream.java:304)|
Code is here.... I am just calling this method when ever a inline image come in the mail.....it works fine for the first time but if this method calls second for a different E-mail means iam getting the Above error.....Please help me...
public Hashtable storeInlineImages(LinkedHashMap fileHash, Long woID) throws Exception
{
String appHome = ".."+File.separator+"inlineimages"+File.separator+"WorkOrder"+File.separator+woID.toString();//No I18N
File f1 = new File(appHome);
f1.mkdirs();
Iterator iter = fileHash.keySet().iterator();
String attachments = null;
String attSize = null;
while(iter.hasNext())
{
String fileName = (String) iter.next();
BufferedInputStream bis = (BufferedInputStream)fileHash.get(fileName);
FileOutputStream fos = new FileOutputStream(appHome+File.separator+fileName);
int c = 0 ;
int br = 0;
try
{
byte [] bufr = new byte [buf_len];
while((c=bis.read(bufr,0,buf_len)) != -1)
{
fos.write(bufr,0,c);
br += c;
}
if(attachments!=null)
{
attachments = attachments + "," + fileName;//No I18N
}
else
{
attachments = fileName;
}
if(attSize!=null)
{
attSize = attSize + "," + (new Integer(br)).toString();//No I18N
}
else
{
attSize = (new Integer(br)).toString();
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(fos != null )
{
fos.close();
}
if(bis != null)
{
bis.close();
}
}
}
Hashtable ht = new Hashtable();
if(attachments != null && attSize != null)
{
ht.put("SRC_PATH",appHome);//No I18N
ht.put("ATTACHMENT_NAMES",attachments);//No I18N
ht.put("ATTACHMENT_SIZES",attSize);//No I18N
}
return ht;
}
Thanks in Advance
With regards,
SiddikShaik