uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Isabel Drost <isa...@apache.org>
Subject Unit testing CollectionReaders
Date Wed, 29 Oct 2008 08:10:07 GMT

Hello,

I am about to do my first steps using UIMA. I started out with the tutorial 
and am about to write my first CollectionReader (extending 
CollectionReader_ImplBase). As the tutorial says, I implemented initialize() 
to init the reader from its config parameters:

> ...
> File webKbDir = new File((String) getConfigParameterValue(PARAM_INPUTDIR));
> ...

In order to test the class I created a unit test. I thought it might be a good 
idea to set the parameters of the reader in the setUp method of my test like 
this:

> ...
> public void setUp() throws Exception {
>   this.reader = new WebKbReader();
>   URL path = this.getClass().getResource("dataset");
>   String pathString = path.getPath();
>   this.reader.setConfigParameterValue(WebKbReader.PARAM_INPUTDIR, path);
>   this.reader.initialize();
> }
...

Unfortunately this gives me a null pointer exception in the line setting the 
config parameter that comes from inside UIMA:

> java.lang.NullPointerException
>	at 
org.apache.uima.resource.ConfigurableResource_ImplBase.getConfigParameterValue(ConfigurableResource_ImplBase.java:37)
>	at 
org.apache.mahout.clustering.webkb.kmeans.WebKbReader.initialize(WebKbReader.java:58)


I had a look at the UIMA code, the line throwing the exception is the 
following:

> public void setConfigParameterValue(String aParamName, Object aValue) {
>  getUimaContextAdmin().getConfigurationManager().setConfigParameterValue(
>      getUimaContextAdmin().getQualifiedContextName() + aParamName, aValue);
> }

I guess I am just making some stupid beginners mistake - forgot to initialize 
some internal UIMA object before calling my reader? Unfortunately I have no 
clue what could have gone wrong. Any help would be appreciated.

Thanks,
Isabel

-- 
A woman should have compassion.		-- Kirk, "Catspaw", stardate 3018.2
  |\      _,,,---,,_       Web:   <http://www.isabel-drost.de>
  /,`.-'`'    -.  ;-;;,_
 |,4-  ) )-,_..;\ (  `'-'
'---''(_/--'  `-'\_) (fL)  IM:  <xmpp://MaineC.@spaceboyz.net>

Mime
View raw message