Package org.exoplatform.services.document

Examples of org.exoplatform.services.document.DocumentReadException


         return contentHandler.getContent();
      }
      catch (ParserConfigurationException e)
      {
         throw new DocumentReadException(e.getMessage(), e);
      }
      catch (SAXException e)
      {
         throw new DocumentReadException(e.getMessage(), e);
      }
      finally
      {
         if (is != null)
            try
View Full Code Here


         return metaHandler.getProperties();

      }
      catch (ParserConfigurationException e)
      {
         throw new DocumentReadException(e.getMessage(), e);
      }
      catch (SAXException e)
      {
         throw new DocumentReadException(e.getMessage(), e);
      }
      finally
      {
         if (is != null)
            try
View Full Code Here

                     parser.parse(is, handler, metadata, context);
                     return handler.toString();
                  }
                  catch (SAXException e)
                  {
                     throw new DocumentReadException(e.getMessage(), e);
                  }
                  catch (TikaException e)
                  {
                     throw new DocumentReadException(e.getMessage(), e);
                  }
               }
               finally
               {
                  try
View Full Code Here

                     parser.parse(is, handler, metadata, context);
                     return handler.toString();
                  }
                  catch (SAXException e)
                  {
                     throw new DocumentReadException(e.getMessage(), e);
                  }
                  catch (TikaException e)
                  {
                     throw new DocumentReadException(e.getMessage(), e);
                  }
               }
               finally
               {
                  try
View Full Code Here

                  {
                     parser.parse(is, handler, metadata, context);
                  }
                  catch (SAXException e)
                  {
                     throw new DocumentReadException(e.getMessage(), e);
                  }
                  catch (TikaException e)
                  {
                     throw new DocumentReadException(e.getMessage(), e);
                  }

                  // construct Properties set
                  Properties props = new Properties();
                  convertProperty(metadata, props, DCMetaData.CONTRIBUTOR, new String[]{DublinCore.CONTRIBUTOR,
                     MSOffice.LAST_AUTHOR});
                  convertProperty(metadata, props, DCMetaData.COVERAGE, DublinCore.COVERAGE);
                  convertProperty(metadata, props, DCMetaData.CREATOR,
                     new String[]{MSOffice.AUTHOR, DublinCore.CREATOR});
                  // different parsers return date in different formats, so keep it as String
                  convertProperty(metadata, props, DCMetaData.DATE, new Property[]{DublinCore.DATE,
                     MSOffice.LAST_SAVED, MSOffice.CREATION_DATE});
                  convertProperty(metadata, props, DCMetaData.DESCRIPTION, new String[]{DublinCore.DESCRIPTION,
                     MSOffice.COMMENTS});
                  convertProperty(metadata, props, DCMetaData.FORMAT, DublinCore.FORMAT);
                  convertProperty(metadata, props, DCMetaData.IDENTIFIER, DublinCore.IDENTIFIER);
                  convertProperty(metadata, props, DCMetaData.LANGUAGE, DublinCore.LANGUAGE);
                  //convertProperty(metadata, props, DCMetaData.?, DublinCore.MODIFIED);
                  convertProperty(metadata, props, DCMetaData.PUBLISHER, DublinCore.PUBLISHER);
                  convertProperty(metadata, props, DCMetaData.RELATION, DublinCore.RELATION);
                  convertProperty(metadata, props, DCMetaData.RESOURCE, DublinCore.SOURCE);
                  convertProperty(metadata, props, DCMetaData.RIGHTS, DublinCore.RIGHTS);
                  convertProperty(metadata, props, DCMetaData.SUBJECT, new String[]{DublinCore.SUBJECT,
                     MSOffice.KEYWORDS});
                  convertProperty(metadata, props, DCMetaData.TITLE, DublinCore.TITLE);
                  convertProperty(metadata, props, DCMetaData.TYPE, DublinCore.TYPE);

                  return props;
               }
               finally
               {
                  try
                  {
                     is.close();
                  }
                  catch (IOException e)
                  {
                     if (LOG.isTraceEnabled())
                     {
                        LOG.trace("An exception occurred: " + e.getMessage());
                     }
                  }
               }
            }
         });
      }
      catch (PrivilegedActionException pae)
      {
         Throwable cause = pae.getCause();
         if (cause instanceof IOException)
         {
            throw (IOException)cause;
         }
         else
         {
            throw new DocumentReadException("Can not get properties: " + cause.getMessage(), cause);
         }
      }
   }
