You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/10/26 10:15:36 UTC

[GitHub] [maven-resolver] cstamas opened a new pull request, #207: [MRESOLVER-278] Session close and onClose hooks fix

cstamas opened a new pull request, #207:
URL: https://github.com/apache/maven-resolver/pull/207

   There are valid cases in Maven when interaction with resolver (that would "lazily" init SyncContext) happens way late, when session is already done readOnly.
   
   Fix: adding onCloseHandler should NOT be affected by readOnly state of session, as it merely means it's members like LRM, etc are "fixed", but session data etc are all still mutable.
   
   Similarly, due lazy init, some components may way -- as above in valid cases -- register some handler when session is already read only.
   
   This change makes all Maven ITs pass with this resolver.


-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-resolver] gnodet commented on a diff in pull request #207: [MRESOLVER-278] Session close and onClose hooks fix

Posted by GitBox <gi...@apache.org>.
gnodet commented on code in PR #207:
URL: https://github.com/apache/maven-resolver/pull/207#discussion_r1005636121


##########
maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java:
##########
@@ -894,8 +894,11 @@ public Collection<FileTransformer> getTransformersForArtifact( Artifact artifact
     @Override
     public void addOnCloseHandler( Consumer<RepositorySystemSession> handler )
     {
-        verifyStateForMutation();
         requireNonNull( handler, "handler cannot be null" );
+        if ( closed.get() )
+        {
+            throw new IllegalStateException( "repository system session is closed" );

Review Comment:
   Ftr, I disagree with the change.  _already_ has a meaning of doing the same _again_.  That's not the case here, as the user does not want to close the session, just to use it.



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-resolver] cstamas merged pull request #207: [MRESOLVER-278] Session close and onClose hooks fix

Posted by GitBox <gi...@apache.org>.
cstamas merged PR #207:
URL: https://github.com/apache/maven-resolver/pull/207


-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-resolver] cstamas commented on a diff in pull request #207: [MRESOLVER-278] Session close and onClose hooks fix

Posted by GitBox <gi...@apache.org>.
cstamas commented on code in PR #207:
URL: https://github.com/apache/maven-resolver/pull/207#discussion_r1005532707


##########
maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java:
##########
@@ -894,8 +894,11 @@ public Collection<FileTransformer> getTransformersForArtifact( Artifact artifact
     @Override
     public void addOnCloseHandler( Consumer<RepositorySystemSession> handler )
     {
-        verifyStateForMutation();
         requireNonNull( handler, "handler cannot be null" );
+        if ( closed.get() )
+        {
+            throw new IllegalStateException( "repository system session is closed" );

Review Comment:
   fixed



-- 
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-unsubscribe@maven.apache.org

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


[GitHub] [maven-resolver] michael-o commented on a diff in pull request #207: [MRESOLVER-278] Session close and onClose hooks fix

Posted by GitBox <gi...@apache.org>.
michael-o commented on code in PR #207:
URL: https://github.com/apache/maven-resolver/pull/207#discussion_r1005522812


##########
maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java:
##########
@@ -894,8 +894,11 @@ public Collection<FileTransformer> getTransformersForArtifact( Artifact artifact
     @Override
     public void addOnCloseHandler( Consumer<RepositorySystemSession> handler )
     {
-        verifyStateForMutation();
         requireNonNull( handler, "handler cannot be null" );
+        if ( closed.get() )
+        {
+            throw new IllegalStateException( "repository system session is closed" );

Review Comment:
   is already closed



-- 
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-unsubscribe@maven.apache.org

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