Author: dkuleshov
Date: 2011-08-12 09:45:06 -0400 (Fri, 12 Aug 2011)
New Revision: 4751
Modified:
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java
Log:
EXOJCR-1438: added checking for empty input stream
Modified:
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java
===================================================================
---
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java 2011-08-12
08:11:55 UTC (rev 4750)
+++
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java 2011-08-12
13:45:06 UTC (rev 4751)
@@ -141,6 +141,10 @@
public String getContentAsText(final InputStream is) throws IOException,
DocumentReadException
{
+ if (is.available() == 0)
+ {
+ return "";
+ }
try
{
return SecurityHelper.doPrivilegedExceptionAction(new
PrivilegedExceptionAction<String>()
@@ -204,6 +208,10 @@
public String getContentAsText(final InputStream is, final String encoding) throws
IOException,
DocumentReadException
{
+ if (is.available() == 0)
+ {
+ return "";
+ }
try
{
return SecurityHelper.doPrivilegedExceptionAction(new
PrivilegedExceptionAction<String>()
@@ -271,6 +279,10 @@
public Properties getProperties(final InputStream is) throws IOException,
DocumentReadException
{
+ if (is.available() == 0)
+ {
+ return new Properties();
+ }
try
{
return SecurityHelper.doPrivilegedExceptionAction(new
PrivilegedExceptionAction<Properties>()