wkurniawan07 commented on code in PR #708:
URL: https://github.com/apache/jmeter/pull/708#discussion_r848992665


##########
src/protocol/tcp/src/main/java/org/apache/jmeter/protocol/tcp/sampler/TCPClientImpl.java:
##########
@@ -115,11 +116,15 @@ public String read(InputStream is, SampleResult 
sampleResult) throws ReadExcepti
 
             // do we need to close byte array (or flush it?)
             if(log.isDebugEnabled()) {
-                log.debug("Read: {}\n{}", w.size(), w.toString());
+                log.debug("Read: {}\n{}", w.size(), w.toString(CHARSET));
             }
             return w.toString(CHARSET);
         } catch (IOException e) {
-            throw new ReadException("Error reading from server, bytes read: " 
+ w.size(), e, w.toString());
+            try {
+                throw new ReadException("Error reading from server, bytes 
read: " + w.size(), e, w.toString(CHARSET));
+            } catch (UnsupportedEncodingException ue) {
+                throw new RuntimeException("Unsupported CHARSET: " + CHARSET, 
ue);

Review Comment:
   Not that I disagree about it, but this catch block here is unavoidable. It 
is thrown because `w.toString(CHARSET)` is called from within `throw new 
ReadException(...)`.
   This is avoidable only if the result of `w.toString(CHARSET)` is accessible 
within the catch block without calling the said method, but making it happen 
requires even more non-trivial changes on this method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to