Skip to content

EmptyTagTest throws occasionally for IndexOutOfBoundsException when file based log4j2 xml is used #11

@StrongestNumber9

Description

@StrongestNumber9

Describe the bug

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.025 s <<< FAILURE! -- in com.teragrep.cfe_35.router.EmptyTagTest
[ERROR] com.teragrep.cfe_35.router.EmptyTagTest.sendEmptyTag -- Time elapsed: 0.017 s <<< ERROR!
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
        at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
        at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
        at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
        at java.base/java.util.Objects.checkIndex(Objects.java:361)
        at java.base/java.util.ArrayList.get(ArrayList.java:427)
        at com.teragrep.cfe_35.router.EmptyTagTest.sendEmptyTag(EmptyTagTest.java:181)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
        at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)

Expected behavior

It doesn't crash

How to reproduce

Used this log4j2.xml

<?xml version="1.0" encoding="UTF-8" ?>
<Configuration>
  <Appenders>
    <Console name="STDOUT">
      <PatternLayout pattern="%d{dd.MM.yyyy HH:mm:ss.SSS} [%level] [%logger] [%thread] %msg%ex%n" />
    </Console>
    <File name="FileOutput" fileName="debug.log">
      <PatternLayout pattern="%d{dd.MM.yyyy HH:mm:ss.SSS} [%level] [%logger] [%thread] %msg%ex%n" />
    </File>
  </Appenders>
  <Loggers>
    <Logger name="com.teragrep.net_01" level="debug" additivity="false">
      <AppenderRef ref="FileOutput"/>
    </Logger>
    <Root level="debug">
      <AppenderRef ref="FileOutput"/>
    </Root>
  </Loggers>
</Configuration>

Then run until crash
while true; do rm -f debug.log; mvn clean package || break; done;

Screenshots

Software version

Commit 88ff40b9086c0d02db7a7a85e5158bff6b763b23 of branch to-9 from kortemik/cfe_35

Desktop (please complete the following information if relevant):

  • OS:
  • Browser:
  • Version:

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions