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

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

commit b694097305f1dc90b27a0803c3918599ff515c3b
Author: opencode <[email protected]>
AuthorDate: Tue Oct 20 13:03:01 2026 +0200

    Create the storage directory in the back-port tools and do not swallow
    export failures
    
    The back-port tools computed <target>/.settings/translations but never
    created it. Since .settings is git-ignored, a freshly checked out
    target tree - the normal back-port scenario - lacks the directory, the
    FileOutputStream in Utils.export() failed with FileNotFoundException
    and, as the exception was only printed to stderr, both BackportEnglish
    and BackportTranslations completed with exit code 0 having produced no
    output at all. Create the storage directory in the BackportBase
    constructor and make Utils.export() propagate IOException instead of
    swallowing it, so failures abort the run with a clear error. Export
    already created the directory itself. Update the now stale constructor
    Javadoc accordingly.
---
 java/org/apache/tomcat/buildutil/translate/BackportBase.java | 5 ++++-
 java/org/apache/tomcat/buildutil/translate/Utils.java        | 4 +---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/buildutil/translate/BackportBase.java 
b/java/org/apache/tomcat/buildutil/translate/BackportBase.java
index ce12815c74..2e0d83acf5 100644
--- a/java/org/apache/tomcat/buildutil/translate/BackportBase.java
+++ b/java/org/apache/tomcat/buildutil/translate/BackportBase.java
@@ -62,7 +62,7 @@ public abstract class BackportBase {
      *
      * @param args array with a single element: the target directory path
      *
-     * @throws IOException if an I/O error occurs while reading translation 
files
+     * @throws IOException if an I/O error occurs
      */
     protected BackportBase(String... args) throws IOException {
         if (args.length != 1) {
@@ -89,6 +89,9 @@ public abstract class BackportBase {
         targetEnglish = targetTranslations.get("");
 
         storageDir = new File(targetRoot, Constants.STORAGE_DIR);
+        if (!storageDir.exists() && !storageDir.mkdirs()) {
+            throw new IOException("Unable to create directory [" + 
storageDir.getAbsolutePath() + "]");
+        }
     }
 
     /**
diff --git a/java/org/apache/tomcat/buildutil/translate/Utils.java 
b/java/org/apache/tomcat/buildutil/translate/Utils.java
index fce8148bed..4baa0200b4 100644
--- a/java/org/apache/tomcat/buildutil/translate/Utils.java
+++ b/java/org/apache/tomcat/buildutil/translate/Utils.java
@@ -208,7 +208,7 @@ public class Utils {
     }
 
 
-    static void export(String language, Properties translation, File 
storageDir) {
+    static void export(String language, Properties translation, File 
storageDir) throws IOException {
         File out = new File(storageDir, Constants.L10N_PREFIX + language + 
Constants.L10N_SUFFIX);
         try (FileOutputStream fos = new FileOutputStream(out);
                 Writer w = new OutputStreamWriter(fos, 
StandardCharsets.UTF_8)) {
@@ -217,8 +217,6 @@ public class Utils {
             for (String key : keys) {
                 w.write(key + "=" + 
formatValueExport(translation.getProperty(key)) + "\n");
             }
-        } catch (IOException ioe) {
-            ioe.printStackTrace();
         }
     }
 


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

Reply via email to