Package javax.xml.bind

Examples of javax.xml.bind.JAXBException


            for (i = classNames.length; i < classes.length; i++, j++) {
                classes[i] = classLoader.loadClass(JAXB_ANNOTATED_CMD[j]);
            }
            return JAXBContext.newInstance(classes, properties);
        } catch (ClassNotFoundException e) {
            throw new JAXBException("Unable to resolve class '" + classNames[i] + "'", e);
        }
    }
View Full Code Here


    XMLWriter w;
    Class c = getXMLWriterClass();
    try {
      w = (XMLWriter) c.newInstance();
    } catch (Exception e) {
      throw new JAXBException("Failed to instantiate XMLWriter class " + c.getName(), e);
    }
    w.init(this);
    w.setWriter(pWriter);
    marshal(pObject, w);
  }
View Full Code Here

        UnmarshallerHandler uh = getUnmarshallerHandler();
        xr.setContentHandler(uh);
        try {
          xr.parse(is);
        } catch (IOException e) {
          throw new JAXBException(e);
        } catch (SAXException e) {
          if (e.getException() != null) {
            throw new JAXBException(e.getException());
          } else {
            throw new JAXBException(e);
          }
        }
        return uh.getResult();
      }
    } else if (pSource instanceof StreamSource) {
View Full Code Here

    try {
      JMMarshaller marshaller = (JMMarshaller) c.newInstance();
      marshaller.setJAXBContextImpl(this);
      return marshaller;
    } catch (InstantiationException e) {
      throw new JAXBException("Failed to instantiate class " + c.getName(), e);
    } catch (IllegalAccessException e) {
      throw new JAXBException("Illegal access to class " + c.getName(), e);
    } catch (ClassCastException e) {
      throw new JAXBException("Class " + c.getName() +
                               " is not implementing " +
                               JMMarshaller.class.getName());
    }
  }
View Full Code Here

    try {
      JMUnmarshaller unmarshaller = (JMUnmarshaller) c.newInstance();
      unmarshaller.setJAXBContextImpl(this);
      return unmarshaller;
    } catch (InstantiationException e) {
      throw new JAXBException("Failed to instantiate class " + c.getName(), e);
    } catch (IllegalAccessException e) {
      throw new JAXBException("Illegal access to class " + c.getName(), e);
    } catch (ClassCastException e) {
      throw new JAXBException("Class " + c.getName() +
                               " is not implementing " +
                               JMUnmarshaller.class.getName());
    }
  }
View Full Code Here

    try {
      JMValidator validator = (JMValidator) c.newInstance();
      validator.setJAXBContextImpl(this);
      return validator;
    } catch (InstantiationException e) {
      throw new JAXBException("Failed to instantiate class " + c.getName(), e);
    } catch (IllegalAccessException e) {
      throw new JAXBException("Illegal access to class " + c.getName(), e);
    } catch (ClassCastException e) {
      throw new JAXBException("Class " + c.getName() +
                               " is not implementing " +
                               JMValidator.class.getName());
    }
  }
View Full Code Here

   *   given QName.
   */
  public JMManager getManager(QName pQName) throws JAXBException {
    JMManager manager = getManagerByQName(pQName);
    if (manager == null) {
      throw new JAXBException("A Manager for " + pQName + " is not declared.");
    }
    return manager;
  }
View Full Code Here

   *   given QName.
   */
  public JMManager getManager(Class pElementInterface) throws JAXBException {
    JMManager manager = getManagerByInterface(pElementInterface);
    if (manager == null) {
      throw new JAXBException("A Manager for " + pElementInterface.getName() +
                               " is not declared.");
    }
    return manager;
  }
View Full Code Here

   *   was not declared or creating the instance caused an exception.
   */
  public Object getElement(Class pElementInterface) throws JAXBException {
    JMManager manager = getManagerByInterface(pElementInterface);
    if (manager == null) {
      throw new JAXBException("No manager configured for " + pElementInterface.getName());
    }
    Class c = manager.getElementClass();
    if (c == null) {
      throw new JAXBException("No element class configured for " +
                               pElementInterface.getName());
    }
    try {
      return c.newInstance();
    } catch (Exception e) {
      throw new JAXBException("Could not instantiate element class " + c.getName(), e);
    }
  }
View Full Code Here

            setJMMarshallerClass(c.getJMMarshallerClass());
            setJMUnmarshallerClass(c.getJMUnmarshallerClass());
            setJMValidatorClass(c.getJMValidatorClass());
          }
        } catch (IOException e) {
          throw new JAXBException("Failed to load config file " + url, e);
        } catch (SAXParseException e) {
          Exception f = e.getException() == null ? e : e.getException();
          throw new JAXBException("Failed to parse config file " + url +
                                   " at line " + e.getLineNumber() +
                                   ", column " + e.getColumnNumber() +
                                   ": " + f.getMessage(), f);
        } catch (SAXException e) {
          Exception f = e.getException() == null ? e : e.getException();
          String msg = "Failed to parse config file " + url +": " + f.getMessage();
          System.err.println(msg);
          throw new JAXBException(msg, f);
        } catch (ParserConfigurationException e) {
          throw new JAXBException("Failed to create a SAX Parser: " + e.getMessage(), e);
        }
      }
    }
    if (first) {
      throw new JAXBException("Unable to locate configuration file Configuration.xml in " + packageNames);
    }
  }
View Full Code Here

TOP

Related Classes of javax.xml.bind.JAXBException

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.