UIMA
  1. UIMA
  2. UIMA-1499

Potential ClassCastException in CasPool

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Core Java Framework
    • Labels:
      None

      Description

      The CasPool has a constructor

      CasPool(int aNumInstances, Collection aComponentDescriptionsOrMetaData,
      Properties aPerformanceTuningSettings, ResourceManager
      aResourceManager)

      where aComponentDescriptionsOrMetaData is a collection which can contain
      according
      to javadoc "AnalysisEngineDescription, CollectionReaderDescription,
      CasConsumerDescription or ProcessingResourceMetaData objects"

      A reference of the Collection is passed to fillPool which passes the
      Collection
      to a CasDefinition constructor which then casts everything to
      ProcessingResourceMetaData,
      which will result in a ClassCastException in the case of
      AnalysisEngineDescription,
      CollectionReaderDescription and CasConsumerDescription objects.

        Activity

        Hide
        Tommaso Teofili added a comment -

        we could use generics to ensure this at compile time i.e.
        public CasPool(...., Collection<ProcessingResourceMetaData> aComponentDescriptionsOrMetaData...) ...

        what do you think?

        Show
        Tommaso Teofili added a comment - we could use generics to ensure this at compile time i.e. public CasPool(...., Collection<ProcessingResourceMetaData> aComponentDescriptionsOrMetaData...) ... what do you think?
        Hide
        Joern Kottmann added a comment -

        Adam Lally already commented on the dev list:
        "Good catch, that javadoc does seem to be wrong. I wonder if it was
        correct at some point in the past and the code has changed? "

        Show
        Joern Kottmann added a comment - Adam Lally already commented on the dev list: "Good catch, that javadoc does seem to be wrong. I wonder if it was correct at some point in the past and the code has changed? "

          People

          • Assignee:
            Marshall Schor
            Reporter:
            Joern Kottmann
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development