erik-bock-silva opened a new pull request, #10338:
URL: https://github.com/apache/cloudstack/pull/10338

   ### Description
   
   This PR makes the `id` parameter from 
`isAccountAllowedToCreateOfferingsWithTags` api required to prevent a 
NullPointerException when trying to execute the command without an `id`.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [X] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   - [ ] test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [X] Trivial
   
   ### How Has This Been Tested?
   
   I've created a test environment with a CloudStack setup. When I tried to 
execute the command without the `id` parameter, the following exception was 
thrown:
   
   ```
   2025-02-03 15:00:11,909 ERROR [c.c.a.ApiServer] 
(qtp1507118393-20:[ctx-de956cc8, ctx-37d7a594]) (logid:5e002cf6) unhandled 
exception executing api command: [Ljava.lang.String;@588ef940 
java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" 
because the return value of 
"org.apache.cloudstack.api.command.admin.offering.IsAccountAllowedToCreateOfferingsWithTagsCmd.getId()"
 is null
        at 
com.cloud.configuration.ConfigurationManagerImpl.isAccountAllowedToCreateOfferingsWithTags(ConfigurationManagerImpl.java:8076)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
        at 
jdk.proxy3/jdk.proxy3.$Proxy149.isAccountAllowedToCreateOfferingsWithTags(Unknown
 Source)
        at 
org.apache.cloudstack.api.command.admin.offering.IsAccountAllowedToCreateOfferingsWithTagsCmd.execute(IsAccountAllowedToCreateOfferingsWithTagsCmd.java:37)
   ```
   
   Then I built and applied the updated packages to my environment. After that, 
I tried to force the same error to ensure my fix was working. The response 
shown was now the message: `Missing required parameters:  id`


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