You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Andreas Beeker <an...@gmx.de> on 2014/11/10 00:54:33 UTC

Why is this breaking the tests?

Hi,

my local build recently started to break and I could track it down to a small (uncommited) change in XSSFTestDataSamples:
http://pastebin.com/UCb7FrWN

Why is closing the workbook-source breaking tests like TestStylesTable?

Andi.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: Why is this breaking the tests?

Posted by Andreas Beeker <an...@gmx.de>.
Thank you Dominik, you are of course right ... I somehow missed that double-usage
yesterday night ... :|

Andi.

On 10.11.2014 21:23, Dominik Stadler wrote:
> Yes I did run it. The failures are a bit strange, but I think you get
> them because members are null that are cleared during close()ing, e.g.
> POIXMLDocument.pkg is nullified.
>
> and the Workbook is referenced again after the first
> writeOutandReadBack(), e.g. in one of the failing unit test there is
> the following code:
>
>         st = XSSFTestDataSamples.writeOutAndReadBack(workbook).getStylesSource();
>
>         ...
>
>         assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(workbook));
>
> here the workbook is passed two times to writeOutAndReadBack(), but in
> your case it is already closed in the first call, thus the second
> invocation fails.
>
> The other two unit-test failures in TestStylesTable are similar, the
> workbook is accessed in the second writeOutAndReadBack() after it was
> closed before and so the second write fails.
>
> Dominik.
>
> On Mon, Nov 10, 2014 at 6:45 PM, kiwiwings <ki...@apache.org> wrote:
>> Have you tried applying the pastebin to your local XSSFTestDataSamples class
>> and run the TestStylesTable test?
>>
>> The original source reference is not used again in these tests and I've got
>> unrelated errors, which seem not to be connected to closed resources.
>> Last time when I've tried the ubuntu live cd, this also happened there, so I
>> think it's not specific to the op-system.
>>
>> Andi
>>
>>
>>
>> --
>> View this message in context: http://apache-poi.1045710.n5.nabble.com/Why-is-this-breaking-the-tests-tp5717111p5717133.html
>> Sent from the POI - Dev mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
>> For additional commands, e-mail: dev-help@poi.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: Why is this breaking the tests?

Posted by Dominik Stadler <do...@gmx.at>.
Yes I did run it. The failures are a bit strange, but I think you get
them because members are null that are cleared during close()ing, e.g.
POIXMLDocument.pkg is nullified.

and the Workbook is referenced again after the first
writeOutandReadBack(), e.g. in one of the failing unit test there is
the following code:

        st = XSSFTestDataSamples.writeOutAndReadBack(workbook).getStylesSource();

        ...

        assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(workbook));

here the workbook is passed two times to writeOutAndReadBack(), but in
your case it is already closed in the first call, thus the second
invocation fails.

The other two unit-test failures in TestStylesTable are similar, the
workbook is accessed in the second writeOutAndReadBack() after it was
closed before and so the second write fails.

Dominik.

On Mon, Nov 10, 2014 at 6:45 PM, kiwiwings <ki...@apache.org> wrote:
> Have you tried applying the pastebin to your local XSSFTestDataSamples class
> and run the TestStylesTable test?
>
> The original source reference is not used again in these tests and I've got
> unrelated errors, which seem not to be connected to closed resources.
> Last time when I've tried the ubuntu live cd, this also happened there, so I
> think it's not specific to the op-system.
>
> Andi
>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/Why-is-this-breaking-the-tests-tp5717111p5717133.html
> Sent from the POI - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: Why is this breaking the tests?

Posted by kiwiwings <ki...@apache.org>.
Have you tried applying the pastebin to your local XSSFTestDataSamples class
and run the TestStylesTable test?

The original source reference is not used again in these tests and I've got
unrelated errors, which seem not to be connected to closed resources.
Last time when I've tried the ubuntu live cd, this also happened there, so I
think it's not specific to the op-system.

Andi



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Why-is-this-breaking-the-tests-tp5717111p5717133.html
Sent from the POI - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: Why is this breaking the tests?

Posted by Dominik Stadler <do...@gmx.at>.
Hi,

I think it is because you are closing the Workbook that was passed in
and thus make it invalid to be used anywhere else afterwards, however
the test continues to use this instance of Workbook for other things
in the test, i.e. the close() closes a resource that is still used
afterwards.

Dominik.


On Mon, Nov 10, 2014 at 12:54 AM, Andreas Beeker <an...@gmx.de> wrote:
> Hi,
>
> my local build recently started to break and I could track it down to a small (uncommited) change in XSSFTestDataSamples:
> http://pastebin.com/UCb7FrWN
>
> Why is closing the workbook-source breaking tests like TestStylesTable?
>
> Andi.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org