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

Richard Eckart de Castilho commented on UIMA-3591:
--------------------------------------------------

I'm afraid, this issue cannot be fixed.

uimaFIT correctly coerces single values on multi-valued parameters *if it knows 
that the parameter is multi-valued*. This knowledge is obtained from the 
resource meta data that is part of a descriptor. The descriptor can come either 
from an XML file, or it can have been dynamically generated using uimaFIT. In 
this issue, the descriptor is dynamically created using uimaFIT.

For uimaFIT to know that a parameter exists and is multi-valued, a class field 
must have been marked using the @ConfigurationParameter annotation. If the 
field is an array or collection type, then uimaFIT will correctly mark the 
parameter as multi-valued in the descriptor.

In the present case, uimaFIT analyzes the WhitespaceTokenizer class which does 
not contain any @ConfigurationParameter annotations. Thus, the descriptor 
generated for this class does not contain any parameter declarations. 
Consequently, none of the type coercion mechanisms can function, as these rely 
on the parameter declarations. uimaFIT will still be able to initialize the 
component, but only if the parameters passed in the 
createEngineDescription-call match exactly the types expected by the UIMA 
component.

> Multi-values parameter does not accept single value when 
> @ConfigurationParameter is not present
> -----------------------------------------------------------------------------------------------
>
>                 Key: UIMA-3591
>                 URL: https://issues.apache.org/jira/browse/UIMA-3591
>             Project: UIMA
>          Issue Type: Bug
>          Components: uimaFIT
>    Affects Versions: 2.0.0uimaFIT
>            Reporter: Richard Eckart de Castilho
>
> This is not working
> {noformat}
> AnalysisEngineFactory.createEngineDescription(WhitespaceTokenizer.class,
>                "SofaNames", SimpleParserAE.SOFA_NAME_TEXT_ONLY);
> {noformat}
> I got a ClassCastException
> {noformat}
> Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to
> [Ljava.lang.String;
>    at
> org.apache.uima.annotator.WhitespaceTokenizer.initialize(WhitespaceTokenizer.java:328)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:252)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to