You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Richard Eckart de Castilho (JIRA)" <de...@uima.apache.org> on 2016/09/01 10:23:21 UTC

[jira] [Updated] (UIMA-5096) ExternalResourceFactory.createExternalResourceDescription does not accept non-string parameters

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

Richard Eckart de Castilho updated UIMA-5096:
---------------------------------------------
    Description: 
In 

{noformat}
org.apache.uima.fit.factory.ExternalResourceFactory 
{noformat}

the method

{noformat}
public static ExternalResourceDescription createExternalResourceDescription(Class<? extends Resource> aInterface, Object... aParams)
{noformat}
does not accept non-string parameters.

Example:
The following works:
Caller:

{noformat}
ExternalResourceDescription geographicalResourceDescription = ExternalResourceFactory.createExternalResourceDescription(
					GeographicalResourceImplementation.class,
GeographicalResource.MAX_LENGTH_PARAMETER, String.valueOf(5),
);
{noformat}

Resource:
{noformat}
@ConfigurationParameter(name = MAX_LENGTH_PARAMETER)
private String maxLengthString;
{noformat}

The following fails:
Caller:

{noformat}
ExternalResourceDescription geographicalResourceDescription = ExternalResourceFactory.createExternalResourceDescription(
					GeographicalResourceImplementation.class,
GeographicalResource.MAX_LENGTH_PARAMETER, 5,
);
{noformat}

Resource:

{noformat}
@ConfigurationParameter(name = MAX_LENGTH_PARAMETER)
private int maxLength;
{noformat}


The exception is:

{noformat}
java.lang.ClassCastException: java.lang.Integer 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)
	...
{noformat}





  was:
In
org.apache.uima.fit.factory.ExternalResourceFactory
The method
public static ExternalResourceDescription createExternalResourceDescription(Class<? extends Resource> aInterface, Object... aParams)

does not accept non-string parameters.

Example:
The following works:
Caller:
ExternalResourceDescription geographicalResourceDescription = ExternalResourceFactory.createExternalResourceDescription(
					GeographicalResourceImplementation.class,
GeographicalResource.MAX_LENGTH_PARAMETER, String.valueOf(5),
);

Resource:
@ConfigurationParameter(name = MAX_LENGTH_PARAMETER)
private String maxLengthString;



The following fails:
Caller:
ExternalResourceDescription geographicalResourceDescription = ExternalResourceFactory.createExternalResourceDescription(
					GeographicalResourceImplementation.class,
GeographicalResource.MAX_LENGTH_PARAMETER, 5,
);

Resource:
@ConfigurationParameter(name = MAX_LENGTH_PARAMETER)
private int maxLength;



The exception is:
java.lang.ClassCastException: java.lang.Integer 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)
	...







> ExternalResourceFactory.createExternalResourceDescription does not accept non-string parameters
> -----------------------------------------------------------------------------------------------
>
>                 Key: UIMA-5096
>                 URL: https://issues.apache.org/jira/browse/UIMA-5096
>             Project: UIMA
>          Issue Type: Bug
>          Components: uimaFIT
>    Affects Versions: 2.2.0uimaFIT
>         Environment: Java
>            Reporter: Asher Stern
>
> In 
> {noformat}
> org.apache.uima.fit.factory.ExternalResourceFactory 
> {noformat}
> the method
> {noformat}
> public static ExternalResourceDescription createExternalResourceDescription(Class<? extends Resource> aInterface, Object... aParams)
> {noformat}
> does not accept non-string parameters.
> Example:
> The following works:
> Caller:
> {noformat}
> ExternalResourceDescription geographicalResourceDescription = ExternalResourceFactory.createExternalResourceDescription(
> 					GeographicalResourceImplementation.class,
> GeographicalResource.MAX_LENGTH_PARAMETER, String.valueOf(5),
> );
> {noformat}
> Resource:
> {noformat}
> @ConfigurationParameter(name = MAX_LENGTH_PARAMETER)
> private String maxLengthString;
> {noformat}
> The following fails:
> Caller:
> {noformat}
> ExternalResourceDescription geographicalResourceDescription = ExternalResourceFactory.createExternalResourceDescription(
> 					GeographicalResourceImplementation.class,
> GeographicalResource.MAX_LENGTH_PARAMETER, 5,
> );
> {noformat}
> Resource:
> {noformat}
> @ConfigurationParameter(name = MAX_LENGTH_PARAMETER)
> private int maxLength;
> {noformat}
> The exception is:
> {noformat}
> java.lang.ClassCastException: java.lang.Integer 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)
> 	...
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)