You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use maven-profiler with another core extension where:
maven-profiler is installed in $M2_HOME/lib/ext folder
the other extension is declared in .mvn/ folder
.. I got the following line many times each time a use a maven command :
[WARNING] Failed to notify spy fr.jcgay.maven.profiler.ProfilerEventSpy: null
Here is the stack trace when adding -X parameter:
java.lang.NullPointerException
at fr.jcgay.maven.profiler.ProfilerEventSpy.onEvent(ProfilerEventSpy.java:81)
at org.apache.maven.eventspy.internal.EventSpyDispatcher.onEvent(EventSpyDispatcher.java:104)
at org.apache.maven.eventspy.internal.EventSpyRepositoryListener.artifactResolved(EventSpyRepositoryListener.java:88)
[...]
The exception is raised here, in ProfilerEventSpy where onEvent() is called before init().
Do someone know if it is an issue with maven-profiler, or with maven? And how how to solve this issue?
I can create a pull request if necessary.
When maven-profiler is installed in the Maven distribution ext folder
and a project uses other extension from the .mvn/extensions.xml configuration,
maven-profiler was failing with NPE in fr.jcgay.maven.profiler.ProfilerEventSpy#onEvent.
This is because the #init method of the extension was not yet called when Maven was loading
extension from .mvn/extensions.xml. Maven was firing event intercepted by maven-profiler
but as it was not yet initiated, the configuration and statistics internal state was not ready.
This commit also initiate its state in the constructor.
It will prevent NPE but the statistics gathered between the instantiation and the initialization
will be lost anyway 😥. Because #init will clean internal state, and we need this to have the extension
functional with mvnd.
Fixes#199
When I use maven-profiler with another core extension where:
maven-profiler
is installed in$M2_HOME/lib/ext
folder.mvn/
folder.. I got the following line many times each time a use a
maven
command :Here is the stack trace when adding
-X
parameter:The exception is raised here, in
ProfilerEventSpy
whereonEvent()
is called beforeinit()
.Do someone know if it is an issue with
maven-profiler
, or withmaven
? And how how to solve this issue?I can create a pull request if necessary.
I created a dedicated project for the demonstrate: https://github.com/jibidus/maven-profiler-bug-demo
The text was updated successfully, but these errors were encountered: