congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
InvalidFormatException
Code IndexAdd Tabnine to your IDE (free)

How to use
InvalidFormatException
in
org.docx4j.openpackaging.exceptions

Best Java code snippets using org.docx4j.openpackaging.exceptions.InvalidFormatException (Showing top 20 results out of 315)

origin: plutext/docx4j

public CustomXmlDataStorage factory() {
  try {
    return new CustomXmlDataStorageImpl();
  } catch (InvalidFormatException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    return null;
  }
}
 
origin: plutext/docx4j

/**
 * Throws an exception if the specified URI is absolute.
 * 
 * @param partUri
 *            The URI to check.
 * @throws InvalidFormatException
 *             Throws if the specified URI is absolute.
 */
private static void throwExceptionIfAbsoluteUri(URI partUri)
    throws InvalidFormatException {
  if (partUri.isAbsolute()) {
    log.error( "" );
    throw new InvalidFormatException("Absolute URI forbidden: "
        + partUri);
  }
}
origin: plutext/docx4j

/**
 * Attach a template to this document.
 * This is just an easy way to access the same method in DocumentSettingsPart 
 * 
 * @param templatePath
 * @since 6.1.0
 */
public void attachTemplate(String templatePath) {
  
  DocumentSettingsPart dsp = null;
  try {
    dsp = this.getDocumentSettingsPart(true);
  } catch (InvalidFormatException e) {
    // shouldn't happen
    log.error(e.getMessage(), e);
  }
  dsp.attachTemplate(templatePath);
}
 
origin: plutext/docx4j

/**
 * @return the customXmlDataStorageClass
 */
static public CustomXmlDataStorage getCustomXmlDataStorageClass() {
  try {
    if (customXmlDataStorageClass==null) {
      customXmlDataStorageClass = new CustomXmlDataStorageImpl();
    }            
    return customXmlDataStorageClass;
  } catch (InvalidFormatException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    return null;
  }
}
 
origin: plutext/docx4j

/**
 * Throws an exception if the specified URI is empty. [M1.1]
 * 
 * @param partURI
 *            Part URI to check.
 * @throws InvalidFormatException
 *             If the specified URI is empty.
 */
private static void throwExceptionIfEmptyURI(URI partURI)
    throws InvalidFormatException {
  if (partURI == null) {
    throw new IllegalArgumentException("partURI");
  }
  
  String uriPath = partURI.getPath();
  if (uriPath.length() == 0
      || ((uriPath.length() == 1) && (uriPath.charAt(0) == URIHelper.FORWARD_SLASH_CHAR))) {
    throw new InvalidFormatException(
        "A part name shall not be empty [M1.1]: "
            + partURI.getPath());
    
  }
}
origin: plutext/docx4j

public void addDocPropsCorePart() {
  if (docPropsCorePart==null) {
    try {
      docPropsCorePart = new org.docx4j.openpackaging.parts.DocPropsCorePart();
      this.addTargetPart(docPropsCorePart);
      
      docPropsCorePart.setJaxbElement(new CoreProperties());
    } catch (InvalidFormatException e) {
      //Won't happen, so don't throw
      log.error(e.getMessage(), e);
    }            
  }
}
 
