Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-2052

Handles internal exceptions do not have suppressed exceptions in ThreadedStreamConsumer

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-M6
    • process forking
    • None

    Description

      If the internal exception is caught (e.g. casting Long to long throws NPE), we do not see the stacktrace of the cause.

      The stacktrace is:

      # Created at 2022-03-29T01:16:09.607
      ForkStarter IOException: java.lang.NullPointerException
      java.lang.NullPointerException
      java.lang.NullPointerException.
      org.apache.maven.plugin.surefire.booterclient.output.MultipleFailureException: java.lang.NullPointerException
      java.lang.NullPointerException
      java.lang.NullPointerException
      	at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.<init>(ThreadedStreamConsumer.java:64)
      	at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer.<init>(ThreadedStreamConsumer.java:122)
      	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:600)
      	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:311)
      	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:268)
      	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1327)
      	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1160)
      	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:925)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
      	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
      	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
      

      This fix adds suppressed exception and removes repeative code.
      The stacktrace would become:

      # Created at 2022-03-29T22:27:27.705
      ForkStarter IOException: java.lang.NullPointerException.
      org.apache.maven.plugin.surefire.booterclient.output.MultipleFailureException: java.lang.NullPointerException
      	at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.<init>(ThreadedStreamConsumer.java:64)
      	at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer.<init>(ThreadedStreamConsumer.java:122)
      	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:600)
      	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:311)
      	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:268)
      	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1327)
      	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1160)
      	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:925)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
      	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
      	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
      	Suppressed: java.lang.NullPointerException
      		at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.writeTestOutput(ForkClient.java:399)
      		at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.access$2200(ForkClient.java:59)
      		at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$StdOutListener.handle(ForkClient.java:225)
      		at org.apache.maven.plugin.surefire.booterclient.output.ForkedProcessEventNotifier.notifyEvent(ForkedProcessEventNotifier.java:210)
      		at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.handleEvent(ForkClient.java:353)
      		at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.handleEvent(ForkClient.java:59)
      		at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:96)
      		at java.lang.Thread.run(Thread.java:748)
      

      Attachments

        Activity

          People

            tibordigana Tibor Digana
            tibordigana Tibor Digana
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: