Package javax.xml.bind

Examples of javax.xml.bind.ValidationException


  /** <p>Returns a new JMValidator.</p>
   */
  public JMValidator getJMValidator() throws ValidationException {
    Class c = getJMValidatorClass();
    if (c == null) {
      throw new ValidationException("A JMValidator class is not set.");
    }
    try {
      return (JMValidator) c.newInstance();
    } catch (Exception e) {
      throw new ValidationException("Failed to instantiate JMValidator class " + c, e);
    }
  }
View Full Code Here


       
            //ValidatableObject vo = Util.toValidatableObject(o);
            ValidatableObject vo = jaxbContext.getGrammarInfo().castToValidatableObject(o);
           
            if(vo==null)
                throw new ValidationException(
                    Messages.format( Messages.NOT_VALIDATABLE ) );
       
            EventInterceptor ei = new EventInterceptor(eventHandler);
            ValidationContext context = new ValidationContext(jaxbContext,ei,validateId);
            context.validate(vo);
            context.reconcileIDs();
           
            return !ei.hadError();
        } catch( SAXException e ) {
            // TODO exception handling.
            // we need a consistent mechanism to convert SAXException into JAXBException
            Exception nested = e.getException();
            if( nested != null ) {
                throw new ValidationException( nested );
            } else {
                throw new ValidationException( e );
            }
            //return false;
        }
    }
View Full Code Here

        }

        try {
            return xmlValidator.validateRoot(rootObject);
        } catch (Exception e) {
            throw new ValidationException(e);
        }
    }
View Full Code Here

        }

        try {
            return xmlValidator.validate(object);
        } catch (Exception e) {
            throw new ValidationException(e);
        }
    }
View Full Code Here

        }

        try {
            return xmlValidator.validateRoot(rootObject);
        } catch (Exception e) {
            throw new ValidationException(e);
        }
    }
View Full Code Here

        }

        try {
            return xmlValidator.validate(object);
        } catch (Exception e) {
            throw new ValidationException(e);
        }
    }
View Full Code Here

  /** <p>Returns a new JMValidator.</p>
   */
  public JMValidator getJMValidator() throws ValidationException {
    Class c = getJMValidatorClass();
    if (c == null) {
      throw new ValidationException("A JMValidator class is not set.");
    }
    try {
      return (JMValidator) c.newInstance();
    } catch (Exception e) {
      throw new ValidationException("Failed to instantiate JMValidator class " + c, e);
    }
  }
View Full Code Here

   
    Stats statsObject = null;
    try {
      statsObject = gson.fromJson(statsString, Stats.class);
    } catch (JsonParseException e) {
      throw new ValidationException("Invalid stat data " + statsString + ":" +  e.getLocalizedMessage());
    }
 
    //Set the sample data
    sample.setDate(dateObject);
    sample.setSummarizerSamples(statsObject.getClientRequests()); // set SamplesCount
View Full Code Here

public class EnsureAssertionsEnabled implements ClassValidator {
  @Override
  public void validate(Class<?> clazz) throws Throwable {
    try {
      assert false;
      throw new ValidationException("Enable assertions globally with -ea (currently disabled or filtered to selected packages).");
    } catch (AssertionError e) {
      // Ok, enabled.
    }
  }
View Full Code Here

        try {
       
            ValidatableObject vo = Util.toValidatableObject(o);
           
            if(vo==null)
                throw new ValidationException(
                    Messages.format( Messages.NOT_VALIDATABLE ) );
       
            EventInterceptor ei = new EventInterceptor(eventHandler);
            ValidationContext context = new ValidationContext(ei,validateId);
            context.validate(vo);
            context.reconcileIDs();
           
            return !ei.hadError();
        } catch( SAXException e ) {
            // TODO exception handling.
            // we need a consistent mechanism to convert SAXException into JAXBException
            Exception nested = e.getException();
            if( e != null ) {
                throw new ValidationException( nested );
            } else {
                throw new ValidationException( e );
            }
            //return false;
        }
    }
View Full Code Here

TOP

Related Classes of javax.xml.bind.ValidationException

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.