Skip to content

Commit 64c7fe1

Browse files
committed
Bug fixes for null values
1 parent 1158269 commit 64c7fe1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

swarm-java-simplified/src/net/groboclown/p4/simpleswarm/impl/BasicRequest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ static BasicResponse get(SwarmConfig config, String path)
5555
static BasicResponse get(SwarmConfig config, String path, Map<String, ?> query)
5656
throws IOException, UnauthorizedAccessException {
5757
final String url = toUrl(config, path, query);
58+
if (url == null) {
59+
throw new IOException("No swarm URL in configuration");
60+
}
5861
final HttpGet request = new HttpGet(url);
5962
return request(config, request);
6063
}
@@ -210,6 +213,9 @@ static Collection<String> toEncodedValues(String key, Object val)
210213

211214
static String toUrl(SwarmConfig config, String path, Map<String, ?> query)
212215
throws UnsupportedEncodingException {
216+
if (config == null || path == null || config.getUri() == null) {
217+
return null;
218+
}
213219
return config.getUri().toASCIIString() + API_PATH + config.getVersionPath() + path +
214220
toQuery(query);
215221
}

0 commit comments

Comments
 (0)