View Full Code Here

         catch (PrivilegedActionException pae)
         {
            Throwable cause = pae.getCause();
            if (cause instanceof IOException)
            {
               throw new DocumentReadException("Can't open presentation.", cause);
            }
            else if (cause instanceof OpenXML4JRuntimeException)
            {
               throw new DocumentReadException("Can't open presentation.", cause);
            }
            else if (cause instanceof OpenXML4JException)
            {
               throw new DocumentReadException("Can't open presentation.", cause);
            }
            else if (cause instanceof XmlException)
            {
               throw new DocumentReadException("Can't open presentation.", cause);
            }
            else if (cause instanceof RuntimeException)
            {
               throw (RuntimeException)cause;
            }
View Full Code Here

      catch (PrivilegedActionException pae)
      {
         Throwable cause = pae.getCause();
         if (cause instanceof InvalidFormatException)
         {
            throw new DocumentReadException("Can't read properties from OOXML document", cause);
         }
         else if (cause instanceof OpenXML4JException)
         {
            throw new DocumentReadException("Can't read properties from OOXML document", cause);
         }
         else if (cause instanceof XmlException)
         {
            throw new DocumentReadException("Can't read properties from OOXML document", cause);
         }
         else if (cause instanceof RuntimeException)
         {
            throw (RuntimeException)cause;
         }
View Full Code Here

               }
            });
         }
         catch (IOException e)
         {
            throw new DocumentReadException("Can't open message.", e);
         }
         catch (OpenXML4JRuntimeException e)
         {
            throw new DocumentReadException("Can't open message.", e);
         }

         final XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
         text = SecurityHelper.doPrivilegedAction(new PrivilegedAction<String>()
         {
View Full Code Here

               }
            }
            catch (NoPropertySetStreamException e)
            {
               throw new POIRuntimeException(new DocumentReadException(e.getMessage(), e));
            }
            catch (MarkUnsupportedException e)
            {
               throw new POIRuntimeException(new DocumentReadException(e.getMessage(), e));
            }
            catch (UnsupportedEncodingException e)
            {
               throw new POIRuntimeException(new DocumentReadException(e.getMessage(), e));
            }
            catch (IOException e)
            {
               throw new POIRuntimeException(e);
            }
View Full Code Here

            Date d = df.parse(coreProperties.getUnderlyingProperties().getCreatedPropertyString());
            props.put(DCMetaData.DATE, d);
         }
         catch (ParseException e)
         {
            throw new DocumentReadException("Incorrect creation date: " + e.getMessage(), e);
         }
      }
      if (coreProperties.getCreator() != null && coreProperties.getCreator().length() > 0)
      {
         props.put(DCMetaData.CREATOR, coreProperties.getCreator());
      }
      if (coreProperties.getSubject() != null && coreProperties.getSubject().length() > 0)
      {
         props.put(DCMetaData.SUBJECT, coreProperties.getSubject());
      }
      if (coreProperties.getModified() != null)
      {
         try
         {
            Date d = df.parse(coreProperties.getUnderlyingProperties().getModifiedPropertyString());
            props.put(DCMetaData.DATE, d);
         }
         catch (ParseException e)
         {
            throw new DocumentReadException("Incorrect modification date: " + e.getMessage(), e);
         }
      }
      if (coreProperties.getSubject() != null && coreProperties.getSubject().length() > 0)
      {
         props.put(DCMetaData.SUBJECT, coreProperties.getSubject());
View Full Code Here

TOP

Related Classes of org.exoplatform.services.document.DocumentReadException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.