Skip to content

Allow whitelist to be loaded from fat jar files - #1465

Open
scottfrederick wants to merge 1 commit into
spring-cloud:mainfrom
scottfrederick:deser-types-fat-jar
Open

scottfrederick wants to merge 1 commit into
spring-cloud:mainfrom
scottfrederick:deser-types-fat-jar

Conversation

@scottfrederick

Copy link
Copy Markdown

The commit 0c5d5f3 added support for a META-INF/deserializable.types file that is read to determine the set of types that can be loaded by JsonMessageConverter. The file is read as a resource from the classpath.

When the file is in a jar file that is nested within another jar file (for example, a Spring Boot fat jar), the Files.readAllLines(Path.of(uri)) used to read the file as a resource will fail, preventing the message conversion.

This PR changes the file reading to use the streams API instead of the File API, which works when the file is in a flat jar or in a nested jar.

When a `META-INF/deserializable.types` file is located in a jar file
nested inside another jar file (for example, a Spring Boot fat jar),
it can be found as a resource but can't be read with
`Files.readAllLines`.

This commit changes the file reading to use an input stream that
allows the file to be read in this scenario.

Signed-off-by: Scott Frederick <scottyfred@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant