slawekjaranowski commented on code in PR #1182:
URL: https://github.com/apache/maven/pull/1182#discussion_r1239648238


##########
maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java:
##########
@@ -83,13 +83,23 @@ private enum ValidationReportLevel {
     public void onEvent(Object event) {
         if (event instanceof ExecutionEvent) {
             ExecutionEvent executionEvent = (ExecutionEvent) event;
-            if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
+            if (executionEvent.getType() == 
ExecutionEvent.Type.SessionStarted) {
+                RepositorySystemSession repositorySystemSession =
+                        executionEvent.getSession().getRepositorySession();
+                ValidationReportLevel level = 
parseValidationReportLevel(repositorySystemSession);
+                
repositorySystemSession.getData().set(MAVEN_PLUGIN_VALIDATION_KEY, level);
+            } else if (executionEvent.getType() == 
ExecutionEvent.Type.SessionEnded) {
                 
reportSessionCollectedValidationIssues(executionEvent.getSession());
             }
         }
     }
 
     private ValidationReportLevel 
validationReportLevel(RepositorySystemSession session) {
+        return (ValidationReportLevel) session.getData()
+                .computeIfAbsent(MAVEN_PLUGIN_VALIDATION_KEY, () -> 
parseValidationReportLevel(session));

Review Comment:
   Can be empty here?
   We use the same key and assume that will contains correct type.
   If code from onEvent will not execute we can have wrong type.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to