Skip to content

Commit cac23a1

Browse files
authored
JCL-373: Address minor compiler warnings (#503)
1 parent ba97a28 commit cac23a1

File tree

11 files changed

+21
-17
lines changed

11 files changed

+21
-17
lines changed

access-grant/src/main/java/com/inrupt/client/accessgrant/AccessGrantClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,7 @@ public <T extends AccessCredential> CompletionStage<T> fetch(final URI identifie
576576
});
577577
}
578578

579-
580-
579+
@SuppressWarnings("unchecked")
581580
<T extends AccessCredential> T processVerifiableCredential(final InputStream input, final Set<String> validTypes,
582581
final Class<T> clazz) throws IOException {
583582
final Map<String, Object> data = jsonService.fromJson(input,
@@ -601,6 +600,7 @@ <T extends AccessCredential> T processVerifiableCredential(final InputStream inp
601600
throw new AccessGrantException("Invalid Access Grant: missing supported type");
602601
}
603602

603+
@SuppressWarnings("unchecked")
604604
<T extends AccessCredential> List<T> processQueryResponse(final InputStream input, final Set<String> validTypes,
605605
final Class<T> clazz) throws IOException {
606606
final Map<String, Object> data = jsonService.fromJson(input,
@@ -676,7 +676,9 @@ byte[] serialize(final Map<String, Object> data) {
676676
static Collection<Object> getCredentials(final Map<String, Object> data) {
677677
final Object credential = data.get(VERIFIABLE_CREDENTIAL);
678678
if (credential instanceof Collection) {
679-
return (Collection) credential;
679+
@SuppressWarnings("unchecked")
680+
final Collection<Object> coll = (Collection<Object>) credential;
681+
return coll;
680682
}
681683
return Collections.emptyList();
682684
}

access-grant/src/test/java/com/inrupt/client/accessgrant/AccessGrantSessionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void testAccessGrantSession() throws IOException {
9090
final String token = AccessGrantTestUtils.generateIdToken(claims);
9191

9292
try (final InputStream resource = AccessGrantTest.class.getResourceAsStream("/access_grant1.json")) {
93-
final AccessGrant grant = AccessGrant.ofAccessGrant(resource);
93+
final AccessGrant grant = AccessGrant.of(resource);
9494
final Session session = AccessGrantSession.ofAccessGrant(OpenIdSession.ofIdToken(token), grant);
9595
assertEquals(Optional.of(URI.create(WEBID)), session.getPrincipal());
9696
assertFalse(grant.getResources().isEmpty());
@@ -120,7 +120,7 @@ void testProtectedResource() throws IOException {
120120
final String token = AccessGrantTestUtils.generateIdToken(claims);
121121

122122
try (final InputStream resource = AccessGrantTest.class.getResourceAsStream("/access_grant3.json")) {
123-
final AccessGrant grant = AccessGrant.ofAccessGrant(resource);
123+
final AccessGrant grant = AccessGrant.of(resource);
124124
final Session session = AccessGrantSession.ofAccessGrant(OpenIdSession.ofIdToken(token), grant);
125125
final Request req = Request.newBuilder(URI.create("https://storage.example/protected-resource")).build();
126126
final Authenticator auth = new OpenIdAuthenticationProvider().getAuthenticator(Challenge.of("Bearer"));

examples/cli/src/main/java/com/inrupt/client/examples/cli/SolidApp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public int run(final String... args) {
8282
printWriter.format("WebID: %s", webid);
8383
printWriter.println();
8484
try (final var profile = client.read(webid, WebIdProfile.class)) {
85-
profile.getStorage().stream().findFirst().ifPresent(storage -> {
85+
profile.getStorages().stream().findFirst().ifPresent(storage -> {
8686
printWriter.format("Storage %s ", storage);
8787
printWriter.println();
8888
try (final var container = client.read(storage, SolidContainer.class)) {

examples/springboot/src/main/java/com/inrupt/client/examples/springboot/SecurityConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.springframework.beans.factory.annotation.Autowired;
2424
import org.springframework.context.annotation.Bean;
2525
import org.springframework.context.annotation.Configuration;
26+
import org.springframework.security.config.Customizer;
2627
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
2728
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
2829
import org.springframework.security.oauth2.client.oidc.authentication.OidcIdTokenDecoderFactory;
@@ -55,7 +56,7 @@ public SecurityFilterChain securityFilterChain(final HttpSecurity http) throws E
5556
.deleteCookies("JSESSIONID")
5657
.logoutSuccessHandler(oidcLogoutSuccessHandler())
5758
)
58-
.oauth2Login();
59+
.oauth2Login(Customizer.withDefaults());
5960
return http.build();
6061
}
6162

examples/webapp/src/main/java/com/inrupt/client/examples/webapp/SolidStorage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public CompletionStage<TemplateInstance> solid() {
7575
return jwt.claim("webid").map(String.class::cast).map(URI::create).map(webid -> {
7676
final var session = client.session(OpenIdSession.ofIdToken(jwt.getRawToken()));
7777
return session.read(webid, WebIdProfile.class)
78-
.thenCompose(profile -> profile.getStorage().stream().findFirst().map(storage ->
78+
.thenCompose(profile -> profile.getStorages().stream().findFirst().map(storage ->
7979
session.read(storage, SolidContainer.class).thenApply(container -> {
8080
try (container) {
8181
final var resources = container.getResources().stream()

integration/base/src/main/java/com/inrupt/client/integration/base/AccessGrantScenarios.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ static void setup() throws IOException {
145145
State.WEBID = URI.create(webidUrl);
146146
final SolidSyncClient client = SolidSyncClient.getClientBuilder().build();
147147
try (final WebIdProfile profile = client.read(URI.create(webidUrl), WebIdProfile.class)) {
148-
issuer = profile.getOidcIssuer().iterator().next().toString();
149-
podUrl = profile.getStorage().iterator().next().toString();
148+
issuer = profile.getOidcIssuers().iterator().next().toString();
149+
podUrl = profile.getStorages().iterator().next().toString();
150150
}
151151
if (!podUrl.endsWith(Utils.FOLDER_SEPARATOR)) {
152152
podUrl += Utils.FOLDER_SEPARATOR;

integration/base/src/main/java/com/inrupt/client/integration/base/AuthenticationScenarios.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ static void setup() {
117117
State.WEBID = URI.create(webidUrl);
118118
final SolidSyncClient client = SolidSyncClient.getClient();
119119
try (final WebIdProfile profile = client.read(URI.create(webidUrl), WebIdProfile.class)) {
120-
issuer = profile.getOidcIssuer().iterator().next().toString();
121-
podUrl = profile.getStorage().iterator().next().toString();
120+
issuer = profile.getOidcIssuers().iterator().next().toString();
121+
podUrl = profile.getStorages().iterator().next().toString();
122122
}
123123
if (!podUrl.endsWith(Utils.FOLDER_SEPARATOR)) {
124124
podUrl += Utils.FOLDER_SEPARATOR;

integration/base/src/main/java/com/inrupt/client/integration/base/DomainModulesResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static void setup() {
109109
State.WEBID = URI.create(webidUrl);
110110
//find storage from WebID using domain-specific webID solid concept
111111
try (final WebIdProfile sameProfile = client.read(URI.create(webidUrl), WebIdProfile.class)) {
112-
final var storages = sameProfile.getStorage();
112+
final var storages = sameProfile.getStorages();
113113
if (!storages.isEmpty()) {
114114
podUrl = storages.iterator().next().toString();
115115
}
@@ -253,7 +253,7 @@ void findStorageTest() {
253253
LOGGER.info("Integration Test - find pod storage from webID");
254254

255255
try (final WebIdProfile sameProfile = client.read(URI.create(webidUrl), WebIdProfile.class)) {
256-
assertFalse(sameProfile.getStorage().isEmpty());
256+
assertFalse(sameProfile.getStorages().isEmpty());
257257
}
258258

259259
final var missingWebId = URIBuilder.newBuilder(URI.create(webidUrl)).path(UUID.randomUUID().toString()).build();

integration/base/src/test/java/com/inrupt/client/integration/base/ServerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ static void setup() {
9090
State.WEBID = URI.create(webidUrl);
9191
final SolidSyncClient client = SolidSyncClient.getClient();
9292
try (final WebIdProfile profile = client.read(URI.create(webidUrl), WebIdProfile.class)) {
93-
issuer = profile.getOidcIssuer().iterator().next().toString();
94-
podUrl = profile.getStorage().iterator().next().toString();
93+
issuer = profile.getOidcIssuers().iterator().next().toString();
94+
podUrl = profile.getStorages().iterator().next().toString();
9595
}
9696
}
9797

openid/src/main/java/com/inrupt/client/openid/OpenIdAuthenticationProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public OpenIdAuthenticationProvider(final int priority) {
5858
this.priorityLevel = priority;
5959
}
6060

61+
/* deprecated */
6162
@Override
6263
public String getScheme() {
6364
return BEARER;

0 commit comments

Comments
 (0)