mil.dod.th.ose.core/src/mil/dod/th/ose/core/impl/validator/ValidatorImpl.java
private void validateSource(final Source source,
                                final Object object)
            throws ValidationFailedException, IllegalStateException
    {
        final Validator validator = getSchemaValidator(object.getClass());
        
        try
        {
            synchronized (validator)
            {
                validator.validate(source);
            }
        }
        catch (final SAXException exception)
        {
            final StringBuilder messageBuilder = new StringBuilder("Problem validating XML");
            
            try
            {
                final byte[] bytes = m_XMLMarshallService.createXmlByteArray(object, true);
                messageBuilder.append(":\n").append(new String(bytes));
            }
            catch (final MarshalException e)
            {
                messageBuilder.append(" (and unable to marshall to XML: ");
                messageBuilder.append(e.getMessage());
                messageBuilder.append(")");
            } 
            
            throw new ValidationFailedException(messageBuilder.toString(), exception);
        }
        catch (final IOException exception)
        {
            throw new ValidationFailedException("Problem parsing XML", exception);
        }
    }
/**
     * Private helper method for validation.
     * 
     * @param source
     *            transform source reference
     * @param object
     *            JAXB object to validate
     * @throws ValidationFailedException
     *             if validation, or parsing of XML fails
     * @throws IllegalStateException
     *             if the class doesn't have an associated XSD file
     */
Private helper method for validation.

@param source
transform source reference
@param object
JAXB object to validate
@throws ValidationFailedException
if validation, or parsing of XML fails
@throws IllegalStateException
if the class doesn't have an associated XSD file
Private helper method for validation . @param source transform source reference @param object JAXB object to validate @throws ValidationFailedException if validation or parsing of XML fails @throws IllegalStateException if the class doesn ' t have an associated XSD file
private void validateSource(final Source source,
                                final Object object)
            throws ValidationFailedException, IllegalStateException
    {
        final Validator validator = getSchemaValidator(object.getClass());
        try
        {
            synchronized (validator)
            {
                validator.validate(source);
            }
        }
        catch (final SAXException exception)
        {
            final StringBuilder messageBuilder = new StringBuilder("Problem validating XML");
            try
            {
                final byte[] bytes = m_XMLMarshallService.createXmlByteArray(object, true);
                messageBuilder.append(":\n").append(new String(bytes));
            }
            catch (final MarshalException e)
            {
                messageBuilder.append(" (and unable to marshall to XML: ");
                messageBuilder.append(e.getMessage());
                messageBuilder.append(")");
            } 
            throw new ValidationFailedException(messageBuilder.toString(), exception);
        }
        catch (final IOException exception)
        {
            throw new ValidationFailedException("Problem parsing XML", exception);
        }
    }
private void validateSource ( final Source source , final Object object ) throws ValidationFailedException , IllegalStateException { final Validator validator = getSchemaValidator ( object . getClass ( ) ) ; try { synchronized ( validator ) { validator . validate ( source ) ; } } catch ( final SAXException exception ) { final StringBuilder messageBuilder = new StringBuilder ( "Problem validating XML" ) ; try { final byte [ ] bytes = m_XMLMarshallService . createXmlByteArray ( object , true ) ; messageBuilder . append ( ":\n" ) . append ( new String ( bytes ) ) ; } catch ( final MarshalException e ) { messageBuilder . append ( " (and unable to marshall to XML: " ) ; messageBuilder . append ( e . getMessage ( ) ) ; messageBuilder . append ( ")" ) ; } throw new ValidationFailedException ( messageBuilder . toString ( ) , exception ) ; } catch ( final IOException exception ) { throw new ValidationFailedException ( "Problem parsing XML" , exception ) ; } }
Private helper method for validation.
Private helper method for validation .