This is an automated email from the ASF dual-hosted git repository. fschumacher pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/jmeter.git
commit edf32024dd66dcff725be25c1c2490f771417b0d Author: Felix Schumacher <[email protected]> AuthorDate: Fri Aug 13 13:54:53 2021 +0200 Update Apache commons-io to 2.11.0 --- gradle.properties | 2 +- src/dist/src/dist/expected_release_jars.csv | 2 +- .../src/main/java/org/apache/jmeter/functions/StringToFile.java | 7 ++++++- .../test/java/org/apache/jmeter/functions/TestStringtoFile.java | 2 +- xdocs/changes.xml | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 22b48b4..e4754b5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -65,7 +65,7 @@ commons-codec.version=1.15 commons-collections.version=3.2.2 commons-collections4.version=4.4 commons-dbcp2.version=2.9.0 -commons-io.version=2.8.0 +commons-io.version=2.11.0 commons-jexl.version=2.1.1 commons-jexl3.version=3.1 commons-lang.version=2.6 diff --git a/src/dist/src/dist/expected_release_jars.csv b/src/dist/src/dist/expected_release_jars.csv index 0e39f82..9301c9f 100644 --- a/src/dist/src/dist/expected_release_jars.csv +++ b/src/dist/src/dist/expected_release_jars.csv @@ -10,7 +10,7 @@ 588337,commons-collections-3.2.2.jar 751914,commons-collections4-4.4.jar 211301,commons-dbcp2-2.9.0.jar -285424,commons-io-2.8.0.jar +327135,commons-io-2.11.0.jar 267634,commons-jexl-2.1.1.jar 397422,commons-jexl3-3.1.jar 577742,commons-lang3-3.11.jar diff --git a/src/functions/src/main/java/org/apache/jmeter/functions/StringToFile.java b/src/functions/src/main/java/org/apache/jmeter/functions/StringToFile.java index 0d02a24..f93b753 100644 --- a/src/functions/src/main/java/org/apache/jmeter/functions/StringToFile.java +++ b/src/functions/src/main/java/org/apache/jmeter/functions/StringToFile.java @@ -107,7 +107,12 @@ public class StringToFile extends AbstractFunction { File file = new File(fileName); File fileParent = file.getParentFile(); if (fileParent == null || (fileParent.exists() && fileParent.isDirectory() && fileParent.canWrite())) { - FileUtils.writeStringToFile(file, content, charset, append); + try { + FileUtils.writeStringToFile(file, content, charset, append); + } catch (IllegalArgumentException e) { + log.error("The file {} can't be written to", file, e); + return false; + } } else { log.error("The parent file of {} doesn't exist or is not writable", file); return false; diff --git a/src/functions/src/test/java/org/apache/jmeter/functions/TestStringtoFile.java b/src/functions/src/test/java/org/apache/jmeter/functions/TestStringtoFile.java index f472b91..af0213f 100644 --- a/src/functions/src/test/java/org/apache/jmeter/functions/TestStringtoFile.java +++ b/src/functions/src/test/java/org/apache/jmeter/functions/TestStringtoFile.java @@ -129,7 +129,7 @@ public class TestStringtoFile extends JMeterTestCase { @Test public void testWriteToFileIOException(@TempDir Path tempDir) throws Exception { - File file = new File(tempDir.toAbsolutePath() + "/output.txt"); + File file = new File(tempDir.toAbsolutePath() + "/output_ro.txt"); try { assertTrue(file.createNewFile() && file.setWritable(false), file + " should be set read-only"); String tempAbsolutePath = file.getAbsolutePath(); diff --git a/xdocs/changes.xml b/xdocs/changes.xml index bfeb844..e14b050 100644 --- a/xdocs/changes.xml +++ b/xdocs/changes.xml @@ -145,6 +145,7 @@ Summary <li>Updated Bouncycastle to 1.69 (from 1.67).</li> <li>Updated Caffeine to 2.9.2 (from 2.8.8).</li> <li>Updated Apache commons-dbcp2 to 2.9.0 (from 2.8.0).</li> + <li>Updated Apache commons-io to 2.11.0 (from 2.8.0).</li> </ul> <!-- =================== Bug fixes =================== -->
