ppkarwasz commented on code in PR #1855:
URL: https://github.com/apache/logging-log4j2/pull/1855#discussion_r1352305514
##########
log4j-1.2-api/src/main/java/org/apache/log4j/WriterAppender.java:
##########
@@ -242,12 +243,8 @@ protected OutputStreamWriter createWriter(final
OutputStream os) {
if (enc != null) {
try {
retval = new OutputStreamWriter(os, enc);
- } catch (IOException e) {
- if (e instanceof InterruptedIOException) {
- Thread.currentThread().interrupt();
- }
- LOGGER.warn("Error initializing output writer.");
- LOGGER.warn("Unsupported encoding?");
+ } catch (final UnsupportedEncodingException e) {
+ LOGGER.warn("Error initializing output writer: encoding {} is
not supported.", enc, e);
Review Comment:
The constructor only throws `UnsupportedEncodingException`.
##########
log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/AnnotationVsMarkerInterface.java:
##########
@@ -58,7 +57,7 @@ public class AnnotationVsMarkerInterface {
@BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SampleTime,
Mode.SingleShotTime})
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Object annotationMissing() {
- return map.getClass().isAnnotationPresent(PerformanceSensitive.class);
+ return map.getClass().isAnnotationPresent(State.class);
Review Comment:
`PerformanceSensitive` has only `CLASS` retention.
##########
log4j-1.2-api/src/main/java/org/apache/log4j/spi/LocationInfo.java:
##########
@@ -101,35 +103,40 @@ public LocationInfo(final Throwable throwable, final
String fqnOfCallingClass) {
prevClass = thisClass;
}
}
- this.stackTraceElement = new StackTraceElement(declaringClass,
methodName, file, Integer.parseInt(line));
- this.fullInfo = stackTraceElement.toString();
Review Comment:
Possible NPE, especially if `throwable` is `null`.
--
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]