Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Implemented
-
2.10.0SDK, 2.10.2SDK, 3.0.0SDK, 2.10.3SDK
-
None
-
None
Description
In org.apache.uima.resource.metadata.impl.MetaDataObject_impl
The method:
public boolean equals(Object aObj)
calls another method:
private boolean valuesEqual(Object val1, Object val2)
However, in "valuesEqual", the CasProcessorConfigurationParameterSettings is never compared.
Suggest to add the following in valuesEqual method:
if (val1 instanceof CasProcessorConfigurationParameterSettingsImpl) {// only need this to handle Maps w/ array vals
if (!(val2 instanceof CasProcessorConfigurationParameterSettingsImpl))Unknown macro: { return false; }CasProcessorConfigurationParameterSettingsImpl settings1 = (CasProcessorConfigurationParameterSettingsImpl) val1;
CasProcessorConfigurationParameterSettingsImpl settings2 = (CasProcessorConfigurationParameterSettingsImpl) val2;
if (settings1.getParameterSettings().length != settings2.getParameterSettings().length)if (settings1.getParameterSettings().length >= settings2.getParameterSettings().length) {
Map<String, Object> values2 = new HashMap<>();
for (NameValuePair pair : settings2.getParameterSettings())Unknown macro: { values2.put(pair.getName(), pair.getValue()); }for (NameValuePair pair : settings1.getParameterSettings()) {
if (values2.containsKey(pair.getName())
&& !values2.get(pair.getName()).equals(pair.getValue()))Unknown macro: { return false; }values2.remove(pair.getName());
}
if (values2.size() > 0)
return false;
} else {
Map<String, Object> values1 = new HashMap<>();
for (NameValuePair pair : settings1.getParameterSettings())Unknown macro: { values1.put(pair.getName(), pair.getValue()); }for (NameValuePair pair : settings2.getParameterSettings()) {
if (values1.containsKey(pair.getName())
&& values1.get(pair.getName()).equals(pair.getValue()))values1.remove(pair.getName());
}
if (values1.size() > 0)
return false;
}
return true;
}