Copilot commented on code in PR #164:
URL: 
https://github.com/apache/maven-jarsigner-plugin/pull/164#discussion_r4056779815


##########
src/test/java/org/apache/maven/plugins/jarsigner/JarsignerSignMojoTest.java:
##########
@@ -402,6 +404,43 @@ public void testSecurityDispatcher() throws Exception {
         
verify(jarSigner).execute(MockitoHamcrest.argThat(RequestMatchers.hasStorepass("mystorepass")));
     }
 
+    /** nonProxyHosts value must not include literal quote characters (issue 
#147) */
+    @Test
+    public void testNonProxyHostsNoQuotes() throws Exception {
+        Artifact mainArtifact = TestArtifacts.createJarArtifact(projectDir, 
"my-project.jar");
+        when(project.getArtifact()).thenReturn(mainArtifact);
+        
when(jarSigner.execute(any(JarSignerSignRequest.class))).thenReturn(RESULT_OK);
+
+        Proxy proxy = new Proxy();
+        proxy.setHost("proxy.example.com");
+        proxy.setPort(8080);
+        proxy.setNonProxyHosts("localhost|*.example.com");
+        proxy.setProtocol("http");

Review Comment:
   The proxy added to Settings is not marked active. `AbstractJarsignerMojo` 
uses `settings.getActiveProxy()`, which typically returns only proxies with 
`active=true`, so this test may not exercise the nonProxyHosts logic as 
intended.



##########
src/main/java/org/apache/maven/plugins/jarsigner/JarsignerSignMojo.java:
##########
@@ -413,7 +413,8 @@ interface Sleeper {
     /** Package private for testing */
     void waitAfterFailure(int attempt, Duration maxRetryDelay, Sleeper 
sleeper) throws MojoExecutionException {
         // Use attempt as exponent in the exponential function, but limit it 
to avoid too big values.
-        int exponentAttempt = Math.min(attempt, MAX_WAIT_EXPONENT_ATTEMPT);
+        // Clamp to >= 0 to avoid fractional delays for negative attempt 
values.
+        int exponentAttempt = Math.max(0, Math.min(attempt, 
MAX_WAIT_EXPONENT_ATTEMPT));

Review Comment:
   This change clamps negative retry attempts to 0, altering retry sleep 
behavior, but the PR title/description and linked issue describe only the 
nonProxyHosts quoting fix. Consider splitting this into a separate PR or 
updating the PR description to include this behavioral change and rationale.



-- 
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]

Reply via email to