jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1304791 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
Date Sat, 24 Mar 2012 13:43:01 GMT
Author: pmouawad
Date: Sat Mar 24 13:43:00 2012
New Revision: 1304791

URL: http://svn.apache.org/viewvc?rev=1304791&view=rev
Log:
Retain original exception if one in progress or make in.close not quietly throw

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=1304791&r1=1304790&r2=1304791&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
Sat Mar 24 13:43:00 2012
@@ -407,13 +407,20 @@ public class PostWriter {
         // ratio in bin/jmeter[.bat], but this is better.
         InputStream in = new BufferedInputStream(new FileInputStream(filename));
         int read;
-        try {
+        boolean noException = false;
+        try { 
             while ((read = in.read(buf)) > 0) {
                 out.write(buf, 0, read);
             }
+            noException = true;
         }
         finally {
-            JOrphanUtils.closeQuietly(in);
+            if(!noException) {
+                // Exception in progress
+                JOrphanUtils.closeQuietly(in);
+            } else {
+                in.close();
+            }
         }
     }
 



Mime
View raw message