LuceneSearchProvider dies with corrupted files
----------------------------------------------

                 Key: JSPWIKI-411
                 URL: https://issues.apache.org/jira/browse/JSPWIKI-411
             Project: JSPWiki
          Issue Type: Bug
          Components: Plugins
    Affects Versions: 2.6.4
         Environment: LuceneSearchProvider and ReadableAttachmentProvider (
            Reporter: Kurt Stein


If someone uploads a corrupted files(i.e. 0-Byte or non readable pdf-content) 
the lucene index crashes. Even with a new full reindex the lucene indexer 
chrashes every time he touches the corrupted file.



I have analyzed the code. In the method doFullLuceneReindex() there is a Try- 
Catch block that catches the exception coming form the call  
getAttachmentContent(att.getName(), WikiProvider.LATEST_VERSION ).
But thus the indexer stops at this points and no other attachment will be added 
to the lucene index.

                    for( Iterator iterator = allAttachments.iterator(); 
iterator.hasNext(); )
                    {
                        Attachment att = (Attachment) iterator.next();
                        String text = getAttachmentContent( att.getName(),
                                                            
WikiProvider.LATEST_VERSION );
                        luceneIndexPage( att, text, writer );
                    }

I would fixed it like this

                    for( Iterator iterator = allAttachments.iterator(); 
iterator.hasNext(); )
                    {
                        Attachment att = (Attachment) iterator.next();
                        try
                        {
                            String text = getAttachmentContent( att.getName(), 
WikiProvider.LATEST_VERSION );
                            luceneIndexPage( att, text, writer );
                        }
                        catch (Throwable t)
                        {
                            //goto next Attachment iterator
                            log.error("Error on indexing file " + 
att.getFileName(), t);
                        }
                    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to