Commit Graph

68 Commits

Author SHA1 Message Date
Dominik Stadler 205055b83c Prevent us from changing the file with every test-run
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1737488 13f79535-47bb-0310-9956-ffa450edef68
2016-04-02 11:01:49 +00:00
Dominik Stadler 328c52aab7 Fix some cases where file handles are not closed in OldExcelExtractor
Close resources in some more tests to make the file-leak report clean again

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1737487 13f79535-47bb-0310-9956-ffa450edef68
2016-04-02 11:01:43 +00:00
Dominik Stadler 0888ad4de5 Fix some compiler warnings, improve error message, cover some more code
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1737013 13f79535-47bb-0310-9956-ffa450edef68
2016-03-29 15:45:04 +00:00
Andreas Beeker f8767e3981 some zips can't be opened via ZipFile in JDK6, as the central directory
contains either non-latin entries or the compression type can't be handled
the workaround is to iterate over the stream and not the directory


git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1736933 13f79535-47bb-0310-9956-ffa450edef68
2016-03-28 22:49:45 +00:00
Tim Allison 81e49eff0f 59183 - handle timezones (even with colons) in date parsing metadata in ooxml opc
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1735270 13f79535-47bb-0310-9956-ffa450edef68
2016-03-16 17:52:42 +00:00
Nick Burch 197458b30c One final invalid file type check
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1735071 13f79535-47bb-0310-9956-ffa450edef68
2016-03-15 12:37:01 +00:00
Nick Burch 7112835d90 Before opening an OOXML file, check the first few bytes, and give helpful exceptions for common mistakes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1735069 13f79535-47bb-0310-9956-ffa450edef68
2016-03-15 12:30:45 +00:00
Nick Burch 4d7955d6b5 Start to give more helpful Exceptions from OPCPackage when non-OOXML files are passed to it
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1735060 13f79535-47bb-0310-9956-ffa450edef68
2016-03-15 11:50:57 +00:00
Andreas Beeker 3a328aa220 #57031 - Out of Memory when extracting text from attached files
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1734182 13f79535-47bb-0310-9956-ffa450edef68
2016-03-09 00:41:02 +00:00
Dominik Stadler 0a3370347e Fix freeing resources in some tests and dev-tools so we can run unit-tests with enabled file-leak-detector
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1721468 13f79535-47bb-0310-9956-ffa450edef68
2015-12-22 22:35:59 +00:00
Uwe Schindler 73a8488838 #58597: Fix tests to not do setAccessible(), add some doPrivileged, too.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1713891 13f79535-47bb-0310-9956-ffa450edef68
2015-11-11 16:57:39 +00:00
asf-sync-process c39e9df3c8 Add some more tests for the checks for files that can cause large memory usage.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1713217 13f79535-47bb-0310-9956-ffa450edef68
2015-11-08 10:00:38 +00:00
Andreas Beeker 9b4919cd51 extended forbidden-apis-check to ooxml-tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1712693 13f79535-47bb-0310-9956-ffa450edef68
2015-11-05 00:15:51 +00:00
Andreas Beeker 5f94d8b533 fix eclipse warning - mostly generics cosmetics
close resources in tests
junit4 conversions
convert spreadsheet based formular test to junit parameterized tests

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1702659 13f79535-47bb-0310-9956-ffa450edef68
2015-09-12 18:45:07 +00:00
Andreas Beeker aaafb0270d Bug 58326 - Forbidden APIs patches - first set of changes for locale and timezone settings
also includes fixes for
- name shadowing 
- unused deprecated method "getClipRect" in classes extending Graphics2d
- HexDump - replaced intermediate String.format calls with custom padding
- convert testcases to junit4
- closing resources

also tested with an arbitary timezone (PST) and locale (ru)

supresses forbidden apis check for
- LocaleUtil (the only place where Locale.getDefault() and TimeZone.getDefault() should be called)
- Classes using FontMetrics - without the actual text it's difficult to return something sane

Some usage of UTC and Locale.ROOT might be still wrong, e.g. in MapiMessage we don't access the
extended mapi properties, which might contain the timezone

