From 00edc4525ff5bbbf1a112c2a33dd692d4497d7a2 Mon Sep 17 00:00:00 2001 From: lcaouen Date: Thu, 27 Nov 2025 16:53:55 +0100 Subject: [PATCH 1/4] show in red incorrect properties in settings.ini --- .../preferences/PropertyPreferenceWriter.java | 123 ++++++++++++++++-- .../java/org/phoebus/ui/help/OpenAbout.java | 12 +- 2 files changed, 118 insertions(+), 17 deletions(-) diff --git a/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java b/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java index 0f39f4392e..7ac59d71a0 100644 --- a/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java +++ b/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java @@ -7,10 +7,25 @@ *******************************************************************************/ package org.phoebus.framework.preferences; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; import java.util.prefs.Preferences; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** Write preferences in property file format * @author Kay Kasemir @@ -33,34 +48,116 @@ public static void save(final OutputStream stream) throws Exception { try ( + final OutputStreamWriter out = new OutputStreamWriter(stream); ) { - out.append("# Preference settings\n"); - out.append("# Format:\n"); - out.append("# the.package.name/key=value\n"); - listSettings(out, Preferences.userRoot()); - out.append("# End.\n"); + out.append("# Preference settings
\n"); + out.append("# Format:
\n"); + out.append("# the.package.name/key=value
\n"); + listSettings(getAllPropertyKeys(), out, Preferences.userRoot()); + out.append("# End.
\n"); out.flush(); } } - private static void listSettings(final Writer out, final Preferences node) throws Exception + private static void listSettings(Map allKeysWithPackages, final Writer out, final Preferences node) throws Exception { for (String key : node.keys()) - formatSetting(out, node, key); + formatSetting(allKeysWithPackages, out, node, key); for (String child : node.childrenNames()) - listSettings(out, node.node(child)); + listSettings(allKeysWithPackages, out, node.node(child)); } - private static void formatSetting(final Writer out, final Preferences node, final String key) throws Exception + private static void formatSetting(Map allKeysWithPackages, final Writer out, final Preferences node, final String key) throws Exception { final String path = node.absolutePath(); - out.append(path.substring(1).replace('/', '.')) - .append('/') - .append(key) + String fullKey = path.substring(1).replace('/', '.') + '/' + key; + String keyFound = allKeysWithPackages.get(fullKey); + boolean bNotFound = keyFound == null ? true : false; + if (bNotFound) out.append("
"); + out.append(fullKey) .append('=') .append(node.get(key, "")) - .append('\n'); + .append("
\n"); + if (bNotFound) out.append("
"); } + + private static Map getAllPropertyKeys() throws Exception + { + Map allKeysWithPackages = new HashMap<>(); + + String classpath = System.getProperty("java.class.path"); + StringTokenizer tokenizer = new StringTokenizer(classpath, System.getProperty("path.separator")); + + while (tokenizer.hasMoreTokens()) { + String path = tokenizer.nextToken(); + File file = new File(path); + + if (path.endsWith(".jar")) { + try (JarFile jarFile = new JarFile(file)) { + Enumeration entries = jarFile.entries(); + + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + String entryName = entry.getName(); + + if (entryName.endsWith("preferences.properties")) { + parsePropertiesWithPackage( + jarFile.getInputStream(entry), + entryName, + allKeysWithPackages + ); + } + } + } catch (IOException e) { + System.err.println("Error opening JAR : " + path); + e.printStackTrace(); + } + } + } + + return allKeysWithPackages; + } + + private static void parsePropertiesWithPackage( + InputStream inputStream, + String fileName, + Map allKeysWithPackages + ) { + Properties props = new Properties(); + String packageName = null; + + try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { + String line; + StringBuilder content = new StringBuilder(); + + while ((line = reader.readLine()) != null) { + line = line.trim(); + if (line.startsWith("#") && line.contains("Package")) { + // Find package name + Pattern pattern = Pattern.compile("#\\s*Package\\s+([^\\s]+)"); + Matcher matcher = pattern.matcher(line); + if (matcher.find()) { + packageName = matcher.group(1); + } + } else if (!line.startsWith("#")) { + content.append(line).append("\n"); + } + } + + if (content.length() > 0) { + props.load(new ByteArrayInputStream(content.toString().getBytes())); + } + + // properties found + for (String key : props.stringPropertyNames()) { + String prefixedKey = (packageName != null) ? packageName + "/" + key : key; + allKeysWithPackages.put(prefixedKey, props.getProperty(key)); + } + } catch (IOException e) { + System.err.println("Error when reading file " + fileName); + e.printStackTrace(); + } + } } diff --git a/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java b/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java index 0add9484a5..f9c90c5726 100644 --- a/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java +++ b/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java @@ -42,6 +42,7 @@ import javafx.scene.image.Image; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; +import javafx.scene.web.WebView; /** Menu entry to open 'about' * @author Kay Kasemir @@ -204,12 +205,15 @@ private Node createDetailSection() logger.log(Level.WARNING, "Cannot list preferences", ex); } - area = new TextArea(prefs_buf.toString()); - area.setEditable(false); + WebView webView = new WebView(); + String content = ""; + content += prefs_buf.toString(); + content += ""; + webView.getEngine().loadContent(content); - VBox.setVgrow(area, Priority.ALWAYS); + VBox.setVgrow(webView, Priority.ALWAYS); - final Tab prefs = new Tab(Messages.HelpAboutPrefs, area); + final Tab prefs = new Tab(Messages.HelpAboutPrefs, webView); final TabPane tabs = new TabPane(apps, envs, props, prefs); return tabs; From 54083d7241344dc195216b649033a9bdd1b51178 Mon Sep 17 00:00:00 2001 From: lcaouen Date: Tue, 2 Dec 2025 15:53:59 +0100 Subject: [PATCH 2/4] load properties from manifest + escape html tags + monospace font --- .../preferences/PropertyPreferenceWriter.java | 124 ++++++++++++------ .../java/org/phoebus/ui/help/OpenAbout.java | 4 +- 2 files changed, 84 insertions(+), 44 deletions(-) diff --git a/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java b/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java index 7ac59d71a0..310df03199 100644 --- a/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java +++ b/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java @@ -16,13 +16,15 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import java.util.Properties; -import java.util.StringTokenizer; import java.util.jar.JarEntry; import java.util.jar.JarFile; +import java.util.jar.Manifest; import java.util.prefs.Preferences; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -48,13 +50,13 @@ public static void save(final OutputStream stream) throws Exception { try ( - final OutputStreamWriter out = new OutputStreamWriter(stream); ) { out.append("# Preference settings
\n"); out.append("# Format:
\n"); out.append("# the.package.name/key=value
\n"); + out.append("
# key=value in red are incorrect properties

\n"); listSettings(getAllPropertyKeys(), out, Preferences.userRoot()); out.append("# End.
\n"); out.flush(); @@ -76,9 +78,9 @@ private static void formatSetting(Map allKeysWithPackages, final String keyFound = allKeysWithPackages.get(fullKey); boolean bNotFound = keyFound == null ? true : false; if (bNotFound) out.append("
"); - out.append(fullKey) + out.append(escapeHtml(fullKey)) .append('=') - .append(node.get(key, "")) + .append(escapeHtml(node.get(key, ""))) .append("
\n"); if (bNotFound) out.append("
"); } @@ -88,13 +90,14 @@ private static Map getAllPropertyKeys() throws Exception Map allKeysWithPackages = new HashMap<>(); String classpath = System.getProperty("java.class.path"); - StringTokenizer tokenizer = new StringTokenizer(classpath, System.getProperty("path.separator")); + String[] jars = classpath.split(System.getProperty("path.separator")); - while (tokenizer.hasMoreTokens()) { - String path = tokenizer.nextToken(); - File file = new File(path); + if (jars.length == 1) jars = getAllJarFromManifest(jars[0]); - if (path.endsWith(".jar")) { + for (String jarEntry : jars) { + File file = new File(jarEntry); + + if (jarEntry.endsWith(".jar")) { try (JarFile jarFile = new JarFile(file)) { Enumeration entries = jarFile.entries(); @@ -111,7 +114,7 @@ private static Map getAllPropertyKeys() throws Exception } } } catch (IOException e) { - System.err.println("Error opening JAR : " + path); + System.err.println("Error opening JAR : " + jarEntry); e.printStackTrace(); } } @@ -120,44 +123,79 @@ private static Map getAllPropertyKeys() throws Exception return allKeysWithPackages; } - private static void parsePropertiesWithPackage( - InputStream inputStream, - String fileName, - Map allKeysWithPackages - ) { - Properties props = new Properties(); - String packageName = null; - - try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { - String line; - StringBuilder content = new StringBuilder(); - - while ((line = reader.readLine()) != null) { - line = line.trim(); - if (line.startsWith("#") && line.contains("Package")) { - // Find package name - Pattern pattern = Pattern.compile("#\\s*Package\\s+([^\\s]+)"); - Matcher matcher = pattern.matcher(line); - if (matcher.find()) { - packageName = matcher.group(1); - } - } else if (!line.startsWith("#")) { - content.append(line).append("\n"); + private static String[] getAllJarFromManifest(String jarPath) { + String[] jars = new String[0]; + File jarFile = new File(jarPath); + + try (JarFile jar = new JarFile(jarFile)) { + Manifest manifest = jar.getManifest(); + + if (manifest != null) { + String classPath = manifest.getMainAttributes().getValue("Class-Path"); + + if (classPath != null && !classPath.isEmpty()) { + jars = classPath.split(" "); + + for (int iJar = 0; iJar < jars.length; iJar++) { + Path fullPath = Paths.get(jarFile.getParent()).resolve(jars[iJar]); + jars[iJar] = fullPath.toString(); } + } else { + System.err.println("No Class-Path found in MANIFEST.MF."); } + } else { + System.err.println("MANIFEST.MF not found in the JAR."); + } + } catch (IOException e) { + System.err.println("Error when reading the jar : " + jarPath); + e.printStackTrace(); + } + + return jars; + } + + private static void parsePropertiesWithPackage(InputStream inputStream, String fileName, Map allKeysWithPackages) { + Properties props = new Properties(); + String packageName = null; - if (content.length() > 0) { - props.load(new ByteArrayInputStream(content.toString().getBytes())); - } + try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { + String line; + StringBuilder content = new StringBuilder(); - // properties found - for (String key : props.stringPropertyNames()) { - String prefixedKey = (packageName != null) ? packageName + "/" + key : key; - allKeysWithPackages.put(prefixedKey, props.getProperty(key)); + while ((line = reader.readLine()) != null) { + line = line.trim(); + if (line.startsWith("#") && line.contains("Package")) { + // Find package name + Pattern pattern = Pattern.compile("#\\s*Package\\s+([^\\s]+)"); + Matcher matcher = pattern.matcher(line); + if (matcher.find()) { + packageName = matcher.group(1); + } + } else if (!line.startsWith("#")) { + content.append(line).append("\n"); } - } catch (IOException e) { - System.err.println("Error when reading file " + fileName); - e.printStackTrace(); } + + if (content.length() > 0) { + props.load(new ByteArrayInputStream(content.toString().getBytes())); + } + + // properties found + for (String key : props.stringPropertyNames()) { + String prefixedKey = (packageName != null) ? packageName + "/" + key : key; + allKeysWithPackages.put(prefixedKey, props.getProperty(key)); + } + } catch (IOException e) { + System.err.println("Error when reading file " + fileName); + e.printStackTrace(); } + } + + private static String escapeHtml(String input) { + return input.replace("&", "&") + .replace("<", "<") + .replace(">", ">") + .replace("\"", """) + .replace("'", "'"); + } } diff --git a/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java b/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java index f9c90c5726..254d9d48d5 100644 --- a/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java +++ b/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java @@ -206,7 +206,9 @@ private Node createDetailSection() } WebView webView = new WebView(); - String content = ""; + String content = ""; content += prefs_buf.toString(); content += ""; webView.getEngine().loadContent(content); From 717fc53fadc9202a16157e173d887ea62604e1ce Mon Sep 17 00:00:00 2001 From: lcaouen Date: Mon, 15 Dec 2025 10:37:11 +0100 Subject: [PATCH 3/4] check if property files are in classes folders and exclude keys from the check --- .../preferences/PropertyPreferenceWriter.java | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java b/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java index 310df03199..77fb372a0f 100644 --- a/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java +++ b/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java @@ -16,6 +16,7 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Enumeration; @@ -28,6 +29,7 @@ import java.util.prefs.Preferences; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Stream; /** Write preferences in property file format * @author Kay Kasemir @@ -58,6 +60,7 @@ public static void save(final OutputStream stream) throws Exception out.append("# the.package.name/key=value
\n"); out.append("
# key=value in red are incorrect properties

\n"); listSettings(getAllPropertyKeys(), out, Preferences.userRoot()); + out.append("
\n"); out.append("# End.
\n"); out.flush(); } @@ -76,7 +79,15 @@ private static void formatSetting(Map allKeysWithPackages, final final String path = node.absolutePath(); String fullKey = path.substring(1).replace('/', '.') + '/' + key; String keyFound = allKeysWithPackages.get(fullKey); - boolean bNotFound = keyFound == null ? true : false; + boolean bNotFound = keyFound == null; + + // ignore keys that can be used but not from preferences.properties + if (key.toLowerCase().contains("external_app") || + key.toLowerCase().contains("password") || + key.toLowerCase().contains("username")) { + bNotFound = false; + } + if (bNotFound) out.append("
"); out.append(escapeHtml(fullKey)) .append('=') @@ -95,9 +106,8 @@ private static Map getAllPropertyKeys() throws Exception if (jars.length == 1) jars = getAllJarFromManifest(jars[0]); for (String jarEntry : jars) { - File file = new File(jarEntry); - if (jarEntry.endsWith(".jar")) { + File file = new File(jarEntry); try (JarFile jarFile = new JarFile(file)) { Enumeration entries = jarFile.entries(); @@ -115,7 +125,24 @@ private static Map getAllPropertyKeys() throws Exception } } catch (IOException e) { System.err.println("Error opening JAR : " + jarEntry); - e.printStackTrace(); + } + } + else if (jarEntry.endsWith("classes")) { + Path startPath = Paths.get(jarEntry); + String filePattern = "preferences.properties"; + + System.out.println(startPath); + try (Stream paths = Files.walk(startPath)) { + paths.filter(path -> path.toString().endsWith(filePattern)) + .forEach(path -> { + try (InputStream inputStream = Files.newInputStream(path)) { + parsePropertiesWithPackage(inputStream, path.getFileName().toString(), allKeysWithPackages); + } catch (IOException e) { + System.err.println("Error opening properties : " + path); + } + }); + } catch (IOException e) { + System.err.println("Error listing files in : " + startPath); } } } @@ -148,7 +175,6 @@ private static String[] getAllJarFromManifest(String jarPath) { } } catch (IOException e) { System.err.println("Error when reading the jar : " + jarPath); - e.printStackTrace(); } return jars; From d1240883036cae0cda29dff0913313b0bf24997d Mon Sep 17 00:00:00 2001 From: lcaouen Date: Wed, 17 Dec 2025 13:34:43 +0100 Subject: [PATCH 4/4] exclude keys that must not be checked + Remove system.err and system.out --- .../preferences/PropertyPreferenceWriter.java | 71 +++++++++++-------- .../phoebus_ui_preferences.properties | 4 ++ 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java b/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java index 77fb372a0f..cc23f60f36 100644 --- a/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java +++ b/core/framework/src/main/java/org/phoebus/framework/preferences/PropertyPreferenceWriter.java @@ -19,16 +19,16 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; +import java.util.*; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.Manifest; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.prefs.Preferences; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import java.util.stream.Stream; /** Write preferences in property file format @@ -37,6 +37,10 @@ @SuppressWarnings("nls") public class PropertyPreferenceWriter { + public static final Logger logger = Logger.getLogger(PropertyPreferenceWriter.class.getName()); + public static Set excludedKeys = new HashSet<>(); + public static Set excludedPackages = new HashSet<>(); + /** Save preferences in property file format * *

Properties have the name "package/setting", @@ -50,16 +54,27 @@ public class PropertyPreferenceWriter */ public static void save(final OutputStream stream) throws Exception { + Map allKeysWithPackages = getAllPropertyKeys(); + Preferences prefs = Preferences.userRoot().node("org/phoebus/ui"); + + String value = prefs.get("excluded_keys_from_settings_check", ""); + if (value.isEmpty()) value = allKeysWithPackages.get("org.phoebus.ui/excluded_keys_from_settings_check"); + if (!value.isEmpty()) excludedKeys = Arrays.stream(value.split(",")).map(String::trim).collect(Collectors.toSet()); + + value = prefs.get("excluded_packages_from_settings_check", ""); + if (value.isEmpty()) value = allKeysWithPackages.get("org.phoebus.ui/excluded_packages_from_settings_check"); + if (!value.isEmpty()) excludedPackages = Arrays.stream(value.split(",")).map(String::trim).collect(Collectors.toSet()); + try ( - final OutputStreamWriter out = new OutputStreamWriter(stream); + final OutputStreamWriter out = new OutputStreamWriter(stream) ) { out.append("# Preference settings
\n"); out.append("# Format:
\n"); out.append("# the.package.name/key=value
\n"); out.append("

# key=value in red are incorrect properties

\n"); - listSettings(getAllPropertyKeys(), out, Preferences.userRoot()); + listSettings(allKeysWithPackages, out, Preferences.userRoot()); out.append("
\n"); out.append("# End.
\n"); out.flush(); @@ -81,12 +96,10 @@ private static void formatSetting(Map allKeysWithPackages, final String keyFound = allKeysWithPackages.get(fullKey); boolean bNotFound = keyFound == null; - // ignore keys that can be used but not from preferences.properties - if (key.toLowerCase().contains("external_app") || - key.toLowerCase().contains("password") || - key.toLowerCase().contains("username")) { - bNotFound = false; - } + // exclude keys that must not be checked + boolean containsExcludedKeys = excludedKeys.stream().anyMatch(key::contains); + boolean containsExcludedPackages = excludedPackages.stream().anyMatch(fullKey::startsWith); + if (containsExcludedKeys || containsExcludedPackages) bNotFound = false; if (bNotFound) out.append("
"); out.append(escapeHtml(fullKey)) @@ -96,12 +109,12 @@ private static void formatSetting(Map allKeysWithPackages, final if (bNotFound) out.append("
"); } - private static Map getAllPropertyKeys() throws Exception + private static Map getAllPropertyKeys() { Map allKeysWithPackages = new HashMap<>(); String classpath = System.getProperty("java.class.path"); - String[] jars = classpath.split(System.getProperty("path.separator")); + String[] jars = classpath.split(File.pathSeparator); if (jars.length == 1) jars = getAllJarFromManifest(jars[0]); @@ -123,26 +136,25 @@ private static Map getAllPropertyKeys() throws Exception ); } } - } catch (IOException e) { - System.err.println("Error opening JAR : " + jarEntry); + } catch (IOException ex) { + logger.log(Level.WARNING, "Error opening JAR : " + jarEntry, ex); } } else if (jarEntry.endsWith("classes")) { Path startPath = Paths.get(jarEntry); String filePattern = "preferences.properties"; - System.out.println(startPath); try (Stream paths = Files.walk(startPath)) { paths.filter(path -> path.toString().endsWith(filePattern)) .forEach(path -> { try (InputStream inputStream = Files.newInputStream(path)) { parsePropertiesWithPackage(inputStream, path.getFileName().toString(), allKeysWithPackages); - } catch (IOException e) { - System.err.println("Error opening properties : " + path); + } catch (IOException ex) { + logger.log(Level.WARNING, "Error opening properties file : " + path, ex); } }); - } catch (IOException e) { - System.err.println("Error listing files in : " + startPath); + } catch (IOException ex) { + logger.log(Level.WARNING, "Error listing files in : " + startPath, ex); } } } @@ -168,13 +180,13 @@ private static String[] getAllJarFromManifest(String jarPath) { jars[iJar] = fullPath.toString(); } } else { - System.err.println("No Class-Path found in MANIFEST.MF."); + logger.log(Level.WARNING, "No Class-Path found in MANIFEST.MF " + jarPath); } } else { - System.err.println("MANIFEST.MF not found in the JAR."); + logger.log(Level.WARNING, "MANIFEST.MF not found in the JAR " + jarPath); } - } catch (IOException e) { - System.err.println("Error when reading the jar : " + jarPath); + } catch (IOException ex) { + logger.log(Level.WARNING, "Error when reading the jar : " + jarPath, ex); } return jars; @@ -192,7 +204,7 @@ private static void parsePropertiesWithPackage(InputStream inputStream, String f line = line.trim(); if (line.startsWith("#") && line.contains("Package")) { // Find package name - Pattern pattern = Pattern.compile("#\\s*Package\\s+([^\\s]+)"); + Pattern pattern = Pattern.compile("#\\s*Package\\s+(\\S+)"); Matcher matcher = pattern.matcher(line); if (matcher.find()) { packageName = matcher.group(1); @@ -202,7 +214,7 @@ private static void parsePropertiesWithPackage(InputStream inputStream, String f } } - if (content.length() > 0) { + if (!content.isEmpty()) { props.load(new ByteArrayInputStream(content.toString().getBytes())); } @@ -211,9 +223,8 @@ private static void parsePropertiesWithPackage(InputStream inputStream, String f String prefixedKey = (packageName != null) ? packageName + "/" + key : key; allKeysWithPackages.put(prefixedKey, props.getProperty(key)); } - } catch (IOException e) { - System.err.println("Error when reading file " + fileName); - e.printStackTrace(); + } catch (IOException ex) { + logger.log(Level.WARNING, "Error when reading file " + fileName, ex); } } diff --git a/core/ui/src/main/resources/phoebus_ui_preferences.properties b/core/ui/src/main/resources/phoebus_ui_preferences.properties index c2de97ebeb..f122b696c7 100644 --- a/core/ui/src/main/resources/phoebus_ui_preferences.properties +++ b/core/ui/src/main/resources/phoebus_ui_preferences.properties @@ -290,3 +290,7 @@ default_window_title=CS-Studio # For a system file use syntax; 'file:' # For a file served over http use syntax: 'http://' custom_css_styling= + +# Keywords that can be excluded from the settings check in the About Dialog +excluded_keys_from_settings_check=external_app,password,username +excluded_packages_from_settings_check=eu.ess,fr.cea