From 0be537b1574c56c95995b8f4902dd2dc404a70cc Mon Sep 17 00:00:00 2001 From: jomarko Date: Wed, 16 Aug 2023 06:49:29 +0200 Subject: [PATCH] kie-issues#364: DMN FEEL function split(string, delimiter, flags) should be removed Closes: https://github.com/kiegroup/kie-issues/issues/364 --- .../feel/runtime/functions/SplitFunction.java | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/SplitFunction.java b/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/SplitFunction.java index c692e87594f9..c0d7b4c37a8b 100644 --- a/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/SplitFunction.java +++ b/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/SplitFunction.java @@ -33,10 +33,6 @@ public class SplitFunction } public FEELFnResult> invoke(@ParameterName("string") String string, @ParameterName("delimiter") String delimiter) { - return invoke(string, delimiter, null); - } - - public FEELFnResult> invoke(@ParameterName("string") String string, @ParameterName("delimiter") String delimiter, @ParameterName("flags") String flags) { if (string == null) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "string", "cannot be null" ) ); } @@ -44,33 +40,13 @@ public FEELFnResult> invoke(@ParameterName("string") String string, return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "delimiter", "cannot be null" ) ); } try { - int f = processFlags( flags ); - Pattern p = Pattern.compile( delimiter, f ); + Pattern p = Pattern.compile( delimiter ); String[] split = p.split(string, -1); return FEELFnResult.ofResult( Arrays.asList( split ) ); } catch ( PatternSyntaxException e ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "delimiter", "is invalid and can not be compiled", e ) ); - } catch ( IllegalArgumentException t ) { - return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "flags", "contains unknown flags", t ) ); } catch ( Throwable t) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "delimiter", "is invalid and can not be compiled", t ) ); } } - - private int processFlags(String flags) { - int f = 0; - if( flags != null ) { - if( flags.contains( "s" ) ) { - f |= Pattern.DOTALL; - } - if( flags.contains( "m" ) ) { - f |= Pattern.MULTILINE; - } - if( flags.contains( "i" ) ) { - f |= Pattern.CASE_INSENSITIVE; - } - } - return f; - } - }