Package org.docx4j.openpackaging.exceptions

Examples of org.docx4j.openpackaging.exceptions.Docx4JException


      Document xmlDoc = null;
    if ((flags & FLAG_BIND_INSERT_XML) == FLAG_BIND_INSERT_XML) {
        try {
                xmlDoc = XmlUtils.getNewDocumentBuilder().parse(xmlDocument);
        } catch (Exception e) {
          throw new Docx4JException("Problems creating a org.w3c.dom.Document for the passed input stream.", e);
        }
    }
        bind(wmlPackage, xmlDoc, flags);
       
    new EventFinished(bindJobStartEvent).publish();
View Full Code Here


    }
   
    customXmlDataStoragePart
      = CustomXmlDataStoragePartSelector.getCustomXmlDataStoragePart(wmlPackage);
    if (customXmlDataStoragePart==null) {
      throw new Docx4JException("Couldn't find CustomXmlDataStoragePart! exiting..");
    }
 
    if ((flags & FLAG_BIND_INSERT_XML) == FLAG_BIND_INSERT_XML) {
     
      StartEvent startEvent = new StartEvent( WellKnownJobTypes.BIND, wmlPackage, WellKnownProcessSteps.BIND_INSERT_XML );
View Full Code Here

        result = xPath.evaluate(xpathString, doc );
      }
      log.debug(xpathString + " ---> " + result);
      return result;
    } catch (Exception e) {
      throw new Docx4JException("Problems evaluating xpath '" + xpathString + "'", e);
    }
  }
View Full Code Here

        if (r.getTargetMode() !=null && r.getTargetMode().equals("External") ) {
          if (otherR.getTargetMode() !=null && otherR.getTargetMode().equals("External")) {
            // Usual case
            if (!r.getTarget().equals(otherR.getTarget()) ) {
              // Should never happen, since we matched on target
              throw new Docx4JException("broken logic!");
              //results.add(r);
              //log.debug("External: " + r.getTarget() );             
            }
           
          } else {
View Full Code Here

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
        thisPackage.getContentTypeManager().marshal(baos);
      } catch (JAXBException e) {
        // Shouldn't happen
        throw new Docx4JException("Can't marshall content type", e);
      }
    }
   
    // Second, handle parts
    RelationshipsPart packageRels = thisPackage.getRelationshipsPart();
View Full Code Here

        } else {
          log.info("Lazily unmarshalling " + name);
          unmarshal( is );
        }
      } catch (JAXBException e) {
        throw new Docx4JException(e.getMessage(), e);
//      } catch (Docx4JException e) {
//        log.error(e.getMessage(), e);
      } finally {
        IOUtils.closeQuietly(is);
      }     
View Full Code Here

      String name = this.getPartName().getName();
      InputStream is = partStore.loadPart(
          name.substring(1));
      if (is==null) {
        log.warn(name + " missing from part store");
        throw new Docx4JException(name + " missing from part store");
      } else {
        log.info("Lazily unmarshalling " + name);
//        wmlTemplateString = convertStreamToString(is);
       
        // This seems to be about 5% faster than the Scanner approach
        try {
          wmlTemplateString = IOUtils.toString(is, "UTF-8");
        } catch (IOException e) {
          throw new Docx4JException(e.getMessage(), e);
        }
      }
     
    } else {
     
View Full Code Here

      ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
      try {
          marshal(baos);
      ((JaxbXmlPart)other).marshal(baos2);
    } catch (JAXBException e) {
      throw new Docx4JException("Error marshalling parts", e);
    }
     
      return java.util.Arrays.equals(baos.toByteArray(), baos2.toByteArray());

    }
View Full Code Here

            Node root = jcrSession.getRootNode();
            Node docxNode = root.getNode(nodePath);
            return get(jcrSession, docxNode);
      } catch (Exception e) {
      e.printStackTrace() ;
      throw new Docx4JException("Failed to get package");
      }
  }
View Full Code Here

      
      registerCustomXmlDataStorageParts(p);
      
      } catch (Exception e) {
      e.printStackTrace() ;
      throw new Docx4JException("Failed to get package", e);     
      }
     
   return p;
   
  }
View Full Code Here

TOP

Related Classes of org.docx4j.openpackaging.exceptions.Docx4JException

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.