ASF Bugzilla – Attachment 26030 Details for
Bug 49936
[Patch] java.lang.StringIndexOutOfBoundsException in org.apache.poi.hwpf.usermodel.HeaderStories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
patch
diff.txt (text/plain), 1.62 KB, created by
ssmeets
on 2010-09-15 20:14:21 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
ssmeets
Created:
2010-09-15 20:14:21 UTC
Size:
1.62 KB
patch
obsolete
>Index: src/scratchpad/src/org/apache/poi/hwpf/usermodel/HeaderStories.java >=================================================================== >--- src/scratchpad/src/org/apache/poi/hwpf/usermodel/HeaderStories.java (revision 997546) >+++ src/scratchpad/src/org/apache/poi/hwpf/usermodel/HeaderStories.java (working copy) >@@ -153,27 +153,32 @@ > if(plcfHdd == null) return null; > > GenericPropertyNode prop = plcfHdd.getProperty(plcfHddIndex); >- if(prop.getStart() == prop.getEnd()) { >+ if(prop.getStart() >= prop.getEnd()) { > // Empty story > return ""; > } > > // Grab the contents >- String text = >- headerStories.text().substring(prop.getStart(), prop.getEnd()); >+ if(!(headerStories.text().length() <= prop.getEnd())){ >+ String text = >+ headerStories.text().substring(prop.getStart(), prop.getEnd()); > >- // Strip off fields and macros if requested >- if(stripFields) { >- return Range.stripFields(text); >- } >- // If you create a header/footer, then remove it again, word >- // will leave \r\r. Turn these back into an empty string, >- // which is more what you'd expect >- if(text.equals("\r\r")) { >- return ""; >- } >+ // Strip off fields and macros if requested >+ if(stripFields) { >+ return Range.stripFields(text); >+ } >+ // If you create a header/footer, then remove it again, word >+ // will leave \r\r. Turn these back into an empty string, >+ // which is more what you'd expect >+ if(text.equals("\r\r")) { >+ return ""; >+ } > >- return text; >+ return text; >+ } else { >+ >+ return ""; >+ } > } > > public Range getRange() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 49936
: 26030 |
26033
|
26034