Examples of XMPException


Examples of com.itextpdf.xmp.XMPException

      boolean outerCall) throws XMPException
  {
    if (!aliasNode.getValue().equals(baseNode.getValue())  ||
      aliasNode.getChildrenLength() != baseNode.getChildrenLength())
    {
      throw new XMPException("Mismatch between alias and base nodes", XMPError.BADXMP);
    }
   
    if (
        !outerCall  &&
        (!aliasNode.getName().equals(baseNode.getName())  ||
         !aliasNode.getOptions().equals(baseNode.getOptions())  ||
         aliasNode.getQualifierLength() != baseNode.getQualifierLength())
       )
      {
      throw new XMPException("Mismatch between alias and base nodes",
        XMPError.BADXMP);
    }
   
    for (Iterator an = aliasNode.iterateChildren(),
            bn = baseNode.iterateChildren();
View Full Code Here

Examples of com.itextpdf.xmp.XMPException

    {
      assertConsistency(options);
    }
    else
    {
      throw new XMPException("The option bit(s) 0x" + Integer.toHexString(invalidOptions)
          + " are invalid!", XMPError.BADOPTIONS);
    }
  }
View Full Code Here

Examples of com.itextpdf.xmp.XMPException

    {
      return "";
    }
    else if (!arrayNode.getOptions().isArray() || arrayNode.getOptions().isArrayAlternate())
    {
      throw new XMPException("Named property must be non-alternate array", XMPError.BADPARAM);
    }

    // Make sure the separator is OK.
    checkSeparator(separator);
    // Make sure the open and close quotes are a legitimate pair.
    char openQuote = quotes.charAt(0);
    char closeQuote = checkQuotes(quotes, openQuote);

    // Build the result, quoting the array items, adding separators.
    // Hurl if any item isn't simple.

    StringBuffer catinatedString = new StringBuffer();

    for (Iterator it = arrayNode.iterateChildren(); it.hasNext();)
    {
      currItem = (XMPNode) it.next();
      if (currItem.getOptions().isCompositeProperty())
      {
        throw new XMPException("Array items must be simple", XMPError.BADPARAM);
      }
      String str = applyQuotes(currItem.getValue(), openQuote, closeQuote, allowCommas);

      catinatedString.append(str);
      if (it.hasNext())
View Full Code Here

Examples of com.itextpdf.xmp.XMPException

  {
    ParameterAsserts.assertSchemaNS(schemaNS);
    ParameterAsserts.assertArrayName(arrayName);
    if (catedStr == null)
    {
      throw new XMPException("Parameter must not be null", XMPError.BADPARAM);
    }
    ParameterAsserts.assertImplementation(xmp);
    XMPMetaImpl xmpImpl = (XMPMetaImpl) xmp;

    // Keep a zero value, has special meaning below.
View Full Code Here

Examples of com.itextpdf.xmp.XMPException

      PropertyOptions arrayOptions, XMPMetaImpl xmp) throws XMPException
  {
    arrayOptions = XMPNodeUtils.verifySetOptions(arrayOptions, null);
    if (!arrayOptions.isOnlyArrayOptions())
    {
      throw new XMPException("Options can only provide array form", XMPError.BADOPTIONS);
    }

    // Find the array node, make sure it is OK. Move the current children
    // aside, to be readded later if kept.
    XMPPath arrayPath = XMPPathParser.expandXPath(schemaNS, arrayName);
    XMPNode arrayNode = XMPNodeUtils.findNode(xmp.getRoot(), arrayPath, false, null);
    if (arrayNode != null)
    {
      // The array exists, make sure the form is compatible. Zero
      // arrayForm means take what exists.
      PropertyOptions arrayForm = arrayNode.getOptions();
      if (!arrayForm.isArray() || arrayForm.isArrayAlternate())
      {
        throw new XMPException("Named property must be non-alternate array",
          XMPError.BADXPATH);
      }
      if (arrayOptions.equalArrayTypes(arrayForm))
      {
        throw new XMPException("Mismatch of specified and existing array form",
            XMPError.BADXPATH); // *** Right error?
      }
    }
    else
    {
      // The array does not exist, try to create it.
      // don't modify the options handed into the method
      arrayNode = XMPNodeUtils.findNode(xmp.getRoot(), arrayPath, true, arrayOptions
          .setArray(true));
      if (arrayNode == null)
      {
        throw new XMPException("Failed to create named array", XMPError.BADXPATH);
      }
    }
    return arrayNode;
  }
View Full Code Here

Examples of com.itextpdf.xmp.XMPException

      // the named schema might not actually exist. So don't lookup the
      // schema node.

      if (schemaNS == null || schemaNS.length() == 0)
      {
        throw new XMPException("Property name requires schema namespace",
          XMPError.BADPARAM);
      }

      XMPPath expPath = XMPPathParser.expandXPath(schemaNS, propName);
View Full Code Here

Examples of com.itextpdf.xmp.XMPException

      int charKind = classifyCharacter(separator.charAt(i));
      if (charKind == UCK_SEMICOLON)
      {
        if (haveSemicolon)
        {
          throw new XMPException("Separator can have only one semicolon",
            XMPError.BADPARAM);
        }
        haveSemicolon = true;
      }
      else if (charKind != UCK_SPACE)
      {
        throw new XMPException("Separator can have only spaces and one semicolon",
            XMPError.BADPARAM);
      }
    }
    if (!haveSemicolon)
    {
      throw new XMPException("Separator must have one semicolon", XMPError.BADPARAM);
    }
  }
