uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hai-Son Nguyen (JIRA)" <...@uima.apache.org>
Subject [jira] [Commented] (UIMA-6112) JSON serializer produces repeated duplicate types
Date Fri, 09 Aug 2019 17:28:00 GMT

    [ https://issues.apache.org/jira/browse/UIMA-6112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16904054#comment-16904054
] 

Hai-Son Nguyen commented on UIMA-6112:
--------------------------------------

Searched through the versions and see that this was fixed in 2.10.0 may already be handled!

> JSON serializer produces repeated duplicate types
> -------------------------------------------------
>
>                 Key: UIMA-6112
>                 URL: https://issues.apache.org/jira/browse/UIMA-6112
>             Project: UIMA
>          Issue Type: Bug
>          Components: UIMA
>    Affects Versions: 2.7.0SDK, 2.8.0SDK, 2.8.1SDK, 2.9.0SDK
>            Reporter: Hai-Son Nguyen
>            Priority: Critical
>
> The JSON produces using the JsonCasSerializer contains errors.
> Tracked it back and it looks like a comparator is used to sort an array
> uimaj-core : org.apache.uima.cas.impl.CasSerializerSupport.sortedUsedTypes
> in method:
> getSortedUsedTypes() used Arrays.sort(TypeImpl[], Comparator<TypeImpl>)
> Used Comparator:
> uimaj-core : org.apache.uima.cas.impl.CasSerializerSupport.COMPARATOR_SHORT_TYPENAME
(non-public)
>   *final* *static* Comparator<TypeImpl> *_COMPARATOR_SHORT_TYPENAME_* = *new*
Comparator<TypeImpl>() {
>     *public* *int* compare(TypeImpl object1, TypeImpl object2) {
>       *return* object1.getShortName().compareTo(object2.getShortName());
>     }
>   };
>  
> and then the default type comparison is used for a binary search
> org.apache.uima.cas.impl.TypeImpl implements Comparable<TypeImp>
>   *public* *int* compareTo(TypeImpl t) {
>     *if* (*this* == t) {
>       *return* 0;
>     }
>     *return* (*this*.code < t.code) ? -1 : 1;
>   }
>  
> In uima-json : org.apache.uima.json.JsonCasSerializer.collectUsedSubTypes()
> the Arrays.binarySearch(TypeImpl[], TypeImpl) is used
>  
> This can lead to types incorrectly being added as not used into the parentTypesWithNoInstances
IntVector which is used to add those types (duplicating the spec for a used type).



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Mime
View raw message