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 2009/01/27 11:07:46 UTC
DO NOT REPLY [Bug 46610] New: java.lang.IllegalArgumentException:
The end (272) must not be before the start (300)
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
Summary: java.lang.IllegalArgumentException: The end (272) must
not be before the start (300)
Product: POI
Version: 3.5-dev
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: HWPF
AssignedTo: dev@poi.apache.org
ReportedBy: benjamin.engele@polarion.com
Problem is caused by unicode in the word document.
Documents that reproduce the problem are attached.
Code to reproduce:
HWPFDocument doc = new HWPFDocument(new FileInputStream(args[0]));
Range globalRange = doc.getRange();
for (int i = 0; i < globalRange.numParagraphs(); i++) {
Paragraph p = globalRange.getParagraph(i);
System.out.println(p.text());
for (int j = 0; j < p.numCharacterRuns(); j++) {
CharacterRun characterRun = p.getCharacterRun(j);
characterRun.text();
}
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #11 from Benjamin Engele <be...@polarion.com> 2009-06-18 08:09:50 PST ---
Actually I didn't look at the test cases so I am no big help finding out why
they fail... Happy to see that you managed to solve most test failures.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
Benjamin Engele <be...@polarion.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #23181|0 |1
is obsolete| |
--- Comment #7 from Benjamin Engele <be...@polarion.com> 2009-01-27 13:26:44 PST ---
Created an attachment (id=23184)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23184)
Patch that fixes all problems with paragraph positions I had
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #14 from Maxim Valyanskiy <ma...@gmail.com> 2009-06-19 04:59:37 PST ---
Created an attachment (id=23834)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23834)
MSWord file that shows broken paragraph problem
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
Benjamin Engele <be...@polarion.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|java.lang.IllegalArgumentExc|[PATCH] Problems accessing
|eption: The end (272) must |documents containing unicode
|not be before the start |
|(300) |
--- Comment #6 from Benjamin Engele <be...@polarion.com> 2009-01-27 13:13:54 PST ---
Patch for Exception triggered by utf2.doc doesn't resolve all problems with
utf2.doc: The last paragraph is misplaced. This is happens because of another
error in translating byte positions from FormatedDiskPage to char positions in
the TextPiece.
Some more notes:
Writing wasn't tested and not changed. It is probably now more broken then it
was before. BytePropertyNode.getStartBytes() and getEndBytes() definitely needs
to be fixed, they still uses the wrong approach to calculate the byte index
from the char index.
IMHO BytePropertyNode.isUnicode() should be removed as soon as
get[Start/End]Bytes() has been fixed. Don't think the information that the tart
of the node is in a unicode text piece is useful.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
Maxim Valyanskiy <ma...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #23184|0 |1
is obsolete| |
--- Comment #10 from Maxim Valyanskiy <ma...@gmail.com> 2009-06-18 07:32:41 PST ---
Created an attachment (id=23829)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23829)
Unicode patch
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
Maxim Valyanskiy <ma...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #23829|0 |1
is obsolete| |
--- Comment #13 from Maxim Valyanskiy <ma...@gmail.com> 2009-06-19 04:58:24 PST ---
Created an attachment (id=23833)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23833)
Unicode patch v.2
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] java.lang.IllegalArgumentException: The end
(272) must not be before the start (300)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #1 from Benjamin Engele <be...@polarion.com> 2009-01-27 02:10:53 PST ---
Created an attachment (id=23178)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23178)
A word file that triggers the exception.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #17 from Maxim Valyanskiy <ma...@gmail.com> 2009-06-19 05:56:48 PST ---
Yes, it is ready. This patch does not break existing unit tests and fixes few
problems in text extraction. I do not have real world application to test
writing.
Please add attached unit test and put test files into
src/scratchpad/testcases/org/apache/poi/hwpf/data/
utf.doc as Bug46610_1.doc
utf2.doc as Bug46610_2.doc
perl_o_fytbole_.doc as Bug46610_3.doc
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] java.lang.IllegalArgumentException: The end
(272) must not be before the start (300)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #5 from Benjamin Engele <be...@polarion.com> 2009-01-27 05:59:19 PST ---
The root problem of this defect also causes other problems like paragraphs and
character runs at wrong positions.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #15 from Yegor Kozlov <ye...@dinom.ru> 2009-06-19 05:44:59 PST ---
Thanks for researching it. Is the patch ready to be committed?
Yegor
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
Maxim Valyanskiy <ma...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |max.valjanski@gmail.com
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
Yegor Kozlov <ye...@dinom.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #18 from Yegor Kozlov <ye...@dinom.ru> 2009-06-19 06:51:06 PST ---
Benjamin and Maxim,
Thanks for researching this issue and providing the fix. The patch was applied
in r786505 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=786505 )
Yegor
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] java.lang.IllegalArgumentException: The end
(272) must not be before the start (300)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
Benjamin Engele <be...@polarion.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #23179|0 |1
is obsolete| |
--- Comment #4 from Benjamin Engele <be...@polarion.com> 2009-01-27 05:57:11 PST ---
Created an attachment (id=23181)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23181)
Patch for Exception triggered by utf2.doc
Logic that calculates char index from byte index in BytePropertyNode rewritten.
Old approach to check if start index is in a unicode text piece and divide
indexes by 2 in that case is wrong.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] java.lang.IllegalArgumentException: The end
(272) must not be before the start (300)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #2 from Benjamin Engele <be...@polarion.com> 2009-01-27 02:32:18 PST ---
Created an attachment (id=23179)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23179)
Patch for Exception triggered by utf.doc
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] java.lang.IllegalArgumentException: The end
(272) must not be before the start (300)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #3 from Benjamin Engele <be...@polarion.com> 2009-01-27 02:34:45 PST ---
Created an attachment (id=23180)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23180)
Triggers a different cause of the Exception
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #12 from Maxim Valyanskiy <ma...@gmail.com> 2009-06-19 04:57:16 PST ---
New version:
Bugfixed CPtoFC and remove FCtoCP methods of SectionTable. Now we pass all
unit-tests successful
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #16 from Maxim Valyanskiy <ma...@gmail.com> 2009-06-19 05:53:30 PST ---
Created an attachment (id=23835)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23835)
unit test case
src/scratchpad/testcases/org/apache/poi/hwpf/TestBug46610.java
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #8 from Maxim Valyanskiy <ma...@gmail.com> 2009-06-16 05:32:40 PST ---
This patch greatly improves text extraction for Cyrillic documents on 3.5beta5.
Unfortunately it breaks few test cases (TestRangeDelete, TestRangeInsertion,
TestRangeProperties and TestSectionTable).
Also patch fails to apply on 3.5beta6 and current trunk.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46610] [PATCH] Problems accessing documents
containing unicode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46610
--- Comment #9 from Maxim Valyanskiy <ma...@gmail.com> 2009-06-18 07:30:35 PST ---
I modifed Benjamin Engele patch:
1) Patch ported to current svn trunk (trivial)
2) Corrected getStartBytes()/getEndBytes() methods in BytePropertyNode. This
fixes TestRangeDelete, TestRangeInsertion and TestSectionTable tests.
One test is still broken - TestRangeProperties
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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