[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-07-25 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17386949#comment-17386949
 ] 

Michael Osipov commented on MNG-7161:
-

Thank you, yes done.

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.2, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Assignee: Michael Osipov
>Priority: Critical
> Fix For: 3.8.2, 4.0.0, 4.0.0-alpha-1
>
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report this to JAnsi too such that this gets fixed there as 
> well.
>  
> What are your 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-07-25 Thread Guy Brand (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17386942#comment-17386942
 ] 

Guy Brand commented on MNG-7161:


[~michael-o] I think this should be MNG-7196 correct? Thanks for fixing this! 

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.2, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Assignee: Michael Osipov
>Priority: Critical
> Fix For: 3.8.2, 4.0.0, 4.0.0-alpha-1
>
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report this to JAnsi too such that this gets 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-07-23 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17386439#comment-17386439
 ] 

Michael Osipov commented on MNG-7161:
-

[~gnodet], are you certain there are no commits on master for the release?

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.2, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
> Fix For: 4.0.x-candidate, 3.8.x-candidate
>
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report this to JAnsi too such that this gets fixed there as 
> well.
>  

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-07-23 Thread Guillaume Nodet (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17386230#comment-17386230
 ] 

Guillaume Nodet commented on MNG-7161:
--

[~michael-o] jansi 2.3.4 has been released with a fix for 
https://github.com/fusesource/jansi/issues/214 and should be available in maven 
central soon.

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.2, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
> Fix For: 4.0.x-candidate, 3.8.x-candidate
>
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-07-07 Thread Guy Brand (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17376533#comment-17376533
 ] 

Guy Brand commented on MNG-7161:


Also see [https://github.com/fusesource/jansi/issues/214] which is the issue 
reported at Jansi to fix the root cause.

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.2, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
> Fix For: 4.0.x-candidate, 3.8.x-candidate
>
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report this to JAnsi too such that 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-07-07 Thread Guy Brand (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17376519#comment-17376519
 ] 

Guy Brand commented on MNG-7161:


I've opened https://issues.apache.org/jira/browse/MSHARED-993 and the 
[respective pull request|https://github.com/apache/maven-shared-utils/pull/93]. 
[~michael-o] Is there something missing and can you take it from here to push a 
new release of the Maven shared utils library and update it accordingly on 
{{master}} ?

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.2, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
> Fix For: 4.0.x-candidate, 3.8.x-candidate
>
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-07-05 Thread Guy Brand (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17374662#comment-17374662
 ] 

Guy Brand commented on MNG-7161:


[~michael-o] Yes I'll try to have something ready by the end of this week. 

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.2, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
> Fix For: 4.0.x-candidate, 3.8.x-candidate
>
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report this to JAnsi too such that this gets fixed there as 
> well.
>  
> What 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-07-03 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17374037#comment-17374037
 ] 

Michael Osipov commented on MNG-7161:
-

[~Brand], can you meanwhile provide a PR for this?

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.2, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report this to JAnsi too such that this gets fixed there as 
> well.
>  
> What are your opinions on that?



--
This message was sent by Atlassian Jira

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-07-03 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17374035#comment-17374035
 ] 

Michael Osipov commented on MNG-7161:
-

[~gnodet], can you provide some insight? This is a blocker.

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.2, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report this to JAnsi too such that this gets fixed there as 
> well.
>  
> What are your opinions on that?



--
This message was sent by 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-06-12 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17362262#comment-17362262
 ] 

Michael Osipov commented on MNG-7161:
-

[~Brand], to be honest. I cannot judge here. [~gnodet] is the expect here. I 
will the decision up to him.

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 4.0.x-candidate, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report this to JAnsi too such that this gets fixed there as 
> well.
>  
> What are your 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-06-11 Thread Guy Brand (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17361527#comment-17361527
 ] 

Guy Brand commented on MNG-7161:


[~michael-o] [~gnodet] Are you ok with doing the proposed option #2 ? We are 
currently not able to reliably test with the latest Maven nightly, therefore 
should we provide a pull request for that change such that we can get that into 
the main branch soonish?

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 4.0.x-candidate, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-06-08 Thread Victor (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17359413#comment-17359413
 ] 

Victor commented on MNG-7161:
-

This is also affecting the maven release plugin, as a workaround we have 
reverted to the latest 3.8 version:
- [https://github.com/elastic/apm-pipeline-library/pull/1145]

 

 

What command did I ran to see the above error?
 
 
{code:java}
[2021-06-07T14:59:19.751Z] + ./mvnw release:prepare release:perform -V 
--batch-mode '-Darguments=-DskipTests=true --batch-mode' 
[2021-06-07T14:59:19.751Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 
[2021-06-07T14:59:20.011Z] Apache Maven 4.0.0-alpha-1-SNAPSHOT 
(12f3e7e878e3a22a696f7ba9b5c615d520807afb)  
[2021-06-07T14:59:20.011Z] Maven home: 
/var/lib/jenkins/.m2/wrapper/dists/apache-maven-4.0.0-alpha-1-SNAPSHOT-bin/s0m0e7mg6h9hr8umuisf0sdq9/apache-maven
 
[2021-06-07T14:59:20.011Z] Java version: 1.8.0_292, vendor: Private Build, 
runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre  
[2021-06-07T14:59:20.011Z] Default locale: en, platform encoding: UTF8 
[2021-06-07T14:59:20.011Z] OS name: "linux", version: "5.4.0-1044-gcp", arch: 
"amd64", family: "unix"
{code}

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 4.0.x-candidate, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-05-26 Thread Guy Brand (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17351985#comment-17351985
 ] 

Guy Brand commented on MNG-7161:


[~mthmulders] the Maven Archetype plugin also uses the Plexus interactivity: 
[https://github.com/apache/maven-archetype/blob/master/pom.xml#L163-L173] So it 
might be the same issue as we face.

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 4.0.x-candidate, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-05-26 Thread Guy Brand (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17351778#comment-17351778
 ] 

Guy Brand commented on MNG-7161:


[~michael-o] We use it for the included {{Prompter}} but we'll now remove this 
dependency and do it by our own to fix this for the current extension. But we'd 
like that all our old extensions still work with Maven 4.0.0 and this error 
would not make it possible.

This error can always occur when a plugin or extension holds a reference to the 
system output streams and then does it's own disposal or similar before JAnsi 
uninstalls itself.

[~mthmulders] Thanks for adding another example.

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 4.0.x-candidate, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole}} JAnsi 
> will be [initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-05-26 Thread Maarten Mulders (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17351772#comment-17351772
 ] 

Maarten Mulders commented on MNG-7161:
--

This also happens with {{archetype:generate}}:
{code:java}
mvn archetype:generate -DgroupId=foo -DartifactId=bar3 
-DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4
[INFO] Scanning for projects...
[INFO] 
[INFO] ---< 
org.apache.maven:standalone-pom >
[INFO] Building Maven Stub Project (No POM) 1
[INFO] -[ pom 
]--
[INFO] 
[INFO] --- maven-archetype-plugin:3.1.2:generate (default-cli) @ standalone-pom 
---
[INFO] Generating project in Interactive mode
[INFO] Using property: groupId = foo
[INFO] Using property: artifactId = bar3
Define value for property 'version' 1.0-SNAPSHOT: : 
[INFO] Using property: package = foo
Confirm properties configuration:
groupId: foo
artifactId: bar3
version: 1.0-SNAPSHOT
package: foo
 Y: : y
[INFO] 

[INFO] Using following parameters for creating project from Archetype: 
maven-archetype-quickstart:1.4
[INFO] 

[INFO] Parameter: groupId, Value: foo
[INFO] Parameter: artifactId, Value: bar3
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: foo
[INFO] Parameter: packageInPathFormat, Value: foo
[INFO] Parameter: package, Value: foo
[INFO] Parameter: groupId, Value: foo
[INFO] Parameter: artifactId, Value: bar3
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Project created from Archetype in dir: /private/tmp/bar3
[INFO] 
--
[INFO] BUILD SUCCESS
[INFO] 
--
[INFO] Total time:  5.681 s
[INFO] Finished at: 2021-05-26T15:15:08+02:00
[INFO] 
--
java.lang.NullPointerException
at 
org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
at 
org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
at 
org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
at 
org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
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)

{code}
 

Not sure if it's related, but I thought I'd mention it.

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 4.0.x-candidate, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-05-26 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17351768#comment-17351768
 ] 

