1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-10 18:59:39 +02:00

SOP: Hide armor version header by default

This commit is contained in:
Paul Schaub 2022-11-11 13:45:25 +01:00
parent 48005da7f3
commit 86b06ee5e3
3 changed files with 19 additions and 6 deletions

View file

@ -31,7 +31,11 @@ public final class ArmoredOutputStreamFactory {
*/
public static ArmoredOutputStream get(OutputStream outputStream) {
ArmoredOutputStream armoredOutputStream = new ArmoredOutputStream(outputStream);
armoredOutputStream.setHeader(ArmorUtils.HEADER_VERSION, version);
armoredOutputStream.clearHeaders();
if (version != null && !version.isEmpty()) {
armoredOutputStream.setHeader(ArmorUtils.HEADER_VERSION, version);
}
for (String comment : comment) {
ArmorUtils.addCommentHeader(armoredOutputStream, comment);
}
@ -55,10 +59,16 @@ public final class ArmoredOutputStreamFactory {
* @param versionString version string
*/
public static void setVersionInfo(String versionString) {
if (versionString == null || versionString.trim().isEmpty()) {
throw new IllegalArgumentException("Version Info MUST NOT be null NOR empty.");
if (versionString == null) {
version = null;
return;
}
String trimmed = versionString.trim();
if (trimmed.isEmpty()) {
version = null;
} else {
version = trimmed;
}
version = versionString;
}
/**