handling more pse's

This commit is contained in:
gnembon committed 2020-10-11 11:59:22 -03:00
1 parent 3ad9395c20
commit ff4c4431f4
2 files changed
+10 -2

No files matched your search

@@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.regex.PatternSyntaxException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class DataStructures { public class DataStructures {
@@ -55,7 +56,14 @@ public class DataStructures {
{ {
String delimiter = d.getString(); String delimiter = d.getString();
String hwat = v.getString(); String hwat = v.getString();
return ListValue.wrap(Arrays.stream(hwat.split(delimiter)).map(StringValue::new).collect(Collectors.toList())); try
{
return ListValue.wrap(Arrays.stream(hwat.split(delimiter)).map(StringValue::new).collect(Collectors.toList()));
}
catch (PatternSyntaxException pse)
{
throw new InternalExpressionException("Incorrect pattern for 'split': "+pse.getMessage());
}
}); });
expression.addFunction("slice", (lv) -> expression.addFunction("slice", (lv) ->
@@ -167,7 +167,7 @@ public class Sys {
} }
catch (PatternSyntaxException pse) catch (PatternSyntaxException pse)
{ {
throw new InternalExpressionException("Incorrect pattern for replace: "+pse.getMessage()); throw new InternalExpressionException("Incorrect pattern for 'replace': "+pse.getMessage());
} }
}); });