Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-5096

ExternalResourceFactory.createExternalResourceDescription does not accept non-string parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.2.0uimaFIT
    • None
    • uimaFIT
    • None
    • Java

    Description

      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)
      	...
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              asher-stern Asher Stern
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: