Manuel Blechschmidt created WFLY-11671:
------------------------------------------
Summary: java.lang.ArrayIndexOutOfBoundsException: 76 at
org.jboss.logmanager.JDKSpecific.calculateCaller(JDKSpecific.java:112)
Key: WFLY-11671
URL:
https://issues.jboss.org/browse/WFLY-11671
Project: WildFly
Issue Type: Bug
Components: Logging
Affects Versions: 15.0.1.Final, 14.0.1.Final
Environment: $ uname -ar
Linux manuel-XPS-13-9360 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018
x86_64 x86_64 x86_64 GNU/Linux
$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-0ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
$ ./jboss-cli.sh --version
JBoss Admin Command-line Interface
JBOSS_HOME: /home/manuel/wildfly-15.0.1.Final
Release: <connect to the controller and re-run the version command to see the release
info>
JAVA_HOME: null
java.version: 1.8.0_191
java.vm.vendor: Oracle Corporation
java.vm.version: 25.191-b12
os.name: Linux
os.version: 4.15.0-43-generic
Maybe another bug, the server was running in JBoss Developer Studio when I executed
jboss-cli
Reporter: Manuel Blechschmidt
Assignee: James Perkins
We are collecting Logs in a CDI RequestScoped bean. Afterwards we have a JAX RS filter
that attaches these logs in the HTTP Warnings Header. In wildfly 12 is works great in
wildfly 14 & 15 the following error happens:
{code}
08:17:16,856 WARNING [de.example.logging.cdi.HttpWarningsHeaderFilter] (default task-1)
Problem during formatting warning: java.lang.ArrayIndexOutOfBoundsException: 76
at org.jboss.logmanager.JDKSpecific.calculateCaller(JDKSpecific.java:112)
at org.jboss.logmanager.ExtLogRecord.calculateCaller(ExtLogRecord.java:335)
at org.jboss.logmanager.ExtLogRecord.getSourceClassName(ExtLogRecord.java:399)
at java.util.logging.SimpleFormatter.format(SimpleFormatter.java:143)
at
de.example.logging.cdi.HttpWarningsHeaderFilter.lambda$1(HttpWarningsHeaderFilter.java:34)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at
de.example.logging.cdi.HttpWarningsHeaderFilter.filter(HttpWarningsHeaderFilter.java:39)
at
de.example.logging.cdi.HttpWarningsHeaderFilter$Proxy$_$$_WeldClientProxy.filter(Unknown
Source)
at
org.jboss.resteasy.core.interception.ContainerResponseContextImpl.filter(ContainerResponseContextImpl.java:356)
at
org.jboss.resteasy.core.ServerResponseWriter.executeFilters(ServerResponseWriter.java:205)
at
org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:82)
at
org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:56)
at
org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:528)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:459)
at
org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229)
at
org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135)
at
org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:355)
{code}
{code}
package de.example.logging.cdi;
import java.io.IOException;
import java.util.List;
import java.util.logging.Formatter;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
@Provider
public class HttpWarningsHeaderFilter implements ContainerResponseFilter {
private static Logger log = Logger.getLogger(HttpWarningsHeaderFilter.class.getName());
private static final Formatter simpleFormatter = new SimpleFormatter();
@Inject
Logs logs;
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext
responseContext)
throws IOException {
List<String> logStrings = logs.getLogRecords().stream()
// only output INFO or more important warnings (SERVERE, WARNING)
.filter(lr -> lr.getLevel().intValue() >= Level.INFO.intValue()).map(lr -> {
try {
return simpleFormatter.format(lr);
} catch (Exception e) {
log.log(Level.WARNING, "Problem during formatting warning", e);
return lr.getMessage();
}
}).collect(Collectors.toList());
responseContext.getHeaders().add("Warnings", logStrings);
}
}
{code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)