bito-code-review[bot] commented on PR #16515:
URL: https://github.com/apache/grails-core/pull/16515#issuecomment-5982397147

   <!-- Bito Reply -->
   The pull request addresses the issue where failed identifier conversions in 
MongoDB multi-tenant entities were causing exceptions instead of returning 
`null` or `false`. The fix involves updating `GormStaticApi.convertIdentifier` 
to catch `ConversionFailedException` and return the original identifier, which 
allows the lookup logic to treat it as a missing identifier. Additionally, a 
regression test has been added in `MongoLookupByIdMultiTenancySpec.groovy` to 
verify this behavior and ensure lookups are correctly restricted to the current 
tenant.
   
   
**grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy**
   ```
   if (conversionService.canConvert(id.getClass(), identityType)) {
               try {
                   return (Serializable) conversionService.convert(id, 
identityType)
               }
               catch (ConversionFailedException ignored) {
                   // the lookup by key ignores an identifier it cannot convert 
as well
               }
           }
           return 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