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 2025/09/25 14:55:06 UTC

(commons-io) branch master updated: Inline single use local variable before a return

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 d76a0b2fa Inline single use local variable before a return
d76a0b2fa is described below

commit d76a0b2fae821f2b02bd110150e8a7185c9d29d6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Sep 25 10:55:02 2025 -0400

    Inline single use local variable before a return
---
 src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java b/src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java
index c20f8456a..7ae5c7102 100644
--- a/src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java
+++ b/src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java
@@ -128,8 +128,7 @@ private Object getEncoder() {
             if (charsetEncoder != null && getCharset() != null && !charsetEncoder.charset().equals(getCharset())) {
                 throw new IllegalStateException(String.format("Mismatched Charset(%s) and CharsetEncoder(%s)", getCharset(), charsetEncoder.charset()));
             }
-            final Object encoder = charsetEncoder != null ? charsetEncoder : getCharset();
-            return encoder;
+            return charsetEncoder != null ? charsetEncoder : getCharset();
         }
 
         /**