You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2013/05/16 10:23:47 UTC
[Bug 54982] New: ExtractorFactory does not close files when
extracting via OCPPackage.open()
https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
Bug ID: 54982
Summary: ExtractorFactory does not close files when extracting
via OCPPackage.open()
Product: POI
Version: 3.9
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: dev@poi.apache.org
Reporter: dominik.stadler@gmx.at
Classification: Unclassified
Created attachment 30286
--> https://issues.apache.org/bugzilla/attachment.cgi?id=30286&action=edit
Patch to properly close the OCPPackage
This leaves files open longer than necessary and causes problems when working
with temporary files on Windows as they cannot be deleted unless they are
closed properly.
Attached patch fixes this.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ExtractorFactory does not |[PATCH] ExtractorFactory
|close files when extracting |does not close files when
|via OCPPackage.open() |extracting via
| |OCPPackage.open()
OS| |All
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
I'm not sure this'll work, as some of the extractors (eg
XSSFEventBasedExcelExtractor, or fetching the properties extractor) will still
need access to the OPCPackage during their processing of the file. If we close
the package during the create call, these would then break when you tried to
get the text / properties
Also, ExtractorFactory and the associated classes don't receive a lot of work
at the moment, almost all the text extraction effort goes into Apache Tika. You
might want to switch to Tika instead, that uses POI but now generally has
better support + cleaner ways of dealing with temporary resoures
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #30286|0 |1
is obsolete| |
CC| |dominik.stadler@gmx.at
--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
Created attachment 30337
--> https://issues.apache.org/bugzilla/attachment.cgi?id=30337&action=edit
Different approach adding a close() to the POITextExtractor and implementing it
in a few sub-classes
Hi, a close() sounds fine to me. I have created a patch which adds a close()
interface to POITextExtractor which can be used to free resources later. I have
implemented the close() in all classes that seem to make use of
closeable-resources. It also adds calls to close() in tests and runs existing
unit tests for XSSF-extractors also against the Extractor that is built via the
Factory. Finally it also add a small test-suite to quickly execute all
extractor-related tests.
Regarding updated documentation, I think that is fine and should it make easier
to spot the state of Extractors.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
--- Comment #2 from Dominik Stadler <do...@gmx.at> ---
Hmm, I did some more tests and unit tests, it seems to work as far as I see,
however if you state the class is dormant, I'll stop on this Bug.
The Extractor-stuff was an easy way to read the text from an Excel file in unit
tests, having to use another framework like Tika just for this would bloat the
unit test framework, so I am currently using a locally fixed version of the
ExtractorFactory which works fine for my purposes.
BTW, I also saw something like this in the class, which makes no sense at all,
using a locally created lock is not doing anything useful:
// Save the content
ReentrantReadWriteLock l = new ReentrantReadWriteLock();
try {
l.writeLock().lock();
...
Maybe at least the description at http://poi.apache.org/text-extraction.html
should state that the classes are dormant instead of sending users to a broken
class that is not updated currently...
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
Nick Burch <ap...@gagravarr.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #3 from Nick Burch <ap...@gagravarr.org> ---
I've tried to update the docs on the site, please could you take a look and let
me know if you think that covers it?
In terms of freeing resources, maybe we'd be better to add a close method to
the extractor base clases? That way, people can explicitly tidy up when they're
doing if they want (or fallback to the current lazy tidy), without the issues
of us trying to close resources before the user is done making calls with it.
Thoughts?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
--- Comment #5 from Nick Burch <ap...@gagravarr.org> ---
Patch looks good to me, please feel free to commit it yourself! :)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: [Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by Dominik Stadler <do...@gmx.at>.
Ah, ok, I was just trying to set the target milestone for a fixed bug, I am
fine with the bugzilla setup otherwise.
Thanks... Dominik.
On Mon, Jun 17, 2013 at 5:16 PM, Yegor Kozlov <ye...@dinom.ru> wrote:
> Milestones are not defined in the Bugzilla Preferences for POI, this
> is why this dropdown is empty.
>
> To edit Bugzilla preferences you need to request karma on the
> @infrastructure list. Or simply ask me what to add/change.
>
> Yegor
>
> On Mon, Jun 17, 2013 at 1:09 PM, Dominik Stadler <do...@gmx.at>
> wrote:
> > Hi,
> >
> > I saw that I cannot set things like target milestone when closing Bugs,
> do
> > I miss some bugzilla permissions?
> >
> > Thanks... Dominik.
> >
> >
> > On Mon, Jun 17, 2013 at 9:56 AM, <bu...@apache.org> wrote:
> >
> >> https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
> >>
> >> Dominik Stadler <do...@gmx.at> changed:
> >>
> >> What |Removed |Added
> >>
> >>
> ----------------------------------------------------------------------------
> >> Status|NEW |RESOLVED
> >> Resolution|--- |FIXED
> >>
> >> --- Comment #6 from Dominik Stadler <do...@gmx.at> ---
> >> Patch is committed on trunk now, Extractor now implements Closeable and
> >> tests
> >> are adjusted/enhanced accordingly
> >>
> >> M src/java/org/apache/poi/POITextExtractor.java
> >> M src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
> >> M
> >>
> >>
> src/ooxml/java/org/apache/poi/xssf/extractor/XSSFEventBasedExcelExtractor.java
> >> M
> >> src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java
> >> M
> >>
> >>
> src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java
> >> M
> >>
> >>
> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractor.java
> >> A
> >>
> >>
> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractorUsingFactory.java
> >> M
> >>
> >>
> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractor.java
> >> A
> >>
> >>
> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractorUsingFactory.java
> >> M
> >>
> >>
> src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
> >> M
> >> src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
> >> Committed r1493669
> >>
> >> --
> >> You are receiving this mail because:
> >> You are the assignee for the bug.
> >>
> >> ---------------------------------------------------------------------
> >> 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: [Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by Yegor Kozlov <ye...@dinom.ru>.
Milestones are not defined in the Bugzilla Preferences for POI, this
is why this dropdown is empty.
To edit Bugzilla preferences you need to request karma on the
@infrastructure list. Or simply ask me what to add/change.
Yegor
On Mon, Jun 17, 2013 at 1:09 PM, Dominik Stadler <do...@gmx.at> wrote:
> Hi,
>
> I saw that I cannot set things like target milestone when closing Bugs, do
> I miss some bugzilla permissions?
>
> Thanks... Dominik.
>
>
> On Mon, Jun 17, 2013 at 9:56 AM, <bu...@apache.org> wrote:
>
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
>>
>> Dominik Stadler <do...@gmx.at> changed:
>>
>> What |Removed |Added
>>
>> ----------------------------------------------------------------------------
>> Status|NEW |RESOLVED
>> Resolution|--- |FIXED
>>
>> --- Comment #6 from Dominik Stadler <do...@gmx.at> ---
>> Patch is committed on trunk now, Extractor now implements Closeable and
>> tests
>> are adjusted/enhanced accordingly
>>
>> M src/java/org/apache/poi/POITextExtractor.java
>> M src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
>> M
>>
>> src/ooxml/java/org/apache/poi/xssf/extractor/XSSFEventBasedExcelExtractor.java
>> M
>> src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java
>> M
>>
>> src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java
>> M
>>
>> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractor.java
>> A
>>
>> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractorUsingFactory.java
>> M
>>
>> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractor.java
>> A
>>
>> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractorUsingFactory.java
>> M
>>
>> src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
>> M
>> src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
>> Committed r1493669
>>
>> --
>> You are receiving this mail because:
>> You are the assignee for the bug.
>>
>> ---------------------------------------------------------------------
>> 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: [Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by Dominik Stadler <do...@gmx.at>.
Hi,
I saw that I cannot set things like target milestone when closing Bugs, do
I miss some bugzilla permissions?
Thanks... Dominik.
On Mon, Jun 17, 2013 at 9:56 AM, <bu...@apache.org> wrote:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
>
> Dominik Stadler <do...@gmx.at> changed:
>
> What |Removed |Added
>
> ----------------------------------------------------------------------------
> Status|NEW |RESOLVED
> Resolution|--- |FIXED
>
> --- Comment #6 from Dominik Stadler <do...@gmx.at> ---
> Patch is committed on trunk now, Extractor now implements Closeable and
> tests
> are adjusted/enhanced accordingly
>
> M src/java/org/apache/poi/POITextExtractor.java
> M src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
> M
>
> src/ooxml/java/org/apache/poi/xssf/extractor/XSSFEventBasedExcelExtractor.java
> M
> src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java
> M
>
> src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java
> M
>
> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractor.java
> A
>
> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractorUsingFactory.java
> M
>
> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractor.java
> A
>
> src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractorUsingFactory.java
> M
>
> src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
> M
> src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
> Committed r1493669
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>
>
[Bug 54982] [PATCH] ExtractorFactory does not close files when
extracting via OCPPackage.open()
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54982
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Dominik Stadler <do...@gmx.at> ---
Patch is committed on trunk now, Extractor now implements Closeable and tests
are adjusted/enhanced accordingly
M src/java/org/apache/poi/POITextExtractor.java
M src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
M
src/ooxml/java/org/apache/poi/xssf/extractor/XSSFEventBasedExcelExtractor.java
M
src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java
M
src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java
M
src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractor.java
A
src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractorUsingFactory.java
M
src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractor.java
A
src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFExcelExtractorUsingFactory.java
M
src/ooxml/testcases/org/apache/poi/xwpf/extractor/TestXWPFWordExtractor.java
M
src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
Committed r1493669
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org