Package com.google.gdata.util

Examples of com.google.gdata.util.ParseException


      @Override
      public void processEndElement() throws ParseException {

        if (email != null) {
          throw new ParseException(
              CoreErrorDomain.ERR.duplicateEmail);
        }

        if (value == null) {
          throw new ParseException(
              CoreErrorDomain.ERR.emailValueRequired);
        }

        email = value;
      }
View Full Code Here


      @Override
      public void processEndElement() throws ParseException {

        if (feedState.totalResults != Query.UNDEFINED) {
          throw new ParseException(
              CoreErrorDomain.ERR.duplicateTotalResults);
        }

        if (value == null) {
          throw new ParseException(
              CoreErrorDomain.ERR.logoValueRequired);
        }

        try {
          feedState.totalResults = Integer.valueOf(value).intValue();
        } catch (NumberFormatException e) {
          throw new ParseException(
              CoreErrorDomain.ERR.totalResultsNotInteger);
        }
      }
View Full Code Here

      @Override
      public void processEndElement() throws ParseException {

        if (feedState.startIndex != Query.UNDEFINED) {
          throw new ParseException(
              CoreErrorDomain.ERR.duplicateStartIndex);
        }

        if (value == null) {
          throw new ParseException(
              CoreErrorDomain.ERR.logoValueRequired);
        }

        try {
          feedState.startIndex = Integer.valueOf(value).intValue();
        } catch (NumberFormatException e) {
          throw new ParseException(
              CoreErrorDomain.ERR.startIndexNotInteger);
        }
      }
View Full Code Here

      @Override
      public void processEndElement() throws ParseException {

        if (feedState.itemsPerPage != Query.UNDEFINED) {
          throw new ParseException(
              CoreErrorDomain.ERR.duplicateItemsPerPage);
        }

        if (value == null) {
          throw new ParseException(
              CoreErrorDomain.ERR.logoValueRequired);
        }

        try {
          feedState.itemsPerPage = Integer.valueOf(value).intValue();
        } catch (NumberFormatException e) {
          throw new ParseException(
              CoreErrorDomain.ERR.itemsPerPageNotInteger);
        }
      }
View Full Code Here

    if (extension == null) {
      // Create an extension instance.
      try {
        extension = extClass.newInstance();
      } catch (InstantiationException e) {
        throw new ParseException(
            CoreErrorDomain.ERR.cantCreateExtension, e);
      } catch (IllegalAccessException e) {
        throw new ParseException(
            CoreErrorDomain.ERR.cantCreateExtension, e);
      }
    } else {
      needsAdd = false;
    }

    // Retrieve the handler.
    ElementHandler handler =
        extension.getHandler(extProfile, namespaceUri, localName, attrs);

    // Store the new extension instance.
    if (needsAdd) {

      if (extDescription.isRepeatable()) {
        addRepeatingExtension(extension, extClass);
      } else {
        boolean added = addExtension(extension, extClass);
        if (!added) {
          ParseException pe = new ParseException(
              CoreErrorDomain.ERR.duplicateExtension);
          pe.setInternalReason("Duplicate extension element " +
              namespaceUri + ":" + localName);
          throw pe;
        }
      }
    }
View Full Code Here

        boolean found =
            (extDescription.isRepeatable() ? repeatingExtensionMap
                .containsKey(extClass) : nonRepeatingExtensionMap
                .containsKey(extClass));
        if (!found) {
          ParseException pe = new ParseException(
              CoreErrorDomain.ERR.missingExtensionElement);
          pe.setInternalReason("Required extension element " +
              extDescription.getNamespace().getUri() + ":" +
              extDescription.getLocalName() + " not found.");
          throw pe;
        }
      }
