justinmclean commented on issue #8085:
URL: https://github.com/apache/gravitino/issues/8085#issuecomment-3187963885

   The validate method in this case does check this:
   ```
     public void validate() throws IllegalArgumentException {
       Preconditions.checkArgument(
           StringUtils.isNotBlank(name), "\"name\" field is required and cannot 
be empty");
       Preconditions.checkArgument(type != null, "\"type\" field is required 
and cannot be empty");
       Preconditions.checkArgument(
           StringUtils.isNotBlank(provider) || type.supportsManagedCatalog(),
           "\"provider\" field is required and cannot be empty for catalog type 
"
               + type
               + " that doesn't support managed catalog");
     }
   ```
   
   Even if validate() is supposed to run first, relying on call order is 
brittle. A tiny refactor (or someone reusing it elsewhere) can re-introduce the 
NPE. A simple change costs nothing and hardens the code.


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