origin: plutext/docx4j

} catch (InvalidFormatException e) {
  e.printStackTrace();
origin: plutext/docx4j

/**
 * Throws an exception if the specified part name doesn't start with a
 * forward slash character '/'. [M1.4]
 * 
 * @param partUri
 *            The part name to check.
 * @throws InvalidFormatException
 *             If the specified part name doesn't start with a forward slash
 *             character '/'.
 */
private static void throwExceptionIfPartNameNotStartsWithForwardSlashChar(
    URI partUri) throws InvalidFormatException {
  String uriPath = partUri.getPath();
  if (uriPath.length() > 0
      && uriPath.charAt(0) != URIHelper.FORWARD_SLASH_CHAR)
  {
    log.error( "" );
    throw new InvalidFormatException(
        "A part name shall start with a forward slash ('/') character [M1.4]: "
            + partUri.getPath());
  }
}
origin: plutext/docx4j

public void addDocPropsCustomPart() {
  
  if (docPropsCustomPart==null) {
    try {
      docPropsCustomPart = new org.docx4j.openpackaging.parts.DocPropsCustomPart();
      docPropsCustomPart.setJaxbElement(new Properties());
      this.addTargetPart(docPropsCustomPart);
      
    } catch (InvalidFormatException e) {
      //Won't happen, so don't throw
      log.error(e.getMessage(), e);
    }            
  }
}
origin: plutext/docx4j

} catch (InvalidFormatException e1) {
  e1.printStackTrace();
origin: plutext/docx4j

/**
 * Throws an exception if the specified part name ends with a forward slash
 * character '/'. [M1.5]
 * 
 * @param partUri
 *            The part name to check.
 * @throws InvalidFormatException
 *             If the specified part name ends with a forwar slash character
 *             '/'.
 */
private static void throwExceptionIfPartNameEndsWithForwardSlashChar(
    URI partUri) throws InvalidFormatException {
  String uriPath = partUri.getPath();
  if (uriPath.length() > 0
      && uriPath.charAt(uriPath.length() - 1) == URIHelper.FORWARD_SLASH_CHAR) {
    log.error( "" );
    throw new InvalidFormatException(
        "A part name shall not have a forward slash as the last character [M1.5]: "
            + partUri.getPath());
  }
}
origin: plutext/docx4j

public void addDocPropsExtendedPart() {
  if (docPropsExtendedPart==null) {
    try {
      docPropsExtendedPart = new org.docx4j.openpackaging.parts.DocPropsExtendedPart();
      this.addTargetPart(docPropsExtendedPart);
      
      docPropsExtendedPart.setJaxbElement(new org.docx4j.docProps.extended.Properties());
    } catch (InvalidFormatException e) {
      //Won't happen, so don't throw
      log.error(e.getMessage(), e);
    }            
  }
}
 
origin: plutext/docx4j

} catch (InvalidFormatException e) {
  e.printStackTrace();
origin: plutext/docx4j

/**
 * Create an OPC compliant part name by throwing an exception if the
 * specified name is not valid.
 * 
 * @param partName
 *            The part name to validate.
 * @return The correspondant part name if valid, else <code>null</code>.
 * @throws InvalidFormatException
 *             Throws if the specified part name is not OPC compliant.
 * @see #createPartName(URI)
 */
public static PartName createPartName(String partName)
    throws InvalidFormatException {
  URI partNameURI;
  try {
    partNameURI = new URI(partName);
  } catch (URISyntaxException e) {
    throw new InvalidFormatException(e.getMessage());
  }
  return createPartName(partNameURI);
}
origin: plutext/docx4j

/**
 * Inserts the slide at the specified position in the presentation. 
 * Shifts the element currently at that position (if any) and any subsequent elements to the 
 * right (adds one to their indices).
 * 
 * @param index
 * @param slidePart
 * @throws Pptx4jException
 * @since 3.0
 */
public void addSlide(int index, SlidePart slidePart) throws Pptx4jException {
  List<SldId> sldIds = this.getJaxbElement().getSldIdLst().getSldId();
  
  int zeroBasedCount = sldIds.size(); 
  if (index< 0 || index>zeroBasedCount) {
    throw new Pptx4jException("Can't add slide at index " + index + ".  (There are " + sldIds.size() + " slides) ");			
  }
  
  try {
    Relationship rel = this.addTargetPart(slidePart, AddPartBehaviour.RENAME_IF_NAME_EXISTS);
    sldIds.add(index, createSlideIdListEntry(rel));
  } catch (InvalidFormatException e) {
    throw new Pptx4jException(e.getMessage(), e);
  }
}

origin: vsch/flexmark-java

      out.addTargetPart(documentPart);
    } catch (InvalidFormatException e) {
      e.printStackTrace();
  e.printStackTrace();
} catch (Exception e) {
origin: plutext/docx4j

  throw new InvalidFormatException("The segment " + segment
      + " contain invalid encoded character !");
  throw new InvalidFormatException(
      "A segment shall not contain percent-encoded forward slash ('/'), or backward slash ('\') characters. [M1.7]");
  throw new InvalidFormatException(
      "A segment shall not contain percent-encoded unreserved characters. [M1.8]");
throw new InvalidFormatException(
    "A segment shall not hold any characters other than pchar characters. [M1.6]");
origin: plutext/docx4j

public static RelationshipsPart createRelationshipsPartForPart(
    Base sourcePart) {
  if (sourcePart.relationships != null)
    return sourcePart.relationships;
  RelationshipsPart rp = null;
  try {
    rp = new RelationshipsPart(sourcePart);
  } catch (InvalidFormatException e) {
    // shouldn't happen
    log.error(e.getMessage(), e);
  }
  rp.setPackage(sourcePart.getPackage());
  // Make sure content manager knows how to handle .rels
  sourcePart
      .getPackage()
      .getContentTypeManager()
      .addDefaultContentType(
          "rels",
          org.docx4j.openpackaging.contenttype.ContentTypes.RELATIONSHIPS_PART);
  return rp;
}    
 
origin: org.docx4j/docx4j

public CustomXmlDataStorage factory() {
  try {
    return new CustomXmlDataStorageImpl();
  } catch (InvalidFormatException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    return null;
  }
}
 
origin: plutext/docx4j

if (segments.length <= 1 || !segments[0].equals("")) {
  log.error( "" );
  throw new InvalidFormatException(
      "A part name shall not have empty segments [M1.3]: "
          + partUri.getPath());
  if (seg == null || "".equals(seg)) {
    log.error( "" );
    throw new InvalidFormatException(
        "A part name shall not have empty segments [M1.3]: "
            + partUri.getPath());
    throw new InvalidFormatException(
        "A segment shall not end with a dot ('.') character [M1.9]: "
            + partUri.getPath());
    throw new InvalidFormatException(
        "A segment shall include at least one non-dot character. [M1.10]: "
            + partUri.getPath());
org.docx4j.openpackaging.exceptionsInvalidFormatException

Most used methods

  • printStackTrace
  • <init>
  • getMessage

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Menu (java.awt)
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now