Skip to content

Commit 04b3b3c

Browse files
Merge pull request #255 from tls-attacker/dependabot/maven/de.rub.nds-protocol-toolkit-bom-6.1.1
build(deps): bump de.rub.nds:protocol-toolkit-bom from 6.0.1 to 6.1.1
2 parents 011df6a + 728c41c commit 04b3b3c

File tree

5 files changed

+98
-22
lines changed

5 files changed

+98
-22
lines changed

pom.xml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>de.rub.nds</groupId>
66
<artifactId>protocol-toolkit-bom</artifactId>
7-
<version>6.0.1</version>
7+
<version>6.1.1</version>
88
</parent>
99

1010
<artifactId>modifiable-variable</artifactId>
@@ -177,10 +177,20 @@
177177
<configuration>
178178
<source>${maven.compiler.source}</source>
179179
<target>${maven.compiler.target}</target>
180-
<compilerArgs>
181-
<compilerArg>-proc:full</compilerArg>
182-
</compilerArgs>
180+
<proc>full</proc>
183181
</configuration>
182+
<executions>
183+
<execution>
184+
<id>default-compile</id>
185+
<configuration>
186+
<compilerArgs>
187+
<!-- The following arguments are required for Log4J plugins (ExtendedPatternLayout) since Log4J 2.25.0 -->
188+
<arg>-Alog4j.graalvm.groupId=${project.groupId}</arg>
189+
<arg>-Alog4j.graalvm.artifactId=${project.artifactId}</arg>
190+
</compilerArgs>
191+
</configuration>
192+
</execution>
193+
</executions>
184194
</plugin>
185195
<!-- Execute unit tests -->
186196
<plugin>

src/main/java/de/rub/nds/modifiablevariable/logging/ExtendedPatternLayout.java

