New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Preprocess JVM properties at app start to adjust to system environment. #2957
Conversation
After merge, issue #2853 can also be fixed. |
src/main/java/org/cryptomator/common/PropertiesPreprocessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/cryptomator/common/PropertiesPreprocessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/cryptomator/common/PropertiesPreprocessor.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Sebastian Stenzel <overheadhunter@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for the process
function with various inputs and their expected outputs as parameters?
src/main/java/org/cryptomator/common/PropertiesPreprocessor.java
Outdated
Show resolved
Hide resolved
Done in 2c0474e I had to circumvent a problem making the situation less clean: The logDir is specified by a property, which gets resolved at class initiatlization (due to creating a logger for Addiitonally, i changed on Windows some locations from appdata to localappdata. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dislike the static ENV
in the main class. Let's have a call to discuss alternative solutions for the initialization order problem.
src/test/java/org/cryptomator/common/PropertiesPreprocessorTest.java
Outdated
Show resolved
Hide resolved
This reverts commit b3d8df0.
* decorate Properties class * set the system properties to decorator * for logging setup, skip enviroment and access props over decorator
After some suggestions from @overheadhunter, I refactored the code.
The log configuration class now directly access the decorated properties instead of |
src/main/java/org/cryptomator/common/LazyProcessedProperties.java
Outdated
Show resolved
Hide resolved
src/main/java/org/cryptomator/common/LazyProcessedProperties.java
Outdated
Show resolved
Hide resolved
src/main/java/org/cryptomator/common/LazyProcessedProperties.java
Outdated
Show resolved
Hide resolved
src/main/java/org/cryptomator/common/SubstitutingProperties.java
Outdated
Show resolved
Hide resolved
src/test/java/org/cryptomator/common/SubstitutingPropertiesTest.java
Outdated
Show resolved
Hide resolved
Introduced with PR cryptomator#2957
Fixes #2838. Relates to #2885 (comment)
This PR introduces a preprocessing of JVM properties at application start to react system environments settings. The preprocessing is done in way which will be compatible with the JDK 21 preview feature of String templates.
To substitute a string in a property, it needs to be enclosed in
@( )
@{}
and may only contain the characters A-Z, a-z, 0-9 and _. Only the keywordsappdir
,appdata
,localappdata
anduserhome
are supported for now.TODO:
~
by@(userhome)
in code