// javadoc inherited
public Value invoke(ExpressionContext context, Value[] args)
throws ExpressionException {
if ((args.length != 2)) {
throw new ExpressionException(
EXCEPTION_LOCALIZER.format(
"invalid-num-of-args",
new Object[]{new Integer(args.length),
new Integer(2)}));
}
Value result = Sequence.EMPTY;
if (args[0] != Sequence.EMPTY && args[1] != Sequence.EMPTY) {
final String strToTokenize =
args[0].stringValue().asJavaString();
final String pattern =
args[1].stringValue().asJavaString();
if (pattern.length() == 0) {
throw new ExpressionException(INVALID_PATTERN_MSG);
}
if (strToTokenize.length() == 0) {
// If there is no input string, return the empty sequence.
result = Sequence.EMPTY;