Merge pull request #943 from mrijke/partialdimextractfn-nullpointer

Fix NullPointerException in PartialDimExtractionFn
This commit is contained in:
Fangjin Yang 2014-12-16 12:29:27 -07:00
commit be507b8cb4
2 changed files with 2 additions and 0 deletions

View File

@ -58,6 +58,7 @@ public class PartialDimExtractionFn implements DimExtractionFn
@Override @Override
public String apply(String dimValue) public String apply(String dimValue)
{ {
dimValue = (dimValue == null) ? "" : dimValue;
Matcher matcher = pattern.matcher(dimValue); Matcher matcher = pattern.matcher(dimValue);
return matcher.find() ? dimValue : null; return matcher.find() ? dimValue : null;
} }

View File

@ -41,6 +41,7 @@ public class PartialDimExtractionFnTest
"Vancouver", "Vancouver",
"Pretoria", "Pretoria",
"Wellington", "Wellington",
null,
"Ontario" "Ontario"
}; };