"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/AbstractActionTest.java" between
apache-log4j-2.12.3-src.tar.gz and apache-log4j-2.12.4-src.tar.gz

About: Apache Log4j 2 is a logging library for Java. Source distribution (Java).
Caution: Release 2.12.3 is the last 2.x release to support Java 7 (Java 8 users should use 2.17.0 or greater) and have fixed a critical remote code execution vulnerability (CVE-2021-44228).

AbstractActionTest.java  (apache-log4j-2.12.3-src):AbstractActionTest.java  (apache-log4j-2.12.4-src)
skipping to change at line 48 skipping to change at line 48
@Test @Test
public void testExceptionsAreLoggedToStatusLogger() { public void testExceptionsAreLoggedToStatusLogger() {
StatusLogger statusLogger = StatusLogger.getLogger(); StatusLogger statusLogger = StatusLogger.getLogger();
statusLogger.clear(); statusLogger.clear();
new TestAction().run(); new TestAction().run();
List<StatusData> statusDataList = statusLogger.getStatusData(); List<StatusData> statusDataList = statusLogger.getStatusData();
assertEquals(1, statusDataList.size()); assertEquals(1, statusDataList.size());
StatusData statusData = statusDataList.get(0); StatusData statusData = statusDataList.get(0);
assertEquals(Level.WARN, statusData.getLevel()); assertEquals(Level.WARN, statusData.getLevel());
String formattedMessage = statusData.getFormattedStatus(); String formattedMessage = statusData.getFormattedStatus();
assertTrue(formattedMessage.contains("Exception reported by action 'clas s org.apache." + String expected = String.format("Exception reported by action 'class org .apache." +
"logging.log4j.core.appender.rolling.action.AbstractActionTest$T estAction' java.io.IOException: " + "logging.log4j.core.appender.rolling.action.AbstractActionTest$T estAction' java.io.IOException: " +
"failed\n\tat org.apache.logging.log4j.core.appender.rolling.act "failed%n\tat org.apache.logging.log4j.core.appender.rolling.act
ion.AbstractActionTest" + ion.AbstractActionTest" +
"$TestAction.execute(AbstractActionTest.java:")); "$TestAction.execute(AbstractActionTest.java:");
assertTrue(formattedMessage.contains(expected));
} }
@Test @Test
public void testRuntimeExceptionsAreLoggedToStatusLogger() { public void testRuntimeExceptionsAreLoggedToStatusLogger() {
StatusLogger statusLogger = StatusLogger.getLogger(); StatusLogger statusLogger = StatusLogger.getLogger();
statusLogger.clear(); statusLogger.clear();
new AbstractAction() { new AbstractAction() {
@Override @Override
public boolean execute() { public boolean execute() {
throw new IllegalStateException(); throw new IllegalStateException();
 End of changes. 2 change blocks. 
4 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)