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 69a858501477ec509f9c7081ec8f07564a00ad17
Author: Robert Lazarski <[email protected]>
AuthorDate: Tue Apr 7 06:54:33 2026 -1000

    Apply Gemini review finding — getMcpBoolParam null-guard on operation
    
    getMcpBoolParam called operation.getParameter() unconditionally, unlike
    the sibling getMcpStringParam which was already fixed to guard:
      (operation != null) ? operation.getParameter(paramName) : null
    
    With the null guard absent, any future refactoring passing a null operation
    (e.g. for service-level-only annotation lookup) would throw NPE at runtime.
    The fix mirrors the pattern in getMcpStringParam exactly.
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---
 .../src/main/java/org/apache/axis2/openapi/OpenApiSpecGenerator.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/modules/openapi/src/main/java/org/apache/axis2/openapi/OpenApiSpecGenerator.java
 
b/modules/openapi/src/main/java/org/apache/axis2/openapi/OpenApiSpecGenerator.java
index 7bdd451be2..d23e35cb34 100644
--- 
a/modules/openapi/src/main/java/org/apache/axis2/openapi/OpenApiSpecGenerator.java
+++ 
b/modules/openapi/src/main/java/org/apache/axis2/openapi/OpenApiSpecGenerator.java
@@ -665,7 +665,8 @@ public class OpenApiSpecGenerator {
      */
     private boolean getMcpBoolParam(AxisOperation operation, AxisService 
service,
                                     String paramName, boolean defaultValue) {
-        org.apache.axis2.description.Parameter p = 
operation.getParameter(paramName);
+        org.apache.axis2.description.Parameter p =
+                (operation != null) ? operation.getParameter(paramName) : null;
         if (p == null) p = service.getParameter(paramName);
         if (p != null && p.getValue() != null) {
             String v = 
p.getValue().toString().trim().toLowerCase(java.util.Locale.ROOT);

Reply via email to