On Tue, Jul 28, 2009 at 5:20 PM, Marshall Schor<m...@schor.com> wrote:
> While fixing up the sandbox build I ran across what looks like a bug -
> the PearAnalysisEngineWrapper is throwing a NPE because it is being
> passed in "null" for the map of additional parameters in its
> "initialize" method, and it's not expecting that.
>
> Here's one such path where null is passed in:
>
> UimaFramework.produceAE (line 335) - a public static method which passes
> in a null value for the additionalParameters.
>
> This calls UimaFramework.produceResource which on line 267 calls
> CompositeResourceFactory_impl.produceResource which on line 62 calls
> SimpleResourceFactory.produceResource which on line 122 calls
> the resource's "initialize" method, in this case, the
> PearAnalysisEngineWrapper initialize.
>
> What is the "right" way to fix this?
>
> Is a "null" value for the map of additional parameters supposed to be
> replaced with an empty hashmap somewhere along the calling path to this
> point, or should I do that in the PearAnalysisEngineWrapper code?  (If I
> do it higher up, it may fix more potential bad "paths"...)
>

Yes, null should be treated as an empty map.  The other
implementations of the AnalysisEngine interface do this.  For example
in PrimitiveAnalysisEngine_impl line 147 it does this before trying to
look up parameters in the map:

      if (aAdditionalParams == null) {
        aAdditionalParams = Collections.EMPTY_MAP;
      }

 -Adam

Reply via email to