View Full Code Here

        throws ParseException {
      super(configProfile, ExtensionDescription.class);

      String nsValue = attrs.getValue("", "namespace");
      if (nsValue == null) {
        throw new ParseException(
            CoreErrorDomain.ERR.missingNamespace);
      }

      // Find the namespace in the list of declared NamespaceDescriptions.
      // The attribute value can match either the alias or the uri
      for (XmlNamespace declaredNs : namespaces) {
        if (declaredNs.getAlias().equals(nsValue) ||
            declaredNs.getUri().equals(nsValue)) {
          namespace = declaredNs;
          break;
        }
      }
      if (namespace == null) {
        ParseException pe = new ParseException(
            CoreErrorDomain.ERR.missingNamespaceDescription);
        pe.setInternalReason("No matching NamespaceDescription for " +
            nsValue);
        throw pe;
      }

      localName = attrs.getValue("", "localName");
      if (localName == null) {
        throw new ParseException(
            CoreErrorDomain.ERR.missingLocalName);
      }

      String extensionClassName = attrs.getValue("", "extensionClass");
      if (extensionClassName == null) {
        throw new ParseException(
            CoreErrorDomain.ERR.missingExtensionClass);
      }
      try {
        Class<?> extClass = configLoader.loadClass(extensionClassName);
        if (!Extension.class.isAssignableFrom(extClass)) {
          throw new ParseException(
              CoreErrorDomain.ERR.mustImplementExtension);
        }
        extensionClass = (Class<? extends Extension>) extClass;
      } catch (ClassNotFoundException e) {
        ParseException pe = new ParseException(
            CoreErrorDomain.ERR.cantLoadExtensionClass, e);
        pe.setInternalReason("Unable to load extensionClass: " +
            extensionClassName);
        throw pe;
      }

      Boolean bool = getBooleanAttribute(attrs, "required");
View Full Code Here

      XhtmlTextConstruct xtc = new XhtmlTextConstruct();
      childHandlerInfo.handler = xtc.new AtomHandler();
      childHandlerInfo.textConstruct = xtc;

    } else {
      ParseException pe = new ParseException(
          CoreErrorDomain.ERR.invalidTextContentType);
      pe.setInternalReason(
          "Invalid text content type: '" + type + "'");
      throw pe;
    }

    return childHandlerInfo;
View Full Code Here

    @Override
    public void processEndElement() throws ParseException {

      if (name == null) {
        throw new ParseException(
            CoreErrorDomain.ERR.nameRequired);
      }

      XmlBlob xmlBlob = getXmlBlob();

      if (val != null && xmlBlob.getBlob() != null) {
        throw new ParseException(
            CoreErrorDomain.ERR.valueXmlMutuallyExclusive);
      }

      if (val == null && xmlBlob.getBlob() == null) {
        throw new ParseException(
            CoreErrorDomain.ERR.valueOrXmlRequired);
      }
    }
View Full Code Here

          TextConstruct.ChildHandlerInfo chi =
            TextConstruct.getChildHandler(attrs);

          if (state.title != null) {
            throw new ParseException(
                CoreErrorDomain.ERR.duplicateTitle);
          }

          state.title = chi.textConstruct;
          return chi.handler;

        } else if (localName.equals("summary")) {

          TextConstruct.ChildHandlerInfo chi =
            TextConstruct.getChildHandler(attrs);

          if (state.summary != null) {
            throw new ParseException(
                CoreErrorDomain.ERR.duplicateSummary);
          }

          state.summary = chi.textConstruct;
          return chi.handler;

        } else if (localName.equals("rights")) {

          TextConstruct.ChildHandlerInfo chi =
            TextConstruct.getChildHandler(attrs);

          if (state.rights != null) {
            throw new ParseException(
                CoreErrorDomain.ERR.duplicateRights);
          }

          state.rights = chi.textConstruct;
          return chi.handler;

        } else if (localName.equals("content")) {

          if (state.content != null) {
            throw new ParseException(
                CoreErrorDomain.ERR.duplicateContent);
          }

          Content.ChildHandlerInfo chi =
              getContentHandlerInfo(extProfile, attrs);
View Full Code Here

TOP

Related Classes of com.google.gdata.util.ParseException

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.