Fix NPE in StandardReconConfig. Closes #2076.
This commit is contained in:
parent
8d97c519d8
commit
33ff7be18a
@ -567,7 +567,7 @@ public class StandardReconConfig extends ReconConfig {
|
||||
* the cell value to compare the reconciliation data to
|
||||
*/
|
||||
public void computeFeatures(Recon recon, String text) {
|
||||
if (recon.candidates != null && !recon.candidates.isEmpty()) {
|
||||
if (recon.candidates != null && !recon.candidates.isEmpty() && text != null) {
|
||||
ReconCandidate candidate = recon.candidates.get(0);
|
||||
|
||||
recon.setFeature(Recon.Feature_nameMatch, text.equalsIgnoreCase(candidate.name));
|
||||
|
@ -345,4 +345,15 @@ public class StandardReconConfigTests extends RefineTest {
|
||||
stub.computeFeatures(recon, "my string");
|
||||
assertNotNull(recon.features);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should not happen, but added for extra safety
|
||||
*/
|
||||
@Test
|
||||
public void testComputeFeaturesNullText() {
|
||||
StandardReconConfigStub stub = new StandardReconConfigStub();
|
||||
Recon recon = stub.createNewRecon(2384738L);
|
||||
stub.computeFeatures(recon, null);
|
||||
assertNotNull(recon.features);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user