Java 8 JAXBException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 JAXBException class.

This code example shows how to use the following methods:getMessage
			try { 
				jaxbContext = JAXBContext.newInstance(clazz);
				this.jaxbContexts.putIfAbsent(clazz, jaxbContext);
			} 
			catch (JAXBException ex) {
				throw new HttpMessageConversionException(
						"Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex);
			} 
		} 
		return jaxbContext;
	} 
 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
         coreJaxbContext = JAXBContext.newInstance(
                 org.openstack.docs.identity.api.v2.ObjectFactory.class, 
                 com.rackspace.docs.identity.api.ext.rax_auth.v1.ObjectFactory.class); 
         groupJaxbContext = JAXBContext.newInstance(com.rackspace.docs.identity.api.ext.rax_ksgrp.v1.ObjectFactory.class);
      } catch (JAXBException e) {
         LOG.error("Problem creating the jaxb context for the OpenStack Auth objects.", e);
         throw new AuthServiceException("Possible deployment problem! Unable to build JAXB Context for OpenStack Auth schema types. Reason: " 
                 + e.getMessage(), e);
      } 
 
      return new AuthenticationServiceClient(targetHostUri, username, password, tenantId,
              new ResponseUnmarshaller(coreJaxbContext),
              new ResponseUnmarshaller(groupJaxbContext),
              new JaxbEntityToXml(coreJaxbContext),
              akkaServiceClient);
   } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage, printStackTrace
			String xml = getStringFromDocument(doc);
			if (network) { // so stupid !! TODO eli - find a proper way to deal
							// with different name spaces under the space 
							// JAXBContext instance. 
							// i cant seem to find the azure xsd anywhere so 
							// that i can generate proper model object using 
							// xjc. 
				xml = addNameSpaceToRootElement(xml,
						"xmlns=\"http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration\""); 
			} else { 
				xml = addNameSpaceToRootElement(xml, "xmlns=\"http://schemas.microsoft.com/windowsazure\"");
                xml = addNameSpaceToRootElement(xml, "xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"");
			} 
			return xml;
		} catch (JAXBException e) {
			throw new MicrosoftAzureException(e);
		} 
	} 
 
	/** 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
		} 
		catch (UnmarshalException ex) {
			throw new HttpMessageNotReadableException("Could not unmarshal to [" + clazz + "]: " + ex.getMessage(), ex);
		} 
		catch (JAXBException ex) {
			throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
		} 
	} 
 
	@Override 
	protected final void writeToResult(E accessToken, HttpHeaders headers, Result result) throws IOException {
		I convertedAccessToken = convertToInternal(accessToken);
		try { 
			createMarshaller().marshal(convertedAccessToken, result);
		} 
		catch (MarshalException ex) {
			throw new HttpMessageNotWritableException("Could not marshal [" + accessToken + "]: " + ex.getMessage(), ex);
		} 
		catch (JAXBException ex) {
			throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
                    this.classLoader);
            if (getValidationEventHandler() != null) { 
                try { 
                    u.setEventHandler(getValidationEventHandler()); 
                } catch (JAXBException e) {
                    Context.getCurrentLogger().log(Level.WARNING,
                            "Unable to set the event handler", e);
                    throw new IOException("Unable to set the event handler."
                            + e.getMessage());
                } 
            } 
 
            try { 
                this.object = (T) u.unmarshal(this,
                        this.xmlRepresentation.getReader());
            } catch (JAXBException e) {
                Context.getCurrentLogger().log(Level.WARNING,
                        "Unable to unmarshal the XML representation", e);
                throw new IOException(
                        "Unable to unmarshal the XML representation." 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage, printStackTrace
	public static synchronized JAXBContext createInstance() {
		JAXBContext context = null;
		try { 
			context = JAXBContext.newInstance(getClasses());				
		} catch (JAXBException e) {
			e.printStackTrace();
			throw new RuntimeException("Could not create JAXBContext : " + e.getMessage());
		} 
		return context;
	} 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
	public void updateJaxbElementFromDocument() { 
		 
		try { 
			this.unmarshal(doc.getDocumentElement() );
		} catch (JAXBException e) {
			log.error(e.getMessage(), e);
		} 
	} 
	 
	 
	private NamespacePrefixMappings nsContext;
	private NamespacePrefixMappings getNamespaceContext() { 
		if (nsContext==null) {
			nsContext = new NamespacePrefixMappings();
			xPath.setNamespaceContext(nsContext);
		} 
		return nsContext;
	} 
	 
	public String xpathGetString(String xpathString, String prefixMappings)  throws Docx4JException {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
        if (jaxbContext == null) {
            try { 
                jaxbContext = JAXBContext.newInstance(clazz);
                jaxbContexts.putIfAbsent(clazz, jaxbContext);
            } catch (JAXBException ex) {
                throw new HttpMessageConversionException(
                        "Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex);
            } 
        } 
        return jaxbContext;
    } 
 
 
} 
 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
            javax.xml.bind.Marshaller marshaller = jaxbContext.createMarshaller();
            marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_SCHEMA_LOCATION, HTTPX_SCHEMA_LOCATION);
 
            marshaller.marshal(getObjectFactory().createHttpx(messageEnvelope), outputStream);
        } catch (JAXBException e) {
            throw new MarshallerException("An exception occurred when attempting to marshal the http message envelope. Reason: " + e.getMessage(), e);
        } 
 
        return new ByteArrayInputStream(outputStream.toByteArray());
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    public static class WhenUsingUnmarshallerConstructionStrategy { 
 
        @Test(expected = ResourceConstructionException.class)
        public void testMakeObject() throws Exception {
            JAXBContext jaxbContext = mock(JAXBContext.class);
            when(jaxbContext.createUnmarshaller()).thenThrow(new JAXBException("mock jaxb exception"));
                         
            PoolableObjectFactory<UnmarshallerValidator> poolableObjectFactory = new UnmarshallerPoolableObjectFactory(jaxbContext);
 
            poolableObjectFactory.makeObject();
        } 
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 JAXBException Methods: