add safe path for documents with missing list information

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1389056 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2012-09-23 13:34:46 +00:00
parent 3f5640f8f2
commit 92f0d10462

View File

@ -167,11 +167,12 @@ public abstract class AbstractWordConverter
} }
structures.add( structure ); structures.add( structure );
} }
private final Set<Bookmark> bookmarkStack = new LinkedHashSet<Bookmark>(); private final Set<Bookmark> bookmarkStack = new LinkedHashSet<Bookmark>();
private FontReplacer fontReplacer = new DefaultFontReplacer(); private FontReplacer fontReplacer = new DefaultFontReplacer();
private POILogger log = POILogFactory.getLogger( getClass() );
private NumberingState numberingState = new NumberingState(); private NumberingState numberingState = new NumberingState();
private PicturesManager picturesManager; private PicturesManager picturesManager;
@ -1053,17 +1054,31 @@ public abstract class AbstractWordConverter
processPageBreak( wordDocument, flow ); processPageBreak( wordDocument, flow );
} }
boolean processed = false;
if ( paragraph.isInList() ) if ( paragraph.isInList() )
{ {
HWPFList hwpfList = paragraph.getList(); try
{
HWPFList hwpfList = paragraph.getList();
String label = AbstractWordUtils.getBulletText( numberingState, String label = AbstractWordUtils.getBulletText(
hwpfList, (char) paragraph.getIlvl() ); numberingState, hwpfList,
(char) paragraph.getIlvl() );
processParagraph( wordDocument, flow, currentTableLevel, processParagraph( wordDocument, flow, currentTableLevel,
paragraph, label ); paragraph, label );
processed = true;
}
catch ( Exception exc )
{
log.log(
POILogger.WARN,
"Can't process paragraph as list entry, will be processed without list information",
exc );
}
} }
else
if ( processed == false )
{ {
processParagraph( wordDocument, flow, currentTableLevel, processParagraph( wordDocument, flow, currentTableLevel,
paragraph, AbstractWordUtils.EMPTY ); paragraph, AbstractWordUtils.EMPTY );