Hello, with previous code, we might hid initial exception. Do you really think an exception on close is useful ?
Regards Philippe On Thu, Mar 22, 2012 at 12:54 PM, sebb <[email protected]> wrote: > On 22 March 2012 08:50, <[email protected]> wrote: > > Author: pmouawad > > Date: Thu Mar 22 08:50:29 2012 > > New Revision: 1303688 > > > > URL: http://svn.apache.org/viewvc?rev=1303688&view=rev > > Log: > > Made method static and used closeQuietly > > > > Modified: > > > > jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java > > > > Modified: > jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java > > URL: > http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java?rev=1303688&r1=1303687&r2=1303688&view=diff > > > ============================================================================== > > --- > jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java > (original) > > +++ > jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java > Thu Mar 22 08:50:29 2012 > > @@ -33,6 +33,7 @@ import org.apache.jmeter.protocol.http.u > > import org.apache.jmeter.protocol.http.util.HTTPFileArg; > > import org.apache.jmeter.samplers.SampleResult; > > import org.apache.jmeter.testelement.property.PropertyIterator; > > +import org.apache.jorphan.util.JOrphanUtils; > > > > /** > > * Class for setting the necessary headers for a POST request, and > sending the > > @@ -398,7 +399,7 @@ public class PostWriter { > > * @param out the stream to write to > > * @throws IOException > > */ > > - private void writeFileToStream(String filename, OutputStream out) > throws IOException { > > + private static void writeFileToStream(String filename, OutputStream > out) throws IOException { > > byte[] buf = new byte[1024]; > > // 1k - the previous 100k made no sense (there's tons of buffers > > // elsewhere in the chain) and it caused OOM when many concurrent > > @@ -412,7 +413,7 @@ public class PostWriter { > > } > > } > > finally { > > - in.close(); > > + JOrphanUtils.closeQuietly(in); > > I'm not sure we want to ignore errors here. > > > } > > } > > > > > > > -- Cordialement. Philippe Mouawad.
