Skip to content

Commit

Permalink
Fix compile/checkstyle warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kstich committed Jan 3, 2024
1 parent 6ec9457 commit 7f1b35b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private List<ValidationEvent> validateEndpointPatterns(
"InvalidEndpointPatternScheme"));
}

if (!isValidURL(endpoint)) {
if (!isValidUrl(endpoint)) {
events.add(error(
serviceShape, location,
String.format("Endpoint `%s` should be a valid URL.",
Expand All @@ -126,16 +126,14 @@ private List<ValidationEvent> validateEndpointPatterns(
return events;
}

private boolean isValidURL(String endpointPattern) {
private boolean isValidUrl(String endpointPattern) {
String url = endpointPattern
.replace("{", "")
.replace("}", "");
try {
new URL(url).toURI();
return true;
} catch (MalformedURLException e) {
return false;
} catch (URISyntaxException e) {
} catch (MalformedURLException | URISyntaxException e) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ private static Stream<Arguments> protocolHeaderCases() {

@ParameterizedTest
@MethodSource("protocolHeaderCases")
@SuppressWarnings("unchecked")
public void assertProtocolHeaders(
String operationId,
Set<String> expectedRequestHeaders,
Expand Down

0 comments on commit 7f1b35b

Please sign in to comment.