Michael Osipov commented on MNG-7161:
-

[~Brand], can you explain why your ITs need interactivity?

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 4.0.x-candidate, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole (}}JAnsi 
> will be[ initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report this to JAnsi too such that this gets fixed there as 
> well.
>  
> What are your opinions on that?



--
This message was sent 

[jira] [Commented] (MNG-7161) Error thrown during uninstalling of JAnsi

2021-05-26 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17351767#comment-17351767
 ] 

Michael Osipov commented on MNG-7161:
-

[~gnodet], have look please.

> Error thrown during uninstalling of JAnsi
> -
>
> Key: MNG-7161
> URL: https://issues.apache.org/jira/browse/MNG-7161
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 4.0.x-candidate, 4.0.0, 4.0.0-alpha-1
>Reporter: Guy Brand
>Priority: Critical
>
> Our integration tests stopped working after we started to test with a Maven 
> {{4.0.0-alpha-1}} nightly which included this commit: 
> [https://github.com/apache/maven/commit/195fb626a9a4e5a0774f779b6d8da1cb9ef38468#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R310-R317]
> In this commit the {{maven-shared-utils}} and the {{jansi}} dependencies are 
> being upgraded. When we then run our integration tests we get the following 
> null pointer exception:
> {code:java}
> java.lang.NullPointerException
>   at org.fusesource.jansi.AnsiPrintStream.uninstall(AnsiPrintStream.java:79)
>   at org.fusesource.jansi.AnsiConsole.systemUninstall(AnsiConsole.java:524)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.doSystemUninstall(MessageUtils.java:101)
>   at 
> org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:80)
>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
>   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>   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)
> {code}
>  
>  We debugged this and [these 
> changes|https://github.com/fusesource/jansi/commit/63bd892b2bdfc253ec119a57bdd42df5e80fd859#diff-d59db8655d9ae2d11948e2b411c34fc9e8513f29065d82c978d7128dafbe3bafR414-R420]
>  in JAnsi introduced in the above upgraded version, is the source of the 
> exception. The NPE is caused because the {{out}} reference is {{null}} at the 
> time it wants to uninstall the {{AnsiOutputStream}}. This reference is nulled 
> because we use the Plexus interactivity library which [disposes the 
> {{DefaultOutputHandler}}|https://github.com/codehaus-plexus/plexus-interactivity/blob/master/plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java#L51-L54]
>  on the tear down of Plexus, in which the {{System.out}} reference will be 
> closed which is in fact the {{out}} reference of the {{AnsiConsole (}}JAnsi 
> will be[ initialized 
> before|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L200]
>  the Plexus container). This happens 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L202],
>  so before JAnsi will be uninstalled in 
> [here|https://github.com/apache/maven/blob/3e917677e484067b853eaa4a6de44ebcf5a988de/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L203].
> There are two options to solve this:
>  1. Report this to JAnsi such that they catch this valid use case and do not 
> throw as this worked without any exceptions in older versions.
>  2. Fix the {{MessageUtils#doSystemUninstall()}} and catch all exceptions and 
> swallow them, as if it can't uninstall it, then Maven itself is not capable 
> of fixing this state either. This is already done in a similar way 
> [here|https://github.com/apache/maven-shared-utils/blob/17091d82508deb9b7067f3434ba16f660ffc5023/src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java#L85-L92]
>  for removing the shutdown hook.
> Our proposal is to do #2 which would make Maven itself resilient to such use 
> cases as there are other extensions/plugin out there which also retrieve a 
> reference for the system output streams and therefore they would fail with 
> Maven 4.0.0. This would also make this part future proof, as when there are 
> other errors thrown during the uninstall, Maven itself does not break.
> We can as well report this to JAnsi too such that this gets fixed there as 
> well.
>  
> What are your opinions on that?



--
This message was sent by Atlassian Jira