java - Closing StreamSource -
i getting many open files error on web service , wanted make sure there's nothing else have close.  added close() on outwriter (stringwriter), javadoc said has no effect. getcachedextractsoapbodyxslt() gets javax.xml.transform.transformer object. 
string payload; streamresult result=null; stringwriter outwriter=null; try {     // programmatically extract soap body message     outwriter = new stringwriter();     result = new streamresult(outwriter);     source src = new streamsource(new java.io.stringreader(doc));     getcachedextractsoapbodyxslt().transform(src, result);     stringbuffer sb = outwriter.getbuffer();     payload = sb.tostring(); } catch (transformerexception e) {     throw new componentexception("unable extract soap body"); } {     log.debug("closing xslt transformer output stream");     try {         outwriter.close();     }     catch (ioexception e) {         log.error("failed close stream soap message");     } }      
i had move it's own variable , close it
new java.io.stringreader(doc)      
Comments
Post a Comment