uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jianlin Shi (JIRA)" <...@uima.apache.org>
Subject [jira] [Closed] (UIMA-5813) MetaDataObject_impl doesn't compare CasProcessorConfigurationParameterSettings when the "equals" is called
Date Tue, 10 Jul 2018 04:32:00 GMT

     [ https://issues.apache.org/jira/browse/UIMA-5813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jianlin Shi closed UIMA-5813.
-----------------------------
    Resolution: Implemented

> MetaDataObject_impl doesn't compare CasProcessorConfigurationParameterSettings when the
"equals" is called
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: UIMA-5813
>                 URL: https://issues.apache.org/jira/browse/UIMA-5813
>             Project: UIMA
>          Issue Type: Bug
>          Components: UIMA
>    Affects Versions: 2.10.0SDK, 2.10.2SDK, 3.0.0SDK, 2.10.3SDK
>            Reporter: Jianlin Shi
>            Priority: Major
>
> In org.apache.uima.resource.metadata.impl.MetaDataObject_impl
> The method:
> {color:#cc7832}public boolean {color}{color:#ffc66d}equals{color}{color:#9876aa}({color}Object
aObj{color:#9876aa}) {color}
> {color:#333333}calls another method:{color}{color:#9876aa}
> {color}
> {color:#cc7832}private boolean {color}{color:#ffc66d}valuesEqual{color}{color:#9876aa}({color}Object
val1{color:#cc7832}, {color}Object val2{color:#9876aa})
> {color}
> However, in "valuesEqual", the CasProcessorConfigurationParameterSettings is never compared.
> Suggest to add the following in valuesEqual method:
> {quote}        if (val1 instanceof CasProcessorConfigurationParameterSettingsImpl)
{// only need this to handle Maps w/ array vals
>             if (!(val2 instanceof CasProcessorConfigurationParameterSettingsImpl))
{
>                 return false;
>             }
>             CasProcessorConfigurationParameterSettingsImpl settings1 = (CasProcessorConfigurationParameterSettingsImpl)
val1;
>             CasProcessorConfigurationParameterSettingsImpl settings2 = (CasProcessorConfigurationParameterSettingsImpl)
val2;
>             if (settings1.getParameterSettings().length != settings2.getParameterSettings().length)
{
>                 return false;
>             }
>             if (settings1.getParameterSettings().length >= settings2.getParameterSettings().length)
{
>                 Map<String, Object> values2 = new HashMap<>();
>                 for (NameValuePair pair : settings2.getParameterSettings())
{
>                     values2.put(pair.getName(), pair.getValue());
>                 }
>                 for (NameValuePair pair : settings1.getParameterSettings())
{
>                     if (values2.containsKey(pair.getName())
>                             && !values2.get(pair.getName()).equals(pair.getValue()))
{
>                         return false;
>                     }
>                     values2.remove(pair.getName());
>                 }
>                 if (values2.size() > 0)
>                     return false;
>             } else {
>                 Map<String, Object> values1 = new HashMap<>();
>                 for (NameValuePair pair : settings1.getParameterSettings())
{
>                     values1.put(pair.getName(), pair.getValue());
>                 }
>                 for (NameValuePair pair : settings2.getParameterSettings())
{
>                     if (values1.containsKey(pair.getName())
>                             && values1.get(pair.getName()).equals(pair.getValue()))
{
>                         return false;
>                     }
>                     values1.remove(pair.getName());
>                 }
>                 if (values1.size() > 0)
>                     return false;
>             }
>             return true;
>         }
> {quote}
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message