Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit 9323b87

Browse files
authored
auto close json-schema InputStream (#1924)
1 parent 0c4ec08 commit 9323b87

File tree

1 file changed

+3
-2
lines changed
  • services/distribution/src/main/java/app/coronawarn/server/services/distribution/dgc/client

1 file changed

+3
-2
lines changed

services/distribution/src/main/java/app/coronawarn/server/services/distribution/dgc/client/JsonSchemaDecoder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ public Object decode(final Response response, final Type type) throws IOExceptio
5858
logger.debug("No validation JSON schema defined for: {}", response.request().url());
5959
return super.decode(response, type);
6060
}
61-
final InputStream schemaInputStream = resourceLoader.getResource(schemaPathToUse).getInputStream();
62-
validateJsonAgainstSchema(payloadJsonInputStream, schemaInputStream);
61+
try (final InputStream schemaInputStream = resourceLoader.getResource(schemaPathToUse).getInputStream()) {
62+
validateJsonAgainstSchema(payloadJsonInputStream, schemaInputStream);
63+
}
6364
return super.decode(response, type);
6465
}
6566

0 commit comments

Comments
 (0)