From f350b34ae11ead0fe06c5c2a6ec5c7c5b3543d9b Mon Sep 17 00:00:00 2001 From: Naga Vijayapuram Date: Wed, 14 Jul 2021 06:37:41 -0700 Subject: [PATCH] Update TrackingFileManager.java This PR is to spot files that have malformed encoding by setting the system property "spot_file_with_malformed_encoding" on the mvn command-line ... `mvn -Dspot_file_with_malformed_encoding=true` This should help with https://issues.apache.org/jira/browse/MRESOLVER-153 --- .../aether/internal/impl/TrackingFileManager.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/TrackingFileManager.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/TrackingFileManager.java index e31f0969c..d9efdc187 100644 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/TrackingFileManager.java +++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/TrackingFileManager.java @@ -53,7 +53,17 @@ public Properties read( File file ) stream = new FileInputStream( file ); Properties props = new Properties(); - props.load( stream ); + + if (System.getProperty("spot_file_with_malformed_encoding").equals("true")) { + try { + props.load(stream); + } catch (Throwable t) { + System.out.println("\nfile: " + file + "\n"); + System.exit(1); + } + } else { + props.load(stream); + } return props; }