chore: Exchange regex flag with group-based flagging

This commit is contained in:
Magnus Leßmann (@MarkL4YG) 2024-11-19 19:05:44 +01:00
parent 1380b39977
commit edc2bf70c6

View file

@ -42,8 +42,7 @@ public class OpenSSLCertificateCreator {
[alt_names] [alt_names]
"""; """;
private static final Pattern FINGERPRINT_EXTRACTOR = Pattern.compile( private static final Pattern FINGERPRINT_EXTRACTOR = Pattern.compile(
"^(?<algo>[0-9a-z]+) Fingerprint=(?<finger>[a-z:A-Z0-9]+)", "^(?<algo>[0-9a-zA-Z]+) (?i)Fingerprint(?-i)=(?<finger>[a-z:A-Z0-9]+)"
Pattern.CASE_INSENSITIVE
); );
private final ExecutableResolver executableResolver; private final ExecutableResolver executableResolver;
@ -293,7 +292,9 @@ public class OpenSSLCertificateCreator {
Matcher matcher = FINGERPRINT_EXTRACTOR.matcher(output); Matcher matcher = FINGERPRINT_EXTRACTOR.matcher(output);
if (!matcher.find()) { if (!matcher.find()) {
log.debug(output); log.debug(output);
throw new CommandLineOperationException("Unexpected output of fingerprint command. (See log for more details)"); throw new CommandLineOperationException(
"Unexpected output of fingerprint command. (See log for more details)"
);
} }
String algorithm = matcher.group("algo"); String algorithm = matcher.group("algo");
String fingerprint = matcher.group("finger"); String fingerprint = matcher.group("finger");