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 2a8e1b5822
commit 541bf76eba

View file

@ -42,8 +42,7 @@ public class OpenSSLCertificateCreator {
[alt_names]
""";
private static final Pattern FINGERPRINT_EXTRACTOR = Pattern.compile(
"^(?<algo>[0-9a-z]+) Fingerprint=(?<finger>[a-z:A-Z0-9]+)",
Pattern.CASE_INSENSITIVE
"^(?<algo>[0-9a-zA-Z]+) (?i)Fingerprint(?-i)=(?<finger>[a-z:A-Z0-9]+)"
);
private final ExecutableResolver executableResolver;
@ -293,7 +292,9 @@ public class OpenSSLCertificateCreator {
Matcher matcher = FINGERPRINT_EXTRACTOR.matcher(output);
if (!matcher.find()) {
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 fingerprint = matcher.group("finger");