Throw exception if illegal --mode pattern was passed in
This commit is contained in:
parent
73ad2c7267
commit
640db994b3
|
@ -328,7 +328,14 @@ public class ArgumentBean {
|
||||||
// only selected panels
|
// only selected panels
|
||||||
return optional(mode).map(m -> {
|
return optional(mode).map(m -> {
|
||||||
Pattern pattern = Pattern.compile(mode, Pattern.CASE_INSENSITIVE);
|
Pattern pattern = Pattern.compile(mode, Pattern.CASE_INSENSITIVE);
|
||||||
return stream(PanelBuilder.defaultSequence()).filter(p -> pattern.matcher(p.getName()).matches()).toArray(PanelBuilder[]::new);
|
PanelBuilder[] panel = stream(PanelBuilder.defaultSequence()).filter(p -> pattern.matcher(p.getName()).matches()).toArray(PanelBuilder[]::new);
|
||||||
|
|
||||||
|
// throw exception if illegal pattern was passed in
|
||||||
|
if (panel.length == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return panel;
|
||||||
}).orElseThrow(error("Illegal mode", mode));
|
}).orElseThrow(error("Illegal mode", mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue