You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/05/12 19:57:20 UTC
[commons-io] branch master updated: Use final & ternary expression
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new 3b7a0aac Use final & ternary expression
3b7a0aac is described below
commit 3b7a0aacfc4f898e3f9d7da3ebee8610b29899c6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri May 12 15:57:16 2023 -0400
Use final & ternary expression
---
src/main/java/org/apache/commons/io/output/LockableFileWriter.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/output/LockableFileWriter.java b/src/main/java/org/apache/commons/io/output/LockableFileWriter.java
index 4905cfd6..76fc2c6d 100644
--- a/src/main/java/org/apache/commons/io/output/LockableFileWriter.java
+++ b/src/main/java/org/apache/commons/io/output/LockableFileWriter.java
@@ -209,7 +209,7 @@ public class LockableFileWriter extends Writer {
* @deprecated Use {@link #builder()}
*/
@Deprecated
- public LockableFileWriter(final File file, final Charset charset, final boolean append, String lockDir) throws IOException {
+ public LockableFileWriter(final File file, final Charset charset, final boolean append, final String lockDir) throws IOException {
// init file to create/append
final File absFile = Objects.requireNonNull(file, "file").getAbsoluteFile();
if (absFile.getParentFile() != null) {
@@ -220,10 +220,7 @@ public class LockableFileWriter extends Writer {
}
// init lock file
- if (lockDir == null) {
- lockDir = FileUtils.getTempDirectoryPath();
- }
- final File lockDirFile = new File(lockDir);
+ final File lockDirFile = new File(lockDir != null ? lockDir : FileUtils.getTempDirectoryPath());
FileUtils.forceMkdir(lockDirFile);
testLockDir(lockDirFile);
lockFile = new File(lockDirFile, absFile.getName() + LCK);