uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Tomás Atria <jtat...@gmail.com>
Subject ClassCastException when passing String[] parameters to external resource.
Date Fri, 10 Apr 2015 18:29:12 GMT
Hello all,

I'm getting this error when trying to pass values to a
@ConfiugrationParameter over a String[] field in a Resource
implementation...

Exception in thread "main" java.lang.ClassCastException:
[Ljava.lang.String; cannot be cast to java.lang.String
at
org.apache.uima.fit.factory.ExternalResourceFactory.createExternalResourceDescription(ExternalResourceFactory.java:177)
at
org.apache.uima.fit.factory.ExternalResourceFactory.createExternalResourceDescription(ExternalResourceFactory.java:122)

In the debugger, I can see that starting at line 175 in
ExternalResourceFactory:

          Parameter param = new Parameter_impl();
          param.setName((String) aParams[i * 2]);
          param.setValue((String) aParams[i * 2 + 1]);
          params.add(param);

aParams[i * 2] correctly resolves to the param key, while aParams[i * 2 +
1] resolves to the full string array, so param.setValue( (String) aParams[i
* 2 + 1 ]) fails with the above class cast exception.

I remember it being possible to pass String[]'s as values for
ConfigurationParameters passed to AnalysisEngineFactory... is this usage
not supported for external resources or am i doing something wrong?

Thanks!
​jta​

-- 
entia non sunt multiplicanda praeter necessitatem

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message