Aias00 opened a new issue, #6483:
URL: https://github.com/apache/shenyu/issues/6483

   ### Current Behavior
   
   Deleting a discovery record by an unknown id can throw 
`NullPointerException`.
   
   `DiscoveryController.delete()` accepts any `discoveryId` path value and 
delegates directly to `discoveryService.delete(discoveryId)`. In the service, 
`discoveryMapper.selectById(discoveryId)` can return `null`, but the next line 
dereferences it:
   
   ```java
   DiscoveryDO discoveryDO = discoveryMapper.selectById(discoveryId);
   DiscoveryProcessor discoveryProcessor = 
discoveryProcessorHolder.chooseProcessor(discoveryDO.getDiscoveryType());
   ```
   
   ### Expected Behavior
   
   Deleting an unknown discovery id should return a controlled 
not-found/parameter error response instead of an internal server error.
   
   ### Steps to Reproduce
   
   ```http
   DELETE /discovery/not-exist
   ```
   
   If no discovery row exists for that id, `discoveryDO.getDiscoveryType()` can 
throw.
   
   ### Code Location
   
   - 
`shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/DiscoveryController.java`
   - 
`shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/DiscoveryServiceImpl.java`
   


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