Skip to content

Commit fcd4a55

Browse files
committed
OWS-634: Allow deployment config to load a custom properties file
1 parent e7428c3 commit fcd4a55

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

core/src/main/java/net/sourceforge/jnlp/config/DeploymentConfiguration.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@
3535
import java.io.InputStreamReader;
3636
import java.io.OutputStream;
3737
import java.io.PrintStream;
38-
import java.io.Reader;
3938
import java.net.ConnectException;
4039
import java.net.MalformedURLException;
4140
import java.net.URL;
42-
import java.net.URLConnection;
4341
import java.nio.charset.StandardCharsets;
4442
import java.text.SimpleDateFormat;
4543
import java.util.Date;
@@ -65,6 +63,7 @@ public final class DeploymentConfiguration {
6563

6664
private static final Logger LOG = LoggerFactory.getLogger(DeploymentConfiguration.class);
6765
public static final String LOCKED_POSTFIX = ".locked";
66+
public static final String LOCAL_DEPLOYMENT_PROPERTIES_FILE_PATH = "localDeploymentPropertiesFilePath";
6867

6968
private String userComments;
7069

@@ -185,11 +184,11 @@ public void load() throws ConfigurationException {
185184
* @throws ConfigurationException if it encounters a fatal error.
186185
*/
187186
public void load(final boolean fixIssues) throws ConfigurationException, MalformedURLException {
188-
final String owsUserPropertiesFilePath = System.getProperty("owsUserPropertiesFilePath");
187+
final String localDeploymentPropertiesFilePath = System.getProperty(LOCAL_DEPLOYMENT_PROPERTIES_FILE_PATH);
189188
final SecurityManager sm = System.getSecurityManager();
190189
if (sm != null) {
191-
if (owsUserPropertiesFilePath != null) {
192-
sm.checkRead(owsUserPropertiesFilePath);
190+
if (localDeploymentPropertiesFilePath != null) {
191+
sm.checkRead(localDeploymentPropertiesFilePath);
193192
} else {
194193
sm.checkRead(userDeploymentFileDescriptor.getFullPath());
195194
}
@@ -209,7 +208,7 @@ public void load(final boolean fixIssues) throws ConfigurationException, Malform
209208
/*
210209
* Third, read the user's subdirResult deployment.properties file or the custom config properties
211210
*/
212-
userPropertiesFile = owsUserPropertiesFilePath != null ? new File(owsUserPropertiesFilePath) : userDeploymentFileDescriptor.getFile();
211+
userPropertiesFile = localDeploymentPropertiesFilePath != null ? new File(localDeploymentPropertiesFilePath) : userDeploymentFileDescriptor.getFile();
213212
final URL userPropertiesUrl = userPropertiesFile.toURI().toURL();
214213
final Map<String, Setting> userProperties = loadProperties(ConfigType.USER, userPropertiesUrl, false);
215214
userComments = loadComments(userPropertiesUrl);

0 commit comments

Comments
 (0)