gnodet-bot commented on code in PR #2373:
URL: https://github.com/apache/maven-resolver/pull/2373#discussion_r4728683543
##########
maven-resolver-transport-jetty/src/main/java/org/eclipse/aether/transport/jetty/JettyTransporter.java:
##########
@@ -670,10 +676,13 @@ private HttpClient createClient() throws RuntimeException
{
httpClient.getProxyConfiguration().addProxy(proxy);
try (AuthenticationContext proxyAuthContext =
AuthenticationContext.forProxy(session, repository)) {
- if (proxyAuthContext != null) {
- String username =
proxyAuthContext.get(AuthenticationContext.USERNAME);
+ String username =
+ proxyAuthContext != null ?
proxyAuthContext.get(AuthenticationContext.USERNAME) : null;
+ if (username != null) {
Review Comment:
💡 **Nit (style):** The proxy block uses a ternary to combine the
null-context check with the username fetch, while the server auth block just
above it uses the established nested-`if` pattern (and JDK transport uses the
same nested pattern for its proxy block too). The ternary is correct — if
`proxyAuthContext` is null the username will be null and the inner `if` is
skipped — but the two patterns are inconsistent within the same file.
Consider using the same nested-`if` structure for readability consistency:
```java
if (proxyAuthContext != null) {
String username =
proxyAuthContext.get(AuthenticationContext.USERNAME);
if (username != null) {
```
(and add the corresponding `}` to close the outer `if` at the end of the
block).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]