JAXBException getLinkedException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for JAXBException getLinkedException method.

This code example shows how to use the following methods:getLinkedException
 
        try { 
            JAXBContextFactory.createContext(new Class[] {MissingPropRoot.class}, null);
        } catch(javax.xml.bind.JAXBException e) {
            try { 
                throw e.getLinkedException();
            } catch(org.eclipse.persistence.exceptions.JAXBException e2) {
                // MATCH ON CORRECT ERROR CODE 
                assertEquals(50013, e2.getErrorCode());
                return; 
 
            } catch(Throwable t) {
                fail();
            } 
 
        } 
        fail();
    }   
} 
3
CodeRank
This code example shows how to use the following methods:getLinkedException
        try { 
            JAXBContextFactory.createContext(new Class[] {ExtraPropRoot.class}, null);
 
        } catch(javax.xml.bind.JAXBException e) {
            try { 
                throw e.getLinkedException();
            } catch(org.eclipse.persistence.exceptions.JAXBException e2) {
                assertEquals(50012, e2.getErrorCode());
                return; 
            } catch(Throwable t) {
                fail();
            } 
        fail();
    } 
    } 
} 
3
CodeRank
This code example shows how to use the following methods:getLinkedException
	} 
 
	protected static Throwable unwrapException(Exception e) {
		if (e instanceof JAXBException) {
			JAXBException jaxbe = (JAXBException) e;
			return jaxbe.getLinkedException();
		} 
		return e;
	} 
 
	@Override 
	protected void initializeImageRegistry(ImageRegistry reg) {
		super.initializeImageRegistry(reg);
		String prefix = "/icons/";
		Enumeration<URL> enu = getBundle().findEntries(prefix, "*", true);
		while (enu.hasMoreElements()) {
			URL u = enu.nextElement();
			String file = u.getFile();
			String fileName = file;
			if (!file.startsWith(prefix)) {
4
CodeRank
This code example shows how to use the following methods:getLinkedException
        try { 
            jaxbContext = DynamicJAXBContextFactory.createContextFromXSD(inputStream, null, null, null);
        } catch (JAXBException e) {
            // If running in a non-JAXB 2.2 environment, we will get this error because the required() method 
            // on @XmlElementRef is missing.  Just ignore this and pass the test. 
            if (e.getLinkedException() instanceof UndeclaredThrowableException) {
                return; 
            } else { 
                throw e;
            } 
        } catch (Exception e) {
            if (e instanceof UndeclaredThrowableException) {
                return; 
            } else { 
                throw e;
            } 
        } 
 
        DynamicEntity person = jaxbContext.newDynamicEntity(PACKAGE + "." + PERSON);
        assertNotNull("Could not create Dynamic Entity.", person);
2
CodeRank
This code example shows how to use the following methods:getLinkedException
            o = u.unmarshal( input );
        } catch ( JAXBException e ) {
            LOG.error( "Error in configuration file: " + e.getLocalizedMessage() );
            // whyever they use the linked exception here... 
            // http://www.jaxb.com/how/to/hide/important/information/from/the/user/of/the/api/unknown_xml_format.xml 
            if ( e.getLinkedException() != null ) {
                LOG.error( "Error: " + e.getLinkedException().getLocalizedMessage() );
            } 
            LOG.error( "Hint: Try validating the file with an XML-schema aware editor." ); 
            throw e;
        } catch ( Exception e ) {
            LOG.error( "Error in configuration file: {}", e.getLocalizedMessage() );
            LOG.error( "Hint: Try validating the file with an XML-schema aware editor." ); 
        } 
        return o; 
    } 
 
    /** 
     * Creates a JAXB {@link Unmarshaller} which is instantiated with the given classpath (as well as the common 
     * configuration classpath). If the given schemalocation is not <code>null</code>, the unmarshaller will validate 
3
CodeRank
getLinkedException Method Overview
Get the linked exception
See Code Examples for other Java 8 JAXBException Methods: