apply suggestions from code review

This commit is contained in:
Armin Schrenk
2026-01-28 17:35:34 +01:00
parent 19c9eada9d
commit e9b3b505a8
3 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
# This is the Cryptomator administrative configuration file.
# It is a simple key-value pair file.
# Lines starting with '#' are comments and will be ignored.
# For more info, read the docs at https://docs.cryptomator.org.
# For more info, read the docs at https://docs.cryptomator.org/desktop/advanced-settings/
#
# Example:
# Sets the plugin directory and enables plugin loading
@@ -38,7 +38,6 @@ class AdminPropertiesSetter {
private static final Logger LOG = EventualLogger.getInstance();
private static final long MAX_CONFIG_SIZE_BYTES = 8192;
private static final String LINUX_DIR = "/etc/cryptomator";
private static final String MAC_DIR = "/Library/Application Support/Cryptomator";
private static final String WIN_DIR = "C:\\ProgramData\\Cryptomator";
@@ -50,6 +49,7 @@ class AdminPropertiesSetter {
"cryptomator.mountPointsDir", //
"cryptomator.disableUpdateCheck");
private static final Path ADMIN_PROPERTIES_FILE;
static {
final Path adminDir;
@@ -63,7 +63,6 @@ class AdminPropertiesSetter {
ADMIN_PROPERTIES_FILE = adminDir.resolve(CONFIG_NAME);
}
private static final Path ADMIN_PROPERTIES_FILE;
/**
* Adjusts the system properties by loading administrative properties from a predefined file location.
@@ -101,7 +100,7 @@ class AdminPropertiesSetter {
}
} catch (NoSuchFileException _) {
//NO-OP
LOG.debug("No admin properties found at {}.", adminPropertiesPath);
LOG.debug("No admin properties found at {}.", adminPropertiesPath);
} catch (IOException | IllegalArgumentException e) {
LOG.warn("Failed to read administrative properties from {}. Returning empty properties.", adminPropertiesPath, e);
}
@@ -50,7 +50,7 @@ public class AdminPropertiesSetterTest {
@Test
@DisplayName("Loading invalid file returns empty properties")
void loadEmptyFile(@TempDir Path path) throws IOException {
void loadInvalidFile(@TempDir Path path) throws IOException {
var config = path.resolve("config.properties");
try (var out = Files.newOutputStream(config, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE)) {
var bytes = "method=\\u2u20".getBytes(StandardCharsets.UTF_8); //only one "u" is allowed in a Unicode escape sequence