This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit f39a3b4897eee6471efaa1198145d32d3dec9559
Author: Robert Lazarski <[email protected]>
AuthorDate: Mon Apr 6 14:12:40 2026 -1000

    springbootdemo-tomcat11: apply Gemini LOW findings from second review
    
    Fixes from Gemini 2.5 Pro review of commit 82e6e243a6:
    
    - FinancialBenchmarkServiceTest: fix compilation error — 
resp.getInitialValue()
      does not exist on MonteCarloResponse; corrected to req.getInitialValue()
      (the redundant getInitialValue(req) helper has been removed as suggested)
    
    - FinancialBenchmarkServiceTest: use assertEquals(4L, ...) instead of
      assertTrue(... == 4, ...) for more informative failure messages
    
    - FinancialBenchmarkService: use SLF4J parameterized logging
      logger.warn("{} validation failed: {}", logPrefix, err) instead of
      string concatenation — avoids concatenation cost when WARN is disabled
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---
 .../webservices/FinancialBenchmarkService.java           | 16 ++++++++--------
 .../webservices/FinancialBenchmarkServiceTest.java       |  8 ++------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git 
a/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/src/main/java/userguide/springboot/webservices/FinancialBenchmarkService.java
 
b/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/src/main/java/userguide/springboot/webservices/FinancialBenchmarkService.java
index b1c6622022..f8f00780cf 100644
--- 
a/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/src/main/java/userguide/springboot/webservices/FinancialBenchmarkService.java
+++ 
b/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/src/main/java/userguide/springboot/webservices/FinancialBenchmarkService.java
@@ -95,7 +95,7 @@ public class FinancialBenchmarkService {
         int n = request.getNAssets();
         if (n <= 0 || n > MAX_ASSETS) {
             String err = "n_assets=" + n + " is out of range [1, " + 
MAX_ASSETS + "].";
-            logger.warn(logPrefix + "validation failed: " + err);
+            logger.warn("{} validation failed: {}", logPrefix, err);
             return PortfolioVarianceResponse.failed(err);
         }
 
@@ -104,19 +104,19 @@ public class FinancialBenchmarkService {
         if (cov == null) {
             String err = "Missing or malformed \"covarianceMatrix\": provide a 
" + n + "×" + n +
                 " 2D array or a flat array of " + (long) n * n + " elements in 
row-major order.";
-            logger.warn(logPrefix + "validation failed: " + err);
+            logger.warn("{} validation failed: {}", logPrefix, err);
             return PortfolioVarianceResponse.failed(err);
         }
         if (cov.length != n) {
             String err = "covarianceMatrix row count " + cov.length + " != 
nAssets " + n + ".";
-            logger.warn(logPrefix + "validation failed: " + err);
+            logger.warn("{} validation failed: {}", logPrefix, err);
             return PortfolioVarianceResponse.failed(err);
         }
         for (int i = 0; i < n; i++) {
             if (cov[i] == null || cov[i].length != n) {
                 String err = "covarianceMatrix row " + i + " has " +
                     (cov[i] == null ? 0 : cov[i].length) + " columns, expected 
" + n + ".";
-                logger.warn(logPrefix + "validation failed: " + err);
+                logger.warn("{} validation failed: {}", logPrefix, err);
                 return PortfolioVarianceResponse.failed(err);
             }
         }
@@ -131,7 +131,7 @@ public class FinancialBenchmarkService {
             if (weightSum <= 0.0) {
                 String err = "normalizeWeights=true but weights sum to " + 
weightSum +
                     ". Cannot normalize a zero-weight portfolio.";
-                logger.warn(logPrefix + "validation failed: " + err);
+                logger.warn("{} validation failed: {}", logPrefix, err);
                 return PortfolioVarianceResponse.failed(err);
             }
             if (Math.abs(weightSum - 1.0) > 1e-10) {
@@ -144,7 +144,7 @@ public class FinancialBenchmarkService {
                 String err = "weights sum to " + String.format("%.8f", 
weightSum) +
                     ", expected 1.0 (tolerance 1e-4). " +
                     "Pass normalizeWeights=true to rescale automatically.";
-                logger.warn(logPrefix + "validation failed: " + err);
+                logger.warn("{} validation failed: {}", logPrefix, err);
                 return PortfolioVarianceResponse.failed(err);
             }
         }
@@ -346,7 +346,7 @@ public class FinancialBenchmarkService {
         int nAssets = assets.size();
         if (nAssets > MAX_ASSETS) {
             String err = "assets count " + nAssets + " exceeds maximum " + 
MAX_ASSETS + ".";
-            logger.warn(logPrefix + "validation failed: " + err);
+            logger.warn("{} validation failed: {}", logPrefix, err);
             return ScenarioAnalysisResponse.failed(err);
         }
 
@@ -369,7 +369,7 @@ public class FinancialBenchmarkService {
                     "Pass probTolerance to adjust validation strictness.",
                     i, asset.getAssetId(), probSum, probTolerance,
                     asset.getScenarios().size());
-                logger.warn(logPrefix + "validation failed: " + err);
+                logger.warn("{} validation failed: {}", logPrefix, err);
                 return ScenarioAnalysisResponse.failed(err);
             }
         }
diff --git 
a/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/src/test/java/userguide/springboot/webservices/FinancialBenchmarkServiceTest.java
 
b/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/src/test/java/userguide/springboot/webservices/FinancialBenchmarkServiceTest.java
index 2cbfc4dbaa..f399739c15 100644
--- 
a/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/src/test/java/userguide/springboot/webservices/FinancialBenchmarkServiceTest.java
+++ 
b/modules/samples/userguide/src/userguide/springbootdemo-tomcat11/src/test/java/userguide/springboot/webservices/FinancialBenchmarkServiceTest.java
@@ -67,7 +67,7 @@ class FinancialBenchmarkServiceTest {
             "annualized volatility uses nPeriodsPerYear=252 by default");
         assertEquals(1.0, resp.getWeightSum(), 1e-10, "weight_sum should be 
1.0");
         assertFalse(resp.isWeightsNormalized(), "weights should not be 
normalized when already summing to 1.0");
-        assertTrue(resp.getMatrixOperations() == 4, "2x2 matrix = 4 
operations");
+        assertEquals(4L, resp.getMatrixOperations(), "2x2 matrix = 4 
operations");
     }
 
     @Test
@@ -253,7 +253,7 @@ class FinancialBenchmarkServiceTest {
 
         assertEquals("SUCCESS", resp.getStatus());
         // With zero drift and zero volatility, all paths end at initialValue
-        assertEquals(resp.getInitialValue(), resp.getMeanFinalValue(), 1.0,
+        assertEquals(req.getInitialValue(), resp.getMeanFinalValue(), 1.0,
             "zero vol, zero drift: mean should equal initialValue");
     }
 
@@ -521,8 +521,4 @@ class FinancialBenchmarkServiceTest {
         return asset;
     }
 
-    /** Expose initialValue for test assertions (not in response, but useful 
here). */
-    private double getInitialValue(MonteCarloRequest req) {
-        return req.getInitialValue();
-    }
 }

Reply via email to