From e730c74800a22b8faaf761926b45f4973d90e7a6 Mon Sep 17 00:00:00 2001 From: Nicolas Roduit Date: Fri, 5 Jul 2024 07:40:45 +0200 Subject: [PATCH] Remove String Template Preview for Java 23 --- .../java/org/weasis/core/api/service/AuditLog.java | 11 +++++++---- .../org/weasis/core/ui/pref/LoggingPrefView.java | 5 ++--- .../java/org/weasis/dicom/explorer/LoadDicom.java | 7 ++----- .../src/main/java/org/weasis/dicom/rt/Dvh.java | 2 +- .../java/org/weasis/dicom/rt/IsoDoseRegion.java | 4 ++-- .../src/main/java/org/weasis/dicom/rt/Plan.java | 4 ++-- .../java/org/weasis/dicom/rt/RtDisplayTool.java | 2 +- .../java/org/weasis/dicom/rt/StructRegionTree.java | 10 +++++----- .../java/org/weasis/launcher/WeasisLauncher.java | 14 +++++++------- .../src/main/java/org/weasis/pref/ConfigData.java | 2 +- 10 files changed, 30 insertions(+), 31 deletions(-) diff --git a/weasis-core/src/main/java/org/weasis/core/api/service/AuditLog.java b/weasis-core/src/main/java/org/weasis/core/api/service/AuditLog.java index 0c695a791..ea409f270 100755 --- a/weasis-core/src/main/java/org/weasis/core/api/service/AuditLog.java +++ b/weasis-core/src/main/java/org/weasis/core/api/service/AuditLog.java @@ -47,7 +47,7 @@ public class AuditLog { public static final String LOG_FILE_PATTERN = "org.apache.sling.commons.log.file.pattern"; public static final String LOG_FOLDER_PATH = - STR."\{AppProperties.WEASIS_PATH}\{File.separator}log\{File.separator}"; + AppProperties.WEASIS_PATH + File.separator + "log" + File.separator; public enum LEVEL { TRACE, @@ -70,11 +70,14 @@ public static WProperties getAuditProperties() { WProperties p = new WProperties(); p.putBooleanProperty(AuditLog.LOG_FILE_ACTIVATION, true); p.setProperty( - AuditLog.LOG_FILE, STR."\{AuditLog.LOG_FOLDER_PATH}audit-\{AppProperties.WEASIS_USER}.log"); + AuditLog.LOG_FILE, + AuditLog.LOG_FOLDER_PATH + "audit-" + AppProperties.WEASIS_USER + ".log"); // NON-NLS p.setProperty(AuditLog.LOG_FILE_NUMBER, "10"); p.setProperty(AuditLog.LOG_FILE_SIZE, "20MB"); // NON-NLS p.setProperty(AuditLog.LOG_CLASSES, "org.weasis.core.api.service.AuditLog"); - p.setProperty(AuditLog.LOG_FILE_PATTERN, STR."audit-\{AppProperties.WEASIS_USER}.%i.log.zip"); + p.setProperty( + AuditLog.LOG_FILE_PATTERN, + AuditLog.LOG_FOLDER_PATH + "audit-" + AppProperties.WEASIS_USER + ".%i.log.zip"); // NON-NLS return p; } @@ -174,7 +177,7 @@ public static PatternLayoutEncoder getPatternLayoutEncoder( encoder.setContext(loggerContext); String limit = StringUtil.hasText(stackLimit) && !"-1".equals(stackLimit) ? stackLimit : "full"; - String str = pattern.replaceAll("ex\\{\\d+}", STR."ex{\{limit}}"); // NON-NLS + String str = pattern.replaceAll("ex\\{\\d+}", "ex{" + limit + "}"); // NON-NLS encoder.setPattern(str); encoder.start(); return encoder; diff --git a/weasis-core/src/main/java/org/weasis/core/ui/pref/LoggingPrefView.java b/weasis-core/src/main/java/org/weasis/core/ui/pref/LoggingPrefView.java index 72fc057ee..f56a0b879 100755 --- a/weasis-core/src/main/java/org/weasis/core/ui/pref/LoggingPrefView.java +++ b/weasis-core/src/main/java/org/weasis/core/ui/pref/LoggingPrefView.java @@ -152,13 +152,12 @@ public void closeAdditionalWindow() { } preferences.setProperty(AuditLog.LOG_LEVEL, level.toString()); preferences.putBooleanProperty(AuditLog.LOG_FILE_ACTIVATION, checkboxFileLog.isSelected()); - String logFile = - checkboxFileLog.isSelected() ? STR."\{AuditLog.LOG_FOLDER_PATH}default.log" : ""; + String logFile = checkboxFileLog.isSelected() ? AuditLog.LOG_FOLDER_PATH + "default.log" : ""; preferences.setProperty(AuditLog.LOG_FILE, logFile); if (checkboxFileLog.isSelected()) { String fileNb = spinner.getValue().toString(); - String fileSize = STR."\{spinner1.getValue().toString()}MB"; + String fileSize = spinner1.getValue().toString() + "MB"; preferences.setProperty(AuditLog.LOG_FILE_NUMBER, fileNb); preferences.setProperty(AuditLog.LOG_FILE_SIZE, fileSize); } diff --git a/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/LoadDicom.java b/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/LoadDicom.java index 169603ebd..24b55466d 100755 --- a/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/LoadDicom.java +++ b/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/LoadDicom.java @@ -102,12 +102,9 @@ private JTextPane getErrorPanel(int nbErrors) { """ .formatted( message, - STR."\{ - GuiUtils.getUICore() - .getSystemPreferences() - .getProperty("weasis.help.online")}logging", + GuiUtils.getUICore().getSystemPreferences().getProperty("weasis.help.online") + + "logging", logOutput); - JTextPane jTextPane1 = GuiUtils.getPanelWithHyperlink(html); jTextPane1.setBorder(new EmptyBorder(5, 5, 15, 5)); return jTextPane1; diff --git a/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/Dvh.java b/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/Dvh.java index c5fbc840a..db8f514ad 100755 --- a/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/Dvh.java +++ b/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/Dvh.java @@ -193,7 +193,7 @@ public XYChart appendChart(StructRegion region, XYChart dvhChart) { String sName = region.getLabel(); int k = 2; while (dvhChart.getSeriesMap().get(sName) != null) { - sName = STR."\{region.getLabel()} \{k}"; + sName = region.getLabel() + " " + k; k++; } // Create a line diff --git a/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/IsoDoseRegion.java b/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/IsoDoseRegion.java index 18704b66e..529cbd8ef 100644 --- a/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/IsoDoseRegion.java +++ b/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/IsoDoseRegion.java @@ -26,9 +26,9 @@ public IsoDoseRegion(int level, Color color, String name, double planDose) { setInteriorOpacity(0.2f); this.absoluteDose = ((this.level) * planDose) / 100.0; String result = - STR."\{this.level} % / \{String.format("%.6g", this.absoluteDose)} cGy"; // NON-NLS + this.level + " % / " + String.format("%.6g", this.absoluteDose) + " cGy"; // NON-NLS if (StringUtil.hasText(name)) { - result += STR." [\{name}]"; + result += " [" + name + "]"; } setLabel(result); } diff --git a/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/Plan.java b/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/Plan.java index 7c29f6615..1a8d5b235 100755 --- a/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/Plan.java +++ b/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/Plan.java @@ -103,9 +103,9 @@ public Dose getFirstDose() { public void appendName(String text) { if (StringUtil.hasText(this.name)) { - this.name += STR." (\{text})"; + this.name += " (" + text + ")"; } else if (StringUtil.hasText(this.label)) { - this.name = STR."\{this.label} (\{text})"; + this.name = this.label + " (" + text + ")"; } } diff --git a/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/RtDisplayTool.java b/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/RtDisplayTool.java index b2683aa96..7f721d157 100755 --- a/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/RtDisplayTool.java +++ b/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/RtDisplayTool.java @@ -792,7 +792,7 @@ public String toString() { String type = layer.getRtRoiInterpretedType(); if (StringUtil.hasText(type)) { - resultLabel += STR." [\{type}]"; + resultLabel += " [" + type + "]"; } return getColorBullet(layer.getColor(), resultLabel); diff --git a/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/StructRegionTree.java b/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/StructRegionTree.java index 5b325f359..ef1b48d2e 100644 --- a/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/StructRegionTree.java +++ b/weasis-dicom/weasis-dicom-rt/src/main/java/org/weasis/dicom/rt/StructRegionTree.java @@ -79,12 +79,12 @@ private static void writeToCsv(List segRegions) { CsvExporter csv = new CsvExporter(); csv.addQuotedNameAndSeparator("Label"); // NON-NLS csv.addQuotedNameAndSeparator("ROI Observation Label"); // NON-NLS - csv.addQuotedNameAndSeparator(STR."\{Messages.getString("thickness")} [mm]"); - csv.addQuotedNameAndSeparator(STR."\{Messages.getString("volume")} [cm³]"); + csv.addQuotedNameAndSeparator(Messages.getString("thickness") + " [mm]"); // NON-NLS + csv.addQuotedNameAndSeparator(Messages.getString("volume") + " [cm³]"); // NON-NLS if (hasDvh(segRegions)) { - csv.addQuotedNameAndSeparator(STR."\{Messages.getString("min.dose")} [%]"); - csv.addQuotedNameAndSeparator(STR."\{Messages.getString("max.dose")} [%]"); - csv.addQuotedName(STR."\{Messages.getString("mean.dose")} [%]"); + csv.addQuotedNameAndSeparator(Messages.getString("min.dose") + " [%]"); + csv.addQuotedNameAndSeparator(Messages.getString("max.dose") + " [%]"); + csv.addQuotedName(Messages.getString("mean.dose") + " [%]"); } csv.addEndOfLine(); diff --git a/weasis-launcher/src/main/java/org/weasis/launcher/WeasisLauncher.java b/weasis-launcher/src/main/java/org/weasis/launcher/WeasisLauncher.java index 18df4b1b3..ab4e4656d 100755 --- a/weasis-launcher/src/main/java/org/weasis/launcher/WeasisLauncher.java +++ b/weasis-launcher/src/main/java/org/weasis/launcher/WeasisLauncher.java @@ -152,9 +152,9 @@ public final void launch(Type type) throws Exception { JOptionPane.showOptionDialog( mainFrame.getWindow(), String.format( - STR."\{ - Messages.getString("WeasisLauncher.update_min")}\n\n\{ - Messages.getString("WeasisLauncher.continue_local")}", + "%s\n\n%s", + Messages.getString("WeasisLauncher.update_min"), + Messages.getString("WeasisLauncher.continue_local"), appName, minVersion), null, @@ -252,10 +252,10 @@ public final void launch(Type type) throws Exception { LOGGER.error("State of the framework:"); for (Bundle b : mFelix.getBundleContext().getBundles()) { LOGGER.error( - STR." * \{ - b.getSymbolicName()}-\{ - b.getVersion().toString()} \{ - State.valueOf(b.getState())}"); + " * {}-{} {}", + b.getSymbolicName(), + b.getVersion().toString(), + State.valueOf(b.getState())); } resetBundleCache(); } finally { diff --git a/weasis-launcher/src/main/java/org/weasis/pref/ConfigData.java b/weasis-launcher/src/main/java/org/weasis/pref/ConfigData.java index a5d78a418..b22b691f4 100755 --- a/weasis-launcher/src/main/java/org/weasis/pref/ConfigData.java +++ b/weasis-launcher/src/main/java/org/weasis/pref/ConfigData.java @@ -513,7 +513,7 @@ private void splitArgToCmd(String... args) { LOGGER.error("Convert URI to file", e); } } - arguments.add(STR."dicom:get -l \"\{val}\""); // NON-NLS + arguments.add("dicom:get -l \"" + val + "\""); // NON-NLS } } }