-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MRESOLVER-600] - RFC9457 Implementation #576
[MRESOLVER-600] - RFC9457 Implementation #576
Conversation
...i/src/main/java/org/eclipse/aether/spi/connector/transport/http/RFC9457/Rfc9457Reporter.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, it is RFC 9457. With a space and uppercase. I see no processing of the response body at all, JSON is just serialzation. An appropriate exception should extract the fields and populate.
...i/src/main/java/org/eclipse/aether/spi/connector/transport/http/RFC9457/Rfc9457Reporter.java
Outdated
Show resolved
Hide resolved
...pi/src/main/java/org/eclipse/aether/spi/connector/transport/http/RFC9457/RFC9457Payload.java
Outdated
Show resolved
Hide resolved
...pi/src/main/java/org/eclipse/aether/spi/connector/transport/http/RFC9457/RFC9457Payload.java
Show resolved
Hide resolved
...pi/src/main/java/org/eclipse/aether/spi/connector/transport/http/RFC9457/RFC9457Payload.java
Show resolved
Hide resolved
...i/src/main/java/org/eclipse/aether/spi/connector/transport/http/RFC9457/RFC9457Reporter.java
Outdated
Show resolved
Hide resolved
@doddi is this addition to maven-resolver automatically used by Maven when dependency is upgraded, to fix https://issues.apache.org/jira/browse/MNG-6795 or does Maven require an update to benefit? |
Maven does not need an update to use it but It will require servers to implement the RFC at their end. This PR will throw the RFC9457 exception when an |
ok, IIUC, the exception gets translated into a Maven CLI message without changing Maven core code: nice |
I added https://github.com/apache/maven-resolver/pull/576/files#diff-2a1236811d71180ff302ffca463a0449c3c6c13d0df3ec362c78765b58025d47R503 but not aware of any cli ITs. I will look to do a build of maven with this PR and ensure there is a suitable response observed |
package org.eclipse.aether.spi.connector.transport.http.RFC9457; | ||
|
||
@FunctionalInterface | ||
public interface BiConsumerChecked<T, U, E extends Exception> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class looks awkward to me in SPI (not a -1 but...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I kind of agree but I was trying to ensure that the original exceptions (which are different for each transporter) are not lost and thought the wrapped solution is more convenient (albeit a little ugly) as it is a single call rather than the if/else that would have to replace it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add that to get maven-resolver to build with maven will require an update to https://github.com/apache/maven/blob/64e944792613e241b3faddcb4c793e147f6faa5e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemSupplier.java#L672 as it will now require passing in an instance of ApacheRFC9457Reporter
.../main/java/org/eclipse/aether/spi/connector/transport/http/RFC9457/HttpRFC9457Exception.java
Outdated
Show resolved
Hide resolved
...i/src/main/java/org/eclipse/aether/spi/connector/transport/http/RFC9457/RFC9457Reporter.java
Outdated
Show resolved
Hide resolved
...ransport-apache/src/test/java/org/eclipse/aether/transport/apache/ApacheTransporterTest.java
Outdated
Show resolved
Hide resolved
...lver-transport-jdk-11/src/main/java/org/eclipse/aether/transport/jdk/JdkRFC9457Reporter.java
Outdated
Show resolved
Hide resolved
...olver-transport-jdk-8/src/main/java/org/eclipse/aether/transport/jdk/JdkRFC9457Reporter.java
Outdated
Show resolved
Hide resolved
...r-transport-jetty/src/main/java/org/eclipse/aether/transport/jetty/JettyRFC9457Reporter.java
Outdated
Show resolved
Hide resolved
...r-transport-jetty/src/test/java/org/eclipse/aether/transport/jetty/JettyTransporterTest.java
Outdated
Show resolved
Hide resolved
Opted to move to static initialised as suggested. This has the benefit of now no longer changing the transporter constructors so the maven project no longer needs to be changed to make use of these changes. dad87aa |
Using a static instance also has the benefit of keeping the changes internal. Therefore, no changes to the maven project are required to move to this version.
dad87aa
to
9f3391e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK for me, but needs another pair of eyes at least.
Added an RFC9457Reporter for each of the 3 Transporters.
At the moment I tried to keep the original exception messages if the error response is not an RFC9457 type. This did create a little more complexity in the implementation than is perhaps necessary.
If the exceptions to be thrown can be consisted throughout the transporters then this PR could also be simplified considerably. At the moment I have taken the stance not to make any potential breaking changes in messaging.
Fixes: https://issues.apache.org/jira/browse/MRESOLVER-600