This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 2711a7bf106977ad6dc5caa16d2028b98d3d23cf 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/Export.java | 2 +- java/org/apache/tomcat/buildutil/translate/Utils.java | 4 +--- 3 files changed, 6 insertions(+), 5 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/Export.java b/java/org/apache/tomcat/buildutil/translate/Export.java index 79badc9929..479d1f2c7c 100644 --- a/java/org/apache/tomcat/buildutil/translate/Export.java +++ b/java/org/apache/tomcat/buildutil/translate/Export.java @@ -52,7 +52,7 @@ public class Export { } - private static void outputTranslations() { + private static void outputTranslations() throws IOException { File storageDir = new File(Constants.STORAGE_DIR); if (!storageDir.exists()) { 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]
