vy commented on code in PR #4098:
URL: https://github.com/apache/logging-log4j2/pull/4098#discussion_r3260828104
##########
log4j-1.2-api/src/test/java/org/apache/log4j/util/SerializationTestHelper.java:
##########
@@ -103,11 +108,23 @@ public static void assertStreamEquals(
* @throws Exception thrown on IO or deserialization exception.
*/
public static Object deserializeStream(final String witness) throws
Exception {
- try (final ObjectInputStream objIs = new ObjectInputStream(new
FileInputStream(witness))) {
+ try (final ObjectInputStream objIs = newObjectInputStream(new
FileInputStream(witness))) {
return objIs.readObject();
}
}
+ // FilteredObjectInputStream's default allow-list covers
`org.apache.logging.log4j.` but not
+ // the `org.apache.log4j.` 1.2-compatibility namespace, so we have to
enumerate the
+ // 1.2 classes that the tests in this module deserialize on Java 8.
+ private static final Collection<String> ALLOWED_LOG4J_1_2_CLASSES =
Review Comment:
Could you inline this to `newObjectInputStream` as a local variable, please?
You can do `if (ver == 8) { your-var-and-code-goes-here; } else { ... }`. Keep
the comments above the local var.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]