-
Bug
-
Resolution: Done
-
Major
-
None
-
None
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:
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)
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); } }
- clones
-
LOGMGR-236 java.lang.ArrayIndexOutOfBoundsException: 76 at org.jboss.logmanager.JDKSpecific.calculateCaller(JDKSpecific.java:112)
- Resolved
- is incorporated by
-
JBEAP-16347 (7.2.z) Upgrade jboss-logmanager from 2.1.5.Final-redhat-00001 to 2.1.7.Final
- Closed