- Timestamp:
- 2024-03-04T17:06:32+01:00 (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
r18991 r19007 17 17 import java.beans.PropertyChangeListener; 18 18 import java.net.URI; 19 import java.net.URISyntaxException; 19 20 import java.util.Arrays; 20 21 import java.util.Objects; … … 318 319 if (procedure == AuthorizationProcedure.MANUALLY) { 319 320 this.setEnabled(true); 320 } else if (Utils.isValidUrl(apiUrl) && DomainValidator.getInstance().isValid(URI.create(apiUrl).getHost())) { 321 // We want to avoid trying to make connection with an invalid URL 322 final String currentApiUrl = apiUrl; 323 MainApplication.worker.execute(() -> { 324 final String clientId = OAuthParameters.createDefault(apiUrl, oAuthVersion).getClientId(); 325 if (Objects.equals(apiUrl, currentApiUrl)) { 326 GuiHelper.runInEDT(() -> this.setEnabled(!Utils.isEmpty(clientId))); 327 } 328 }); 321 } else if (Utils.isValidUrl(apiUrl)) { 322 final URI apiURI; 323 try { 324 apiURI = new URI(apiUrl); 325 } catch (URISyntaxException e) { 326 Logging.trace(e); 327 return; 328 } 329 if (DomainValidator.getInstance().isValid(apiURI.getHost())) { 330 // We want to avoid trying to make connection with an invalid URL 331 final String currentApiUrl = apiUrl; 332 MainApplication.worker.execute(() -> { 333 final String clientId = OAuthParameters.createDefault(apiUrl, oAuthVersion).getClientId(); 334 if (Objects.equals(apiUrl, currentApiUrl)) { 335 GuiHelper.runInEDT(() -> this.setEnabled(!Utils.isEmpty(clientId))); 336 } 337 }); 338 } 329 339 } 330 340 }
Note:
See TracChangeset
for help on using the changeset viewer.