View Full Code Here

Examples of com.itextpdf.xmp.XMPException

    char closeQuote;

    int charKind = classifyCharacter(openQuote);
    if (charKind != UCK_QUOTE)
    {
      throw new XMPException("Invalid quoting character", XMPError.BADPARAM);
    }

    if (quotes.length() == 1)
    {
      closeQuote = openQuote;
    }
    else
    {
      closeQuote = quotes.charAt(1);
      charKind = classifyCharacter(closeQuote);
      if (charKind != UCK_QUOTE)
      {
        throw new XMPException("Invalid quoting character", XMPError.BADPARAM);
      }
    }

    if (closeQuote != getClosingQuote(openQuote))
    {
      throw new XMPException("Mismatched quote pair", XMPError.BADPARAM);
    }
    return closeQuote;
  }
View Full Code Here

Examples of com.itextpdf.xmp.XMPException

   */
  public void assertConsistency(int options) throws XMPException
  {
    if ((options & STRUCT) > &&  (options & ARRAY) > 0)
    {
      throw new XMPException("IsStruct and IsArray options are mutually exclusive",
          XMPError.BADOPTIONS);
    }
    else if ((options & URI) > &&  (options & (ARRAY | STRUCT)) > 0)
    { 
      throw new XMPException("Structs and arrays can't have \"value\" options",
        XMPError.BADOPTIONS);
    }
  }
View Full Code Here

Examples of com.itextpdf.xmp.XMPException

    {
      arrayOptions = new PropertyOptions();
    }
    if (!arrayOptions.isOnlyArrayOptions())
    {
      throw new XMPException("Only array form flags allowed for arrayOptions",
          XMPError.BADOPTIONS);
    }

    // Check if array options are set correctly.
    arrayOptions = XMPNodeUtils.verifySetOptions(arrayOptions, null);


    // Locate or create the array. If it already exists, make sure the array
    // form from the options
    // parameter is compatible with the current state.
    XMPPath arrayPath = XMPPathParser.expandXPath(schemaNS, arrayName);


    // Just lookup, don't try to create.
    XMPNode arrayNode = XMPNodeUtils.findNode(tree, arrayPath, false, null);

    if (arrayNode != null)
    {
      // The array exists, make sure the form is compatible. Zero
      // arrayForm means take what exists.
      if (!arrayNode.getOptions().isArray())
      {
        throw new XMPException("The named property is not an array", XMPError.BADXPATH);
      }
      // if (arrayOptions != null && !arrayOptions.equalArrayTypes(arrayNode.getOptions()))
      // {
      // throw new XMPException("Mismatch of existing and specified array form", BADOPTIONS);
      // }
    }
    else
    {
      // The array does not exist, try to create it.
      if (arrayOptions.isArray())
      {
        arrayNode = XMPNodeUtils.findNode(tree, arrayPath, true, arrayOptions);
        if (arrayNode == null)
        {
          throw new XMPException("Failure creating array node", XMPError.BADXPATH);
        }
      }
      else
      {
        // array options missing
        throw new XMPException("Explicit arrayOptions required to create new array",
            XMPError.BADOPTIONS);
      }
    }

    doSetArrayItem(arrayNode, ARRAY_LAST_ITEM, itemValue, itemOptions, true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.