This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git

commit 5079f194c408ed65eb2a084e7268c371fd1a09ce
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Nov 12 12:11:39 2025 +0000

    Simplify code - no functional change
---
 src/main/java/org/apache/tomcat/jakartaee/Migration.java | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java 
b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
index 21b6e97..2242453 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
@@ -279,13 +279,7 @@ public class Migration {
     }
 
     private void migrateFile(File src, File dest) throws IOException {
-        boolean inplace = src.equals(dest);
-        if (!inplace) {
-            try (InputStream is = new FileInputStream(src);
-                    OutputStream os = new FileOutputStream(dest)) {
-                converted = migrateStream(src.getAbsolutePath(), is, os);
-            }
-        } else {
+        if (src.equals(dest)) {
             ByteArrayOutputStream buffer = new ByteArrayOutputStream((int) 
(src.length() * 1.05));
 
             try (InputStream is = new FileInputStream(src)) {
@@ -299,6 +293,11 @@ public class Migration {
             try (OutputStream os = new FileOutputStream(dest)) {
                 os.write(buffer.toByteArray());
             }
+        } else {
+            try (InputStream is = new FileInputStream(src);
+                    OutputStream os = new FileOutputStream(dest)) {
+                converted = migrateStream(src.getAbsolutePath(), is, os);
+            }
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to