DataFormatter has now a Observable property which need to be observed when custom formats are used
and the Locale changes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1701688 13f79535-47bb-0310-9956-ffa450edef68
2015-09-07 20:19:50 +00:00
Dominik Stadler 1e45197f59 * Adjust reported text when a Zip-Bomb is detected to allow to quickly see why it happened
* Fail only with inflation ratio lower than the min, not equals, to behave as documented
* Add getters to be able to temporarily adjust the limits for unit tests
* Allow lower inflation ratio in OOXMLPrettyPrint as this is a dev-only tool

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1696556 13f79535-47bb-0310-9956-ffa450edef68
2015-08-19 10:57:19 +00:00
Dominik Stadler ccc4ebcf70 Bug 56479: don't hardcode dcterms as namespace alias in the attribute, but expect the actual alias that is used in the corresponding element.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1695212 13f79535-47bb-0310-9956-ffa450edef68
2015-08-11 05:37:15 +00:00
Dominik Stadler efc96e1d8e Open file read-only in test to avoid making it dirty during running unit tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1688045 13f79535-47bb-0310-9956-ffa450edef68
2015-06-28 19:55:56 +00:00
Dominik Stadler bde247f61a Fix test to find the exception-text in all cases
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1687212 13f79535-47bb-0310-9956-ffa450edef68
2015-06-24 08:53:25 +00:00
Dominik Stadler 5103ea7c0c show full exception stack-trace if zip-bomb detection test fails
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1687197 13f79535-47bb-0310-9956-ffa450edef68
2015-06-24 08:33:06 +00:00
Andreas Beeker c0cb680292 Bug 56865 - Limit number of bytes (by counting them) while opening office docs
Bug 50090 - 'zip' bomb prevention

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1687148 13f79535-47bb-0310-9956-ffa450edef68
2015-06-23 23:39:07 +00:00
Nick Burch 2ccd6db57e More missing core properties unit tests, covering read-write without checks, and encryption
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1662972 13f79535-47bb-0310-9956-ffa450edef68
2015-02-28 17:37:11 +00:00
Nick Burch 327df5cf76 Unit tests for OPC handling of files without a Core Properties part
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1661663 13f79535-47bb-0310-9956-ffa450edef68
2015-02-23 13:21:23 +00:00
Dominik Stadler 5c76ccba5b Add missing close() of resources in both production code and tests
Use revert() instead of close() on OCPPackage in some places to not re-write the file unnecessarily.
This should now run tests without leftover file handles when checked with file leak detector and
allows to find newly introduced cases more easily.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1648160 13f79535-47bb-0310-9956-ffa450edef68
2014-12-28 09:16:57 +00:00
Nick Burch e2dd7f27c0 Test from Tim to include PropertyList in poi-ooxml-schemas
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1637548 13f79535-47bb-0310-9956-ffa450edef68
2014-11-08 12:21:27 +00:00
Uwe Schindler eabb6a924b More cleanups for bug #56814 and some more external entity leaks of #56164
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1617849 13f79535-47bb-0310-9956-ffa450edef68
2014-08-13 22:34:53 +00:00
Uwe Schindler 2f5bcfd162 Fix bug #56814 - Switch from dom4j to JAXP
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1617428 13f79535-47bb-0310-9956-ffa450edef68
2014-08-12 07:19:51 +00:00
Nick Burch 4c98f1db45 Patch from Raúl Wegmann from bug #56735 / GitHub Pull #10 - Rationalise POI temp file creation to the TempFile util class, and allow a system wide setting of where Temp files (eg for SXSSF) go, via TempFile / TempFileCreationStrategy
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1613246 13f79535-47bb-0310-9956-ffa450edef68
2014-07-24 18:58:27 +00:00
Nick Burch 6050a68d5a Two more test files from Stefan Kopf for bug #56164, and unit tests which use them
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1589759 13f79535-47bb-0310-9956-ffa450edef68
2014-04-24 14:52:09 +00:00
Nick Burch 32290bd2bf Another content types test, for #55026
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1570002 13f79535-47bb-0310-9956-ffa450edef68
2014-02-20 00:06:34 +00:00
Nick Burch d72bd78c19 Fix bug #56164 - Tidy up the OPC SAX setup code with a new common Helper
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1569991 13f79535-47bb-0310-9956-ffa450edef68
2014-02-19 23:54:46 +00:00
Nick Burch 56d6f0342a Complete support for OOXML content types with parameters, including parts of the patch from Sebastien Schneider from bug #55026
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1569976 13f79535-47bb-0310-9956-ffa450edef68
2014-02-19 23:34:53 +00:00
Nick Burch 6e933cb242 Begin to implement some of the tests and logic for content types with parameters, based on the test file for bug #55026
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1569965 13f79535-47bb-0310-9956-ffa450edef68
2014-02-19 23:12:56 +00:00
Nick Burch bf581e03b9 Stub out the unit tests needed for bug #55026, and add the sample file from that
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1487657 13f79535-47bb-0310-9956-ffa450edef68
2013-05-29 22:23:51 +00:00
Nick Burch 2f0107bb4e Where possible, allow fetching of the size of the OPC Package Part (-1 if not)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1482647 13f79535-47bb-0310-9956-ffa450edef68
2013-05-15 00:27:59 +00:00
Nick Burch 000620ac52 Improve the number of steps when generating an ID of a new relationship, and add more tests, bug #53904
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1442148 13f79535-47bb-0310-9956-ffa450edef68
2013-02-04 15:06:46 +00:00
Yegor Kozlov 489a9b47f3 Bug #53282 - Avoid exception when parsing OPC relationships with non-breaking spaces
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1403195 13f79535-47bb-0310-9956-ffa450edef68
2012-10-29 08:42:54 +00:00
Yegor Kozlov d1fb05dedf Bug #53374 Avoid exceptions when parsing hyperlinks of type 'javascript://'
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1402470 13f79535-47bb-0310-9956-ffa450edef68
2012-10-26 11:38:28 +00:00
Yegor Kozlov 57bbac29fe Bugzilla 52211 - avoid unnessary re-coverting content types to US-ASCII, it can cause exceptions on ibm mainframes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1394001 13f79535-47bb-0310-9956-ffa450edef68
2012-10-04 11:52:20 +00:00
Yegor Kozlov c0e87067e6 Bugzilla 51780 - support replacement of content types in OPC packages
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1294998 13f79535-47bb-0310-9956-ffa450edef68
2012-02-29 07:50:10 +00:00
Nick Burch c2ef05e163 Fix bug #52540 - Relax the M4.1 constraint on reading OOXML files, as some Office produced ones do have 2 Core Properties, despite the specification explicitly forbidding this
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1237631 13f79535-47bb-0310-9956-ffa450edef68
2012-01-30 12:59:54 +00:00
Nick Burch 7b211912e2 Add a disabled test for bug #51850, and tweak the OPC package exceptions to make it easier to spot when a part name is already used
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1174045 13f79535-47bb-0310-9956-ffa450edef68
2011-09-22 10:26:33 +00:00
Yegor Kozlov dc100d1004 51187 - fixed OPCPackage to correctly handle self references
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1156529 13f79535-47bb-0310-9956-ffa450edef68
2011-08-11 08:13:00 +00:00
Yegor Kozlov 793d119eed Bug 51444 - Prevent corrupted output when saving files created by LibreOffice 3.3
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1141576 13f79535-47bb-0310-9956-ffa450edef68
2011-06-30 15:39:47 +00:00
Yegor Kozlov ffc5d68b12 Bug 51374 - Fixed incorrect setting of lastPrinted OOXML core property
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1135997 13f79535-47bb-0310-9956-ffa450edef68
2011-06-15 11:15:40 +00:00
Yegor Kozlov 7c8f56ce1c bug 51265: Enhanced Handling of Picture Parts in XWPF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1130120 13f79535-47bb-0310-9956-ffa450edef68
2011-06-01 12:07:16 +00:00
Yegor Kozlov 9b52b521cf allow white spaces and unicode in OPC relationship targets, see Bugzilla 50154
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1036215 13f79535-47bb-0310-9956-ffa450edef68
2010-11-17 20:40:35 +00:00
Yegor Kozlov 2a9019985f added ZipFileAssert, this file was in the original OpenXML4J package but wasn't included in POI-3.5
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@992551 13f79535-47bb-0310-9956-ffa450edef68
2010-09-04 06:33:22 +00:00
Yegor Kozlov c9a7354786 close OPC package before assertion, otherwise the test fails on Win7 (unix-based systems always pass)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@982911 13f79535-47bb-0310-9956-ffa450edef68
2010-08-06 09:03:32 +00:00
Nick Burch 3c4946472b Improve handling and warnings when closing OPCPackage objects
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@982311 13f79535-47bb-0310-9956-ffa450edef68
2010-08-04 15:58:51 +00:00