jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1857470 - /jmeter/trunk/src/functions/org/apache/jmeter/functions/StringToFile.java
Date Sat, 13 Apr 2019 11:21:29 GMT
Author: pmouawad
Date: Sat Apr 13 11:21:28 2019
New Revision: 1857470

URL: http://svn.apache.org/viewvc?rev=1857470&view=rev
Log:
Drop weird char
Add NOSONAR for handled exceptions

Modified:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/StringToFile.java

Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/StringToFile.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/StringToFile.java?rev=1857470&r1=1857469&r2=1857470&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/StringToFile.java (original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/StringToFile.java Sat Apr 13 11:21:28
2019
@@ -92,7 +92,7 @@ public class StringToFile extends Abstra
             log.error("File name '{}' is empty", fileName);
             return false;
         }
-        log.debug("Writing {} to file {} with charset {} and append {}", content, fileName,
charset, append);
+        log.debug("Writing {} to file {} with charset {} and append {}", content, fileName,
charset, append);
         
         Lock localLock = new ReentrantLock();
         Lock lock = lockMap.putIfAbsent(fileName, localLock);
@@ -107,7 +107,7 @@ public class StringToFile extends Abstra
             if (fileParent == null || (fileParent.exists() && fileParent.isDirectory()
&& fileParent.canWrite())) {
                 FileUtils.writeStringToFile(file, content, charset, append);
             } else {
-                log.error("The parent file of {} doesn't exist or is not writable", file);
+                log.error("The parent file of {} doesn't exist or is not writable", file);
                 return false;
             }
         } finally {
@@ -126,14 +126,15 @@ public class StringToFile extends Abstra
         boolean executionResult;
         try {
             executionResult = this.writeToFile();
-        } catch (UnsupportedCharsetException ue) {
+        } catch (UnsupportedCharsetException ue) { // NOSONAR
             executionResult = false;
-            log.error("The encoding of file is not supported");
-        } catch (IllegalCharsetNameException ie) {
+            log.error("The encoding of file is not supported", ue);
+        } catch (IllegalCharsetNameException ie) { // NOSONAR
             executionResult = false;
-            log.error("The encoding of file contains illegal characters");
-        } catch (IOException e) {
+            log.error("The encoding of file contains illegal characters", ie);
+        } catch (IOException e) { // NOSONAR
             executionResult = false;
+            log.error("IOException occurred", e);
         }
         return String.valueOf(executionResult);
     }



Mime
View raw message