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

rmaucher pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 3020c7b2668753babd0d37367a99621f5c84bd72
Author: opencode <[email protected]>
AuthorDate: Tue Oct 20 13:13:41 2026 +0200

    Do not swallow exceptions when loading translation property files
    
    Utils.load() caught IOException while reading a LocalStrings*.properties
    file, only printed a stack trace, and returned an empty or partially
    filled Properties object. All callers treated the result as an empty
    file, so a file that could not be read silently lost all its keys in
    Export and back-port output, and Import silently produced no output for
    the affected language while leaving any stale file from a previous run
    in place. Propagate the exception instead. All callers already declared
    throws IOException except the TestFixedStrings helper and test methods
    which are updated accordingly.
---
 java/org/apache/tomcat/buildutil/translate/Utils.java            | 4 +---
 test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java | 7 ++++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/tomcat/buildutil/translate/Utils.java 
b/java/org/apache/tomcat/buildutil/translate/Utils.java
index 9d20b5d6ed..34bce56664 100644
--- a/java/org/apache/tomcat/buildutil/translate/Utils.java
+++ b/java/org/apache/tomcat/buildutil/translate/Utils.java
@@ -61,14 +61,12 @@ public class Utils {
     }
 
 
-    static Properties load(File f) {
+    static Properties load(File f) throws IOException {
         Properties props = new Properties();
 
         try (FileInputStream fis = new FileInputStream(f);
                 Reader r = new InputStreamReader(fis, StandardCharsets.UTF_8)) 
{
             props.load(r);
-        } catch (IOException ioe) {
-            ioe.printStackTrace();
         }
         return props;
     }
diff --git a/test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java 
b/test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java
index a401611814..42942d86f7 100644
--- a/test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java
+++ b/test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java
@@ -17,6 +17,7 @@
 package org.apache.tomcat.buildutil.translate;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Properties;
 
 import org.junit.Assert;
@@ -25,13 +26,13 @@ import org.junit.Test;
 public class TestFixedStrings {
 
     @Test
-    public void testManagerApps() {
+    public void testManagerApps() throws IOException {
         doTestStartsWith("org.apache.catalina.manager", "OK -");
         doTestStartsWith("org.apache.catalina.manager.host", "OK -");
     }
 
 
-    private void doTestStartsWith(String packageName, String text) {
+    private void doTestStartsWith(String packageName, String text) throws 
IOException {
         File dir = new File("java/" + packageName.replace('.',  '/'));
 
         // English
@@ -52,7 +53,7 @@ public class TestFixedStrings {
     }
 
 
-    private void doTestStartsFile(File fileTranslated, Properties propsEn, 
String text) {
+    private void doTestStartsFile(File fileTranslated, Properties propsEn, 
String text) throws IOException {
         Properties propsTranslated = Utils.load(fileTranslated);
 
         for (Object key : propsEn.keySet()) {


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

Reply via email to