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

createExternalResourceDescription() signatures shadowing each other

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0uimaFIT
    • 3.0.0uimaFIT
    • uimaFIT
    • None

    Description

      The method

      ExternalResourceDescription createExternalResourceDescription(
        Class<? extends SharedResourceObject> aInterface, 
        String aUrl, 
        Object... aParams)
      

      can be invoked if the user actually wanted to call the method

      ExternalResourceDescription createExternalResourceDescription(
        Class<? extends Resource> aInterface, 
        Object... aParams)
      

      E.g.

      createExternalResourceDescription(
              MyResource,
              MyResource.PARAM_VALUE, 
              "myvalue"))
      

      Java seems to be smart enough to invoke the correct method, but when calling this from Groovy, it fails:

      Caught: java.lang.IllegalArgumentException: Parameter arguments have to come in key/value pairs, but found odd number of arguments [3]
      java.lang.IllegalArgumentException: Parameter arguments have to come in key/value pairs, but found odd number of arguments [3]
      	at org.apache.uima.fit.factory.ConfigurationParameterFactory.ensureParametersComeInPairs(ConfigurationParameterFactory.java:531)
      	at org.apache.uima.fit.factory.ConfigurationParameterFactory.createConfigurationData(ConfigurationParameterFactory.java:374)
      	at org.apache.uima.fit.factory.ExternalResourceFactory.createExternalResourceDescription(ExternalResourceFactory.java:277)
      	at org.apache.uima.fit.factory.ExternalResourceFactory.createExternalResourceDescription(ExternalResourceFactory.java:213)
      

      A workaround is currently to cast the first parameter name to Object:

      createExternalResourceDescription(
              MyResource,
              (Object) MyResource.PARAM_VALUE, 
              "myvalue"))
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rec Richard Eckart de Castilho
            rec Richard Eckart de Castilho
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment