Examples of JAXBException


Examples of javax.xml.bind.JAXBException

            }
           
            return ReflectionInvokationHandler.createProxyWrapper(sc,
                                                                  SchemaCompiler.class);
        } catch (Exception ex) {
            throw new JAXBException(ex);
        }
    }
View Full Code Here

Examples of javax.xml.bind.JAXBException

                cls = Class.forName("com.sun.codemodel.internal.writer.FileCodeWriter",
                                    true, getXJCClassLoader());
            }
            return cls.getConstructor(File.class).newInstance(f);
        } catch (Exception ex) {
            throw new JAXBException(ex);
        }
    }
View Full Code Here

Examples of javax.xml.bind.JAXBException

                name = name.substring(name.length()-DOT_OBJECT_FACTORY.length())+IMPL_DOT_OBJECT_FACTORY;

                try {
                    c = c.getClassLoader().loadClass(name);
                } catch (ClassNotFoundException e) {
                    throw new JAXBException(e);
                }

                modified = true;
            }

            r[i] = c;
        }

        if(!modified) {
            // if the class list doesn't contain any of our classes,
            // this ContextFactory shouldn't have been called in the first place
            // if we simply continue, we'll just end up with the infinite recursion.

            // the only case that I can think of where this could happen is
            // when the user puts additional classes into the JAXB-generated
            // package and pass them to JAXBContext.newInstance().
            // Under normal use, this shouldn't happen.

            // anyway, bail out now.
            // if you hit this problem and wondering how to get around the problem,
            // subscribe and send a note to users@jaxb.dev.java.net (http://jaxb.dev.java.net/)
            throw new JAXBException("Unable to find a JAXB implementation to delegate");
        }

        // delegate to the JAXB provider in the system
        return JAXBContext.newInstance(r,properties);
    }
View Full Code Here

Examples of javax.xml.bind.JAXBException

            while(tokens.hasMoreTokens()) {
                String pkg = tokens.nextToken();
                classes.add(classLoader.loadClass(pkg+IMPL_DOT_OBJECT_FACTORY));
            }
        } catch (ClassNotFoundException e) {
            throw new JAXBException(e);
        }

        // delegate to the JAXB provider in the system
        return JAXBContext.newInstance(classes.toArray(new Class[classes.size()]),properties);
    }
View Full Code Here

Examples of javax.xml.bind.JAXBException

    private JAXBException convertToJaxbException(Exception ex) {
        if (ex instanceof JAXBException) {
            return (JAXBException) ex;
        }
        else {
            return new JAXBException(ex);
        }
    }
View Full Code Here

Examples of javax.xml.bind.JAXBException

            new ErrorHandlerAdaptor(handler,locator));
       
        try {
            reader.parse(source);
        } catch( IOException e ) {
            throw new JAXBException(e);
        } catch( SAXException e ) {
            throw createUnmarshalException(e);
        }
       
        Object result = handler.getResult();
View Full Code Here

Examples of javax.xml.bind.JAXBException

            for( int j = grammarInfos.length-1; j >= 0; j -- ) {
                if( grammarInfos[j].recognize( points[i], points[i+1] ) ) {
                    if( elementFound == false ) {
                        elementFound = true;
                    } else {
                        throw new JAXBException(
                                Messages.format( Messages.COLLISION_DETECTED,
                                        points[i], points[i+1] ) );
                    }
                }
            }
View Full Code Here

Examples of javax.xml.bind.JAXBException

               
                // check version
                if( version==null version = getVersion(c);
                else
                if( !version.equals(getVersion(c)) )
                    throw new JAXBException( Messages.format(
                        Messages.INCOMPATIBLE_VERSION, new Object[]{
                            version,
                            c.getClass().getName(),
                            getVersion(c) } ) );
              
                // use reflection to get GrammarInfo
                Object grammarInfo = c.getClass().getField("grammarInfo").get(null);
              
                // wrap the grammarInfo into a proxy if necessary
                grammarInfo = ProxyGroup.blindWrap(
                    grammarInfo, GrammarInfo.class,
                    new Class[]{
                        GrammarInfo.class,
                        UnmarshallingContext.class,
                        UnmarshallingEventHandler.class,
                        XMLSerializer.class,
                        XMLSerializable.class,
                        NamespaceContext2.class,
                        ValidatableObject.class
                    } );
               
                gis.add( grammarInfo );
            } catch( ClassNotFoundException e ) {
                throw new NoClassDefFoundError(e.getMessage());
            } catch( Exception e ) {
                throw new JAXBException(e);
            }
        }

        if( gis.size()==1 )
            // if there's only one path, no need to use a facade.
View Full Code Here

Examples of javax.xml.bind.JAXBException

            if( is==null ) {
                // unable to find bgm.ser
                String name = objectFactoryClass.getName();
                int idx = name.lastIndexOf('.');
                name = '/'+name.substring(0,idx+1).replace('.','/')+"bgm.ser";
                throw new JAXBException(
                    Messages.format( Messages.NO_BGM, name ) );
            }
           
            // deserialize the bgm
            ObjectInputStream ois = new ObjectInputStream( is );
            com.sun.xml.bind.GrammarImpl g = (com.sun.xml.bind.GrammarImpl)ois.readObject();
            ois.close();
           
            g.connect(new com.sun.msv.grammar.Grammar[]{g});    // connect to itself
           
            return g;
        } catch( Exception e ) {
            throw new JAXBException(
                Messages.format( Messages.UNABLE_TO_READ_BGM ),
                e );
        }
    }
View Full Code Here

Examples of javax.xml.bind.JAXBException

     */
    public Object newInstance( Class javaContentInterface )
        throws JAXBException {

        if( javaContentInterface == null ) {
            throw new JAXBException( Messages.format( Messages.CI_NOT_NULL ) );
        }

        try {
            Class c = gi.getDefaultImplementation( javaContentInterface );
            if(c==null)
                throw new JAXBException(
                    Messages.format( Messages.MISSING_INTERFACE, javaContentInterface ));
           
            return c.newInstance();
        } catch( Exception e ) {
            throw new JAXBException( e );
        }
    }
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.