File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
main/java/org/metafacture/metamorph/functions
test/java/org/metafacture/metamorph/functions Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ public final class Regexp extends AbstractFunction {
39
39
public void receive (final String name , final String value ,
40
40
final NamedValueSource source , final int recordCount ,
41
41
final int entityCount ) {
42
+ if (null == value ) {
43
+ return ;
44
+ }
42
45
matcher .reset (value );
43
46
if (null == format ) {
44
47
while (matcher .find ()) {
Original file line number Diff line number Diff line change @@ -95,4 +95,27 @@ public void shouldIgnoreEmptyMatchGroups() {
95
95
ordered .verify (receiver ).endRecord ();
96
96
ordered .verifyNoMoreInteractions ();
97
97
}
98
+
99
+ @ Test
100
+ public void shouldIgnoreNullValues () {
101
+ metamorph = InlineMorph .in (this )
102
+ .with ("<rules>" )
103
+ .with (" <data source='s'>" )
104
+ .with (" <regexp match='a.*' />" )
105
+ .with (" </data>" )
106
+ .with ("</rules>" )
107
+ .createConnectedTo (receiver );
108
+
109
+ metamorph .startRecord ("1" );
110
+ metamorph .literal ("s" , "aaccdd" );
111
+ metamorph .literal ("s" , null );
112
+ metamorph .endRecord ();
113
+
114
+ final InOrder ordered = inOrder (receiver );
115
+ ordered .verify (receiver ).startRecord ("1" );
116
+ ordered .verify (receiver ).literal ("s" , "aaccdd" );
117
+ ordered .verify (receiver ).endRecord ();
118
+ ordered .verifyNoMoreInteractions ();
119
+ }
120
+
98
121
}
You can’t perform that action at this time.
0 commit comments