Skip to content

Commit

Permalink
Changed use of deprecated URL constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
hylkevds committed Apr 8, 2024
1 parent 3a19502 commit c0d0a65
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import de.fraunhofer.iosb.ilt.frostserver.settings.MqttSettings;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
Expand Down Expand Up @@ -98,7 +98,7 @@ private void init(ServerVersion serverVersion, Map<String, String> properties) {
TestSuite suite = TestSuite.getInstance();
serverSettings = suite.getServerSettings(properties);
try {
service = new StaService(new URL(serverSettings.getServiceUrl(version)));
service = new StaService(new URI(serverSettings.getServiceUrl(version)).toURL());
sSrvc = service.service;
sMdl = service.modelSensing;
mMdl = service.modelMultiDatastream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
import de.fraunhofer.iosb.ilt.statests.util.EntityUtils;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -92,15 +93,15 @@ protected void setUpVersion() {
protected SensorThingsService createService() {
if (!sSrvc.isEndpointSet()) {
try {
sSrvc.setEndpoint(new URL(serverSettings.getServiceUrl(version)));
} catch (MalformedURLException ex) {
sSrvc.setEndpoint(new URI(serverSettings.getServiceUrl(version)));
} catch (MalformedURLException | URISyntaxException ex) {
throw new IllegalArgumentException("Serversettings contains malformed URL.", ex);
}
}
try {
return new SensorThingsService(sSrvc.getModelRegistry())
.setEndpoint(new URL(serverSettings.getServiceUrl(version)));
} catch (MalformedURLException ex) {
.setEndpoint(new URI(serverSettings.getServiceUrl(version)));
} catch (MalformedURLException | URISyntaxException ex) {
throw new IllegalArgumentException("Serversettings contains malformed URL.", ex);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import de.fraunhofer.iosb.ilt.statests.util.Utils;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -277,15 +278,15 @@ private String typeFromSelfLink(String selfLink) {
private SensorThingsService createService() {
if (!baseService.isEndpointSet()) {
try {
baseService.setEndpoint(new URL(serverSettings.getServiceUrl(version)));
} catch (MalformedURLException ex) {
baseService.setEndpoint(new URI(serverSettings.getServiceUrl(version)));
} catch (URISyntaxException | MalformedURLException ex) {
throw new IllegalArgumentException("Serversettings contains malformed URL.", ex);
}
}
try {
return new SensorThingsService(baseService.getModelRegistry())
.setEndpoint(new URL(serverSettings.getServiceUrl(version)));
} catch (MalformedURLException ex) {
.setEndpoint(new URI(serverSettings.getServiceUrl(version)));
} catch (URISyntaxException | MalformedURLException ex) {
throw new IllegalArgumentException("Serversettings contains malformed URL.", ex);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
import de.fraunhofer.iosb.ilt.statests.TestSuite;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -127,15 +128,15 @@ void test_100_ReadUser() {
protected SensorThingsService createService() {
if (!baseService.isEndpointSet()) {
try {
baseService.setEndpoint(new URL(serverSettings.getServiceUrl(version)));
} catch (MalformedURLException ex) {
baseService.setEndpoint(new URI(serverSettings.getServiceUrl(version)));
} catch (MalformedURLException | URISyntaxException ex) {
throw new IllegalArgumentException("Serversettings contains malformed URL.", ex);
}
}
try {
return new SensorThingsService(baseService.getModelRegistry())
.setEndpoint(new URL(serverSettings.getServiceUrl(version)));
} catch (MalformedURLException ex) {
.setEndpoint(new URI(serverSettings.getServiceUrl(version)));
} catch (MalformedURLException | URISyntaxException ex) {
throw new IllegalArgumentException("Serversettings contains malformed URL.", ex);
}
}
Expand Down

0 comments on commit c0d0a65

Please sign in to comment.