Skip to content

Commit 42e9ca2

Browse files
authored
Fix for Jenkins Malformed encoding (#823)
1 parent 8d40058 commit 42e9ca2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

build-info-extractor/src/main/java/org/jfrog/build/extractor/BuildInfoExtractorUtils.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ private static Properties searchAdditionalPropertiesFile(Properties existingProp
111111
} else {
112112
try (InputStream inputStream = Files.newInputStream(propertiesFile.toPath())) {
113113
props.load(inputStream);
114+
} catch (IllegalArgumentException e) {
115+
log.warn("[buildinfo] Properties file contains malformed Unicode encoding. Attempting to load with UTF-8 encoding: " + e.getMessage());
116+
try (BufferedReader reader = Files.newBufferedReader(propertiesFile.toPath(), StandardCharsets.UTF_8)) {
117+
props.load(reader);
118+
} catch (Exception fallbackException) {
119+
log.error("[buildinfo] Failed to load properties file even with UTF-8 fallback: " + fallbackException.getMessage());
120+
}
114121
}
115122
}
116123
} catch (IOException | InvalidAlgorithmParameterException | IllegalBlockSizeException | NoSuchPaddingException |

0 commit comments

Comments
 (0)