chennaji9 opened a new issue, #11340:
URL: https://github.com/apache/rocketmq/issues/11340

   ### Description
   
   `FilterFactory` 
(`filter/src/main/java/org/apache/rocketmq/filter/FilterFactory.java`) holds 
the registry of subscription filter SPIs used by the broker to compile 
subscriptions. Two of its guarantees have no test coverage:
   
   1. **Duplicate registration is rejected, not overwritten**: `register` 
throws `IllegalArgumentException` when the type already exists (`Filter spi 
type(%s) already exist!`). If this guard regressed to a silent overwrite, a 
custom filter could silently replace the built-in SQL92 filter for every broker 
in the process.
   2. **Unregister/return semantics**: `unRegister` returns the removed filter 
(so callers can restore it) and the type becomes registerable again.
   
   The existing `FilterSpiTest` only registers one filter and uses it; it never 
exercises duplicates, unregister/re-register, or protection of the built-in 
`SQL92` entry.
   
   ### Expected behavior
   
   Extend `FilterSpiTest`: duplicate type registration throws and keeps the 
original instance; unregister returns the previous filter, makes `get` return 
null, and allows a fresh registration; registering a second `SqlFilter` 
(built-in `SQL92` type) is rejected and leaves the built-in filter functional.


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