mirror of
https://github.com/LamGC/Oracle-Sentry.git
synced 2025-04-29 22:27:34 +00:00
refactor: 添加对参数的非空检查.
添加非空检查以在执行操作前将其拦截.
This commit is contained in:
parent
e54a9513df
commit
8bd55ca2e4
@ -6,6 +6,7 @@ import net.lamgc.oracle.sentry.script.groovy.trigger.TriggerName;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ public class GroovyTriggerProvider {
|
|||||||
* @throws NoSuchElementException 当指定的 Trigger 名称没有对应 Trigger 时抛出该异常.
|
* @throws NoSuchElementException 当指定的 Trigger 名称没有对应 Trigger 时抛出该异常.
|
||||||
*/
|
*/
|
||||||
public GroovyTrigger getTriggerByName(String triggerName) {
|
public GroovyTrigger getTriggerByName(String triggerName) {
|
||||||
|
Objects.requireNonNull(triggerName);
|
||||||
if (!triggerProviderMap.containsKey(triggerName.toLowerCase())) {
|
if (!triggerProviderMap.containsKey(triggerName.toLowerCase())) {
|
||||||
throw new NoSuchElementException("The specified trigger could not be found: " + triggerName);
|
throw new NoSuchElementException("The specified trigger could not be found: " + triggerName);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user