|
22 | 22 |
|
23 | 23 | import com.inrupt.client.*; |
24 | 24 | import com.inrupt.client.auth.Session; |
25 | | -import com.inrupt.client.spi.JsonService; |
26 | | -import com.inrupt.client.spi.ServiceProvider; |
27 | 25 |
|
28 | 26 | import java.io.ByteArrayInputStream; |
29 | 27 | import java.io.IOException; |
30 | 28 | import java.io.InputStream; |
31 | 29 | import java.net.URI; |
32 | | -import java.nio.charset.StandardCharsets; |
33 | 30 | import java.util.Collections; |
34 | 31 | import java.util.List; |
35 | 32 | import java.util.Map; |
@@ -127,7 +124,10 @@ public <T extends Resource> CompletionStage<T> read(final URI identifier, final |
127 | 124 | final Request request = builder.build(); |
128 | 125 | return client.send( |
129 | 126 | request, |
130 | | - Response.BodyHandlers.throwOnError(Response.BodyHandlers.ofByteArray(), (r) -> isSuccess(r.statusCode())) |
| 127 | + Response.BodyHandlers.throwOnError( |
| 128 | + Response.BodyHandlers.ofByteArray(), |
| 129 | + (r) -> isSuccess(r.statusCode()) |
| 130 | + ) |
131 | 131 | ).thenApply(response -> { |
132 | 132 | final String contentType = response.headers().firstValue(CONTENT_TYPE) |
133 | 133 | .orElse("application/octet-stream"); |
@@ -157,7 +157,7 @@ public <T extends Resource> CompletionStage<T> read(final URI identifier, final |
157 | 157 | if (exception instanceof ClientHttpException) { |
158 | 158 | throw SolidClientException.handle((ClientHttpException) exception); |
159 | 159 | } |
160 | | - throw new RuntimeException("Something went wrong reading "+request.uri(), exception); |
| 160 | + throw new RuntimeException("Something went wrong reading " + request.uri(), exception); |
161 | 161 | }); |
162 | 162 | } |
163 | 163 |
|
@@ -277,18 +277,18 @@ public <T extends Resource> CompletionStage<Void> delete(final T resource, final |
277 | 277 | headers.firstValue(USER_AGENT).ifPresent(agent -> builder.setHeader(USER_AGENT, agent)); |
278 | 278 |
|
279 | 279 | return client.send( |
280 | | - builder.build(), |
281 | | - Response.BodyHandlers.throwOnError( |
282 | | - Response.BodyHandlers.ofByteArray(), |
283 | | - (r) -> isSuccess(r.statusCode()) |
284 | | - ) |
285 | | - ).exceptionally(exception -> { |
| 280 | + builder.build(), |
| 281 | + Response.BodyHandlers.throwOnError( |
| 282 | + Response.BodyHandlers.ofByteArray(), |
| 283 | + (r) -> isSuccess(r.statusCode()) |
| 284 | + ) |
| 285 | + ).exceptionally(exception -> { |
286 | 286 | if (exception instanceof ClientHttpException) { |
287 | 287 | throw SolidClientException.handle((ClientHttpException) exception); |
288 | 288 | } |
289 | | - throw new RuntimeException("Something went wrong reading "+resource.getIdentifier(), exception); |
| 289 | + throw new RuntimeException("Something went wrong reading " + resource.getIdentifier(), exception); |
290 | 290 | // FIXME I don't understand why the following is required. |
291 | | - }).thenAccept(o -> {}); |
| 291 | + }).thenAccept(o -> { /* no-op */ }); |
292 | 292 | } |
293 | 293 |
|
294 | 294 | /** |
|
0 commit comments