[ https://issues.apache.org/jira/browse/MRESOLVER-600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17878946#comment-17878946 ]
ASF GitHub Bot commented on MRESOLVER-600: ------------------------------------------ doddi commented on code in PR #576: URL: https://github.com/apache/maven-resolver/pull/576#discussion_r1742375845 ########## maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/transport/http/RFC9457/RFC9457Reporter.java: ########## @@ -20,60 +20,65 @@ import java.io.IOException; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; + /** - * A reporter for RFC9457 messages. + * A reporter for RFC 9457 messages. * RFC9457 is a standard for reporting problems in HTTP responses as a JSON object. * There are members specified in the RFC but none of those appear to be required, * @see <a href=https://www.rfc-editor.org/rfc/rfc9457#section-3-7>rfc9457 section 3.7</a> * Given the JSON fields are not mandatory, this reporter simply extracts the body of the * response without validation. - * A RFC9457 message is detected by the content type "application/problem+json". + * A RFC 9457 message is detected by the content type "application/problem+json". * * @param <T> The type of the response. * @param <E> The base exception type to throw if the response is not a RFC9457 message. */ -public abstract class Rfc9457Reporter<T, E extends Exception> { - protected abstract boolean isRfc9457Message(T response); +public abstract class RFC9457Reporter<T, E extends Exception> { + private static final Gson GSON = new Gson(); Review Comment: Gson only has a single dependancy (Junit) so I would not consider it too large https://central.sonatype.com/artifact/com.google.code.gson/gson/2.10.1/overview with a download size of only 12kb. I did investigate other parsers including the one you linked. All of those that I came across are either no longer maintained which includes minimal-json or have very little usage. Additionally, because they are no longer maintained they are not suitable for java 9 modules. > Implement RFC 9457 > ------------------ > > Key: MRESOLVER-600 > URL: https://issues.apache.org/jira/browse/MRESOLVER-600 > Project: Maven Resolver > Issue Type: New Feature > Components: Resolver > Reporter: Mark Dodgson > Priority: Minor > > HTTP1.1 [RFC > 9112|https://www.rfc-editor.org/rfc/rfc9112.html#name-status-line] section 4 > defines the response status code to optionally include a text description > (human readable) of the reason for the status code. > There is an additional [RFC9457|https://www.rfc-editor.org/rfc/rfc9457] which > makes use of the body to inform of a reason for the error response allowing > for easier investigation. > h2. Why is this important > [RFC9113|https://www.rfc-editor.org/rfc/rfc9113] is the HTTP2 protocol > standard and the response status only considers the [status > code|https://www.rfc-editor.org/rfc/rfc9113#name-response-pseudo-header-fiel] > and not the reason phrase, as such important information can be lost in > helping the client determine a route cause of a failure. -- This message was sent by Atlassian Jira (v8.20.10#820010)