Skip to content

Commit a03f434

Browse files
committed
Use try-with-resource
1 parent 8ed0e2b commit a03f434

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

solid/src/test/java/com/inrupt/client/solid/SolidClientTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,13 +455,12 @@ <T extends SolidClientException> void testRfc9457Exceptions(
455455
.apply(new Response<byte[]>() {
456456
@Override
457457
public byte[] body() {
458-
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
459-
try {
458+
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()){
460459
jsonService.toJson(problemDetails, bos);
460+
return bos.toByteArray();
461461
} catch (IOException e) {
462462
throw new RuntimeException(e);
463463
}
464-
return bos.toByteArray();
465464
}
466465

467466
@Override

0 commit comments

Comments
 (0)