|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2024 Contributors to the Eclipse Foundation. |
| 2 | + * Copyright (c) 2024, 2025 Contributors to the Eclipse Foundation. |
3 | 3 | * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
4 | 4 | *
|
5 | 5 | * This program and the accompanying materials are made available under the
|
|
27 | 27 | import java.io.File;
|
28 | 28 | import java.io.IOException;
|
29 | 29 | import java.net.Authenticator;
|
30 |
| -import java.net.URI; |
| 30 | +import java.nio.file.Path; |
31 | 31 | import java.util.List;
|
32 | 32 | import java.util.Properties;
|
33 | 33 | import java.util.logging.Logger;
|
@@ -87,28 +87,21 @@ void init(final TargetServer[] targetServers, final List<MessageSecurityConfig>
|
87 | 87 | }
|
88 | 88 |
|
89 | 89 | private void initLoginConfig() throws IOException {
|
90 |
| - /* |
91 |
| - * During Java Web Start launches, the appclientlogin.conf content is passed as a property. Store that content (if |
92 |
| - * present) into a local temporary file and use that during this app client launch. |
93 |
| - */ |
| 90 | + |
| 91 | + // During Java Web Start launches, the appclientlogin.conf content is passed as a property. |
| 92 | + // Store that content (if present) into a local temporary file and use that during this app client launch. |
94 | 93 | final String appclientloginConfContent = System.getProperty("appclient.login.conf.content");
|
95 |
| - URI configURI; |
| 94 | + final File configFile; |
96 | 95 | if (appclientloginConfContent == null) {
|
97 |
| - configURI = new File(System.getProperty(INSTALL_ROOT.getSystemPropertyName())).toURI() |
98 |
| - .resolve("lib/appclient/appclientlogin.conf"); |
| 96 | + configFile = new File(System.getProperty(INSTALL_ROOT.getSystemPropertyName())).toPath() |
| 97 | + .resolve(Path.of("lib", "appclient", "appclientlogin.conf")).toFile(); |
99 | 98 | } else {
|
100 |
| - configURI = writeTextToTempFile(appclientloginConfContent, "appclientlogin", ".conf", false).toURI(); |
| 99 | + configFile = writeTextToTempFile(appclientloginConfContent, "appclientlogin", ".conf", false); |
101 | 100 | }
|
102 | 101 |
|
103 |
| - final File configFile = new File(configURI); |
104 |
| - |
105 |
| - /* |
106 |
| - * Ugly, but necessary. The Java com.sun.security.auth.login.ConfigFile class expects the |
107 |
| - * java.security.auth.login.config property value to be a URL, but one with NO encoding. That is, if the path to the |
108 |
| - * config file contains a blank then ConfigFile class expects the URL to contain a blank, not %20 for example. So, we |
109 |
| - * need to use the deprecated File.toURL() method to create such a URL. |
110 |
| - */ |
111 |
| - System.setProperty("java.security.auth.login.config", configFile.toURI().toURL().toString()); |
| 102 | + // The Java com.sun.security.auth.login.ConfigFile class expects the |
| 103 | + // java.security.auth.login.config property value to be a URL |
| 104 | + System.setProperty("java.security.auth.login.config", configFile.toURI().toURL().toExternalForm()); |
112 | 105 | }
|
113 | 106 |
|
114 | 107 | /**
|
|
0 commit comments