Parameters is null when processing two docx document in a row

Issue #89 resolved
Former user created an issue

Original [issue 89](https://code.google.com/p/okapi/issues/detail?id=89) created by @ysavourel on 2009-07-13T03:17:40.000Z:

I get a null pointer for the second document processed in a row with the openxml filter. Not sure where the issue is exactly. this wasn't occuring before, but i don't know when it started to happend.

-- Input: Word2007Document.docx -- Input: Copy of Word2007Document.docx ERROR: Error with utility. null @ java.lang.NullPointerException java.lang.NullPointerException at net.sf.okapi.filters.abstractmarkup.Parameters.toString(Unknown Source) at net.sf.okapi.common.BaseParameters.save(Unknown Source) at net.sf.okapi.applications.rainbow.packages.BaseWriter.createOutput(Unknown Source) at net.sf.okapi.applications.rainbow.packages.xliff.Writer.createOutput (Unknown Source) at net.sf.okapi.applications.rainbow.utilities.extraction.Utility.processStart Document(Unknown Source) at net.sf.okapi.applications.rainbow.utilities.extraction.Utility.handleEvent (Unknown Source) at net.sf.okapi.applications.rainbow.utilities.BaseFilterDrivenUtility.process FilterInput(Unknown Source) at net.sf.okapi.applications.rainbow.UtilityDriver.execute(Unknown Source) at net.sf.okapi.applications.rainbow.MainForm.launchUtility (Unknown Source) at net.sf.okapi.applications.rainbow.MainForm.access$5400(Unknown Source) at net.sf.okapi.applications.rainbow.MainForm$75.widgetSelected (Unknown Source) at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source) at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at net.sf.okapi.applications.rainbow.MainForm.run(Unknown Source) at net.sf.okapi.applications.rainbow.Main.main(Unknown Source)

Comments (10)

  1. Former user Account Deleted

    Comment [2.](https://code.google.com/p/okapi/issues/detail?id=89#c2) originally posted by @ysavourel on 2009-07-13T14:05:02.000Z:

    In the OpenXMLFilter constructor we have: cparams = new ConditionalParameters(); params = cparams; readParams();

    and getParameters() return params so when we do: IParameters p = filter.getParameters(); p.reset();

    we reset the base filter instead of the real instance.

  2. Former user Account Deleted

    Comment [3.](https://code.google.com/p/okapi/issues/detail?id=89#c3) originally posted by @ysavourel on 2009-07-14T19:27:34.000Z:

    I made a change to the abstractmarkup filter so we now create a proper default configuration when reset is called. I also added a no param constructor.

    I'm not sure this will fix the problem as the default configuration is pretty much useless it only contains "collapse\_whitespace: false"

  3. Former user Account Deleted

    Comment [5.](https://code.google.com/p/okapi/issues/detail?id=89#c5) originally posted by @ysavourel on 2009-07-14T22:17:17.000Z:

    It seems to be working, but I'm not sure if it does the right thing. It seems there are two object params and cparams, one from the abstract filter, the other from the derived filter. params get set to cparams somewhere, but when calling reset it seems you get directly to params.reset() rather than cparams.reset(). Dan should probably look at this to be sure we have the proper 'default'.

  4. Former user Account Deleted

    Comment [6.](https://code.google.com/p/okapi/issues/detail?id=89#c6) originally posted by @ysavourel on 2009-07-15T22:52:32.000Z:

    Dan - we need to look at the overall design for using abstractmarkup filter parameters with derived filters - I think we are mixing up the specific filters needs (HTML, OpenXML) with the needs of abstractmarkup filter.

    Since we are looking at the filter refactor anyway this fits in nicely.

  5. Former user Account Deleted

    Comment [7.](https://code.google.com/p/okapi/issues/detail?id=89#c7) originally posted by @ysavourel on 2009-07-16T21:14:13.000Z:

    I removed Parameters from abstractmarkup filter and all associated code. It's now the responsibility of the implementers to create a Parameters class that does the correct thing with reset.

    HTML filter is updated and all tests pass - Dan will work on OpenXML.

    This is a much cleaner design - we were trying to do too much in the base class before.

  6. Former user Account Deleted

    Comment [9.](https://code.google.com/p/okapi/issues/detail?id=89#c9) originally posted by @ysavourel on 2009-07-24T14:19:53.000Z:

    The issue seems to come from calling reset() on the openxml parameters. In net.sf.okapi.filters.openxml.YamlParameters:

    public void reset() { taggedConfig = new TaggedFilterConfiguration (OpenXMLContentFilter.class.getResource(DEFAULT\_PARAMETERS)); }

    getResource() return a null.

    DEFAULT\_PARAMETERS is set to "defaultConfiguration.yml" but that file does not seem to be in the directory.

  7. Log in to comment