Author: areshetnyak
Date: 2010-02-17 03:22:00 -0500 (Wed, 17 Feb 2010)
New Revision: 1844
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
Log:
EXOJCR-422 : Add catching PDFDocumentReadException in NodeIndexer.addValues
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-02-17
08:20:41 UTC (rev 1843)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-02-17
08:22:00 UTC (rev 1844)
@@ -20,6 +20,7 @@
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Fieldable;
import org.exoplatform.services.document.DocumentReader;
+import org.exoplatform.services.document.PDFDocumentReadException;
import org.exoplatform.services.document.DocumentReaderService;
import org.exoplatform.services.document.HandlerNotFoundException;
import org.exoplatform.services.jcr.core.ExtendedPropertyType;
@@ -303,9 +304,12 @@
// ok, have a reader
// if the prop obtainer from cache it will contains a values,
// otherwise read prop with values from DM
- data =
- prop.getValues().size() > 0 ? prop.getValues() :
((PropertyData)stateProvider.getItemData(node,
- new QPathEntry(Constants.JCR_DATA, 0))).getValues();
+
+ PropertyData propData = prop.getValues().size() > 0 ? prop :
((PropertyData)stateProvider.getItemData(node,
+ new QPathEntry(Constants.JCR_DATA, 0)));
+
+ data = propData.getValues();
+
if (data == null)
log.warn("null value found at property " +
prop.getQPath().getAsString());
@@ -322,10 +326,15 @@
InputStream is = null;
try
{
-
is = pvd.getAsStream();
- Reader reader = new StringReader(dreader.getContentAsText(is,
encoding));
- doc.add(createFulltextField(reader));
+ try {
+ Reader reader = new
StringReader(dreader.getContentAsText(is, encoding));
+ doc.add(createFulltextField(reader));
+ }
+ catch (PDFDocumentReadException e)
+ {
+ log.error("Can not indexing the PDF document by path
" + propData.getQPath().getAsString(), e);
+ }
}
finally
@@ -349,8 +358,14 @@
try
{
is = pvd.getAsStream();
- Reader reader = new
StringReader(dreader.getContentAsText(is));
- doc.add(createFulltextField(reader));
+ try {
+ Reader reader = new
StringReader(dreader.getContentAsText(is));
+ doc.add(createFulltextField(reader));
+ }
+ catch (PDFDocumentReadException e)
+ {
+ log.error("Can not indexing the PDF document by path
" + propData.getQPath().getAsString(), e);
+ }
}
finally
{
Show replies by date