Lines changed: 77 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ private ExtendedPatternLayout(
101101
boolean disableAnsi,
102102
boolean noConsoleNoAnsi,
103103
String headerPattern,
104-
String footerPattern) {
104+
String footerPattern,
105+
boolean initNewLine,
106+
boolean prettyPrinting) {
105107
super(
106108
config,
107109
charset,
@@ -113,6 +115,8 @@ private ExtendedPatternLayout(
113115
.setDisableAnsi(disableAnsi)
114116
.setNoConsoleNoAnsi(noConsoleNoAnsi)
115117
.setPattern(headerPattern)
118+
.setInitNewLine(initNewLine)
119+
.setPrettyPrinting(prettyPrinting)
116120
.build(),
117121
newSerializerBuilder()
118122
.setConfiguration(config)
@@ -122,6 +126,8 @@ private ExtendedPatternLayout(
122126
.setDisableAnsi(disableAnsi)
123127
.setNoConsoleNoAnsi(noConsoleNoAnsi)
124128
.setPattern(footerPattern)
129+
.setInitNewLine(initNewLine)
130+
.setPrettyPrinting(prettyPrinting)
125131
.build());
126132
conversionPattern = eventPattern;
127133
this.patternSelector = patternSelector;
@@ -135,6 +141,8 @@ private ExtendedPatternLayout(
135141
.setNoConsoleNoAnsi(noConsoleNoAnsi)
136142
.setPattern(eventPattern)
137143
.setDefaultPattern("%m%n")
144+
.setInitNewLine(initNewLine)
145+
.setPrettyPrinting(prettyPrinting)
138146
.build();
139147
}
140148

@@ -339,6 +347,8 @@ public static ExtendedPatternLayout createLayout(
339347
.withNoConsoleNoAnsi(noConsoleNoAnsi)
340348
.withHeader(headerPattern)
341349
.withFooter(footerPattern)
350+
.withInitNewLine(false)
351+
.withPrettyPrinting(false)
342352
.build();
343353
}
344354

@@ -404,12 +414,8 @@ public static final class Builder
404414
@PluginBuilderAttribute private boolean noConsoleNoAnsi;
405415
@PluginBuilderAttribute private String header;
406416
@PluginBuilderAttribute private String footer;
407-
408-
@PluginBuilderAttribute("initNewLine")
409-
private static boolean initNewLine;
410-
411-
@PluginBuilderAttribute("prettyPrinting")
412-
private static boolean prettyPrinting;
417+
@PluginBuilderAttribute private boolean initNewLine;
418+
@PluginBuilderAttribute private boolean prettyPrinting;
413419

414420
private Builder() {
415421
super();
@@ -541,6 +547,28 @@ public ExtendedPatternLayout.Builder withFooter(String footer) {
541547
return this;
542548
}
543549

550+
/**
551+
* Sets whether to start byte array output on a new line.
552+
*
553+
* @param initNewLine Whether to initialize byte array output on a new line
554+
* @return This builder instance
555+
*/
556+
public ExtendedPatternLayout.Builder withInitNewLine(boolean initNewLine) {
557+
this.initNewLine = initNewLine;
558+
return this;
559+
}
560+
561+
/**
562+
* Sets whether to format byte arrays with spaces between bytes for readability.
563+
*
564+
* @param prettyPrinting Whether to pretty print byte arrays
565+
* @return This builder instance
566+
*/
567+
public ExtendedPatternLayout.Builder withPrettyPrinting(boolean prettyPrinting) {
568+
this.prettyPrinting = prettyPrinting;
569+
return this;
570+
}
571+
544572
/**
545573
* Builds a new ExtendedPatternLayout instance with the configured settings.
546574
*
@@ -565,7 +593,9 @@ public ExtendedPatternLayout build() {
565593
disableAnsi,
566594
noConsoleNoAnsi,
567595
header,
568-
footer);
596+
footer,
597+
initNewLine,
598+
prettyPrinting);
569599
}
570600
}
571601

@@ -655,6 +685,8 @@ public SerializerBuilder() {
655685
private boolean alwaysWriteExceptions;
656686
private boolean disableAnsi;
657687
private boolean noConsoleNoAnsi;
688+
private boolean initNewLine;
689+
private boolean prettyPrinting;
658690

659691
/**
660692
* Builds a serializer for formatting log events according to the configured settings.
@@ -685,7 +717,7 @@ public AbstractStringLayout.Serializer build() {
685717
noConsoleNoAnsi);
686718
PatternFormatter[] formatters = list.toArray(new PatternFormatter[0]);
687719
return new ExtendedPatternLayout.ExtendedPatternLayoutSerializer(
688-
formatters, replace);
720+
formatters, replace, initNewLine, prettyPrinting);
689721
} catch (RuntimeException var4) {
690722
throw new IllegalArgumentException(
691723
"Cannot parse pattern '" + pattern + "'", var4);
@@ -786,18 +818,47 @@ public ExtendedPatternLayout.SerializerBuilder setNoConsoleNoAnsi(boolean noCons
786818
this.noConsoleNoAnsi = noConsoleNoAnsi;
787819
return this;
788820
}
821+
822+
/**
823+
* Sets whether to start byte array output on a new line.
824+
*
825+
* @param initNewLine Whether to initialize byte array output on a new line
826+
* @return This builder instance
827+
*/
828+
public ExtendedPatternLayout.SerializerBuilder setInitNewLine(boolean initNewLine) {
829+
this.initNewLine = initNewLine;
830+
return this;
831+
}
832+
833+
/**
834+
* Sets whether to format byte arrays with spaces between bytes for readability.
835+
*
836+
* @param prettyPrinting Whether to pretty print byte arrays
837+
* @return This builder instance
838+
*/
839+
public ExtendedPatternLayout.SerializerBuilder setPrettyPrinting(boolean prettyPrinting) {
840+
this.prettyPrinting = prettyPrinting;
841+
return this;
842+
}
789843
}
790844

791845
private static final class ExtendedPatternLayoutSerializer
792846
implements AbstractStringLayout.Serializer, LocationAware {
793847
private final PatternFormatter[] formatters;
794848
private final RegexReplacement replace;
849+
private final boolean initNewLine;
850+
private final boolean prettyPrinting;
795851

796852
private ExtendedPatternLayoutSerializer(
797-
PatternFormatter[] formatters, RegexReplacement replace) {
853+
PatternFormatter[] formatters,
854+
RegexReplacement replace,
855+
boolean initNewLine,
856+
boolean prettyPrinting) {
798857
super();
799858
this.formatters = formatters;
800859
this.replace = replace;
860+
this.initNewLine = initNewLine;
861+
this.prettyPrinting = prettyPrinting;
801862
}
802863

803864
@Override
@@ -831,11 +892,13 @@ public String toSerializable(LogEvent event) {
831892
* </ul>
832893
* </ol>
833894
*
834-
* <p>The byte array formatting is controlled by two static configuration options:
895+
* <p>The byte array formatting is controlled by two configuration options:
835896
*
836897
* <ul>
837-
* <li>{@link Builder#prettyPrinting} - Whether to format with spaces between bytes
838-
* <li>{@link Builder#initNewLine} - Whether to start byte arrays on a new line
898+
* <li>{@link ExtendedPatternLayoutSerializer#prettyPrinting} - Whether to format with
899+
* spaces between bytes
900+
* <li>{@link ExtendedPatternLayoutSerializer#initNewLine} - Whether to start byte arrays
901+
* on a new line
839902
* </ul>
840903
*
841904
* @param event The LogEvent to serialize
@@ -870,9 +933,7 @@ public StringBuilder toSerializable(LogEvent event, StringBuilder builder) {
870933
builder.indexOf(Arrays.toString((byte[]) param))
871934
+ Arrays.toString((byte[]) param).length(),
872935
DataConverter.bytesToHexString(
873-
(byte[]) param,
874-
Builder.prettyPrinting,
875-
Builder.initNewLine));
936+
(byte[]) param, prettyPrinting, initNewLine));
876937
}
877938
}
878939
}

src/test/java/de/rub/nds/modifiablevariable/logging/ExtendedPatternLayoutTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ void testBuilderWithAllOptions() {
417417
.withNoConsoleNoAnsi(true)
418418
.withHeader(header)
419419
.withFooter(footer)
420+
.withInitNewLine(false)
421+
.withPrettyPrinting(false)
420422
.build();
421423

422424
assertNotNull(layout);
@@ -441,6 +443,8 @@ void testSerializerBuilderWithAllOptions() {
441443
builder.setAlwaysWriteExceptions(true);
442444
builder.setDisableAnsi(true);
443445
builder.setNoConsoleNoAnsi(true);
446+
builder.setInitNewLine(false);
447+
builder.setPrettyPrinting(false);
444448

445449
AbstractStringLayout.Serializer serializer = builder.build();
446450
assertNotNull(serializer);

src/test/java/de/rub/nds/modifiablevariable/util/ArrayConverterTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Random;
2222
import org.junit.jupiter.api.Test;
2323

24+
@SuppressWarnings("deprecation")
2425
class ArrayConverterTest {
2526

2627
/** Test of longToUint64Bytes method, of class ArrayConverter. */

src/test/java/de/rub/nds/modifiablevariable/util/BadRandomTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void testConstructorWithRandom() {
4545

4646
@Test
4747
@SuppressWarnings("deprecation")
48-
static void testDeprecatedConstructorWithRandomAndSeed() {
48+
void testDeprecatedConstructorWithRandomAndSeed() {
4949
// Test that the deprecated constructor works
5050
// Use a fresh Random for each BadRandom to ensure we're testing functionality
5151
Random random1 = new Random(42);
@@ -72,7 +72,7 @@ static void testDeprecatedConstructorWithRandomAndSeed() {
7272

7373
@Test
7474
@SuppressWarnings("deprecation")
75-
static void testDeprecatedConstructorWithRandomAndSpiAndProvider() {
75+
void testDeprecatedConstructorWithRandomAndSpiAndProvider() {
7676
// Test that the deprecated constructor works
7777
Random random1 = new Random(42);
7878
BadRandom badRandom = new BadRandom(random1, null, null);

0 commit comments

Comments
 (0)