当前位置: 首页>>代码示例>>Java>>正文


Java ValidationEvent.ERROR属性代码示例

本文整理汇总了Java中javax.xml.bind.ValidationEvent.ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java ValidationEvent.ERROR属性的具体用法?Java ValidationEvent.ERROR怎么用?Java ValidationEvent.ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.xml.bind.ValidationEvent的用法示例。


在下文中一共展示了ValidationEvent.ERROR属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleEvent

public boolean handleEvent( ValidationEvent event ) {
    events.add(event);

    boolean retVal = true;
    switch( event.getSeverity() ) {
        case ValidationEvent.WARNING:
            retVal = true; // continue validation
            break;
        case ValidationEvent.ERROR:
            retVal = true; // continue validation
            break;
        case ValidationEvent.FATAL_ERROR:
            retVal = false; // halt validation
            break;
        default:
            _assert( false,
                     Messages.format( Messages.UNRECOGNIZED_SEVERITY,
                             event.getSeverity() ) );
            break;
    }

    return retVal;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:ValidationEventCollector.java

示例2: checkForValidationErrors

private List<String> checkForValidationErrors(ValidationEvent... events)
{

	List<String> errors = new ArrayList<>();

	for (ValidationEvent event : events)
	{
		if (event.getSeverity() != ValidationEvent.WARNING)
		{
			String severity = (event.getSeverity() == ValidationEvent.ERROR) ? "[ERROR]: " : "[FATAL_ERROR]: ";
			String location = JaxbUtil.getErrorLocation(event);
			String message = String.format("%s %s Location: %s", severity, event.getMessage(), location);
			errors.add(message);

		}
	}

	return errors;
}
 
开发者ID:tinesoft,项目名称:droidlinguist,代码行数:19,代码来源:SourceStringsParser.java

示例3: handleEvent

@Override
public boolean handleEvent(ValidationEvent event) {
	events.add(event);

	boolean retVal = true;
	switch (event.getSeverity()) {
	case ValidationEvent.WARNING:
		retVal = true; // continue validation
		break;
	case ValidationEvent.ERROR:
		retVal = true; // continue validation
		break;
	case ValidationEvent.FATAL_ERROR:
		retVal = true; // continue validation
		break;

	}

	return retVal;
}
 
开发者ID:tinesoft,项目名称:droidlinguist,代码行数:20,代码来源:EagerValidationEventCollector.java

示例4: getErrorLevel

/**
 * Get the error level matching the passed JAXB severity.
 *
 * @param nSeverity
 *        The JAXB severity.
 * @return The matching {@link IErrorLevel}. Never <code>null</code>.
 */
@Nonnull
@OverrideOnDemand
protected IErrorLevel getErrorLevel (final int nSeverity)
{
  switch (nSeverity)
  {
    case ValidationEvent.WARNING:
      return EErrorLevel.WARN;
    case ValidationEvent.ERROR:
      return EErrorLevel.ERROR;
    case ValidationEvent.FATAL_ERROR:
      return EErrorLevel.FATAL_ERROR;
    default:
      s_aLogger.warn ("Unknown JAXB validation severity: " + nSeverity + "; defaulting to error");
      return EErrorLevel.ERROR;
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:24,代码来源:AbstractValidationEventHandler.java

示例5: setSeverity

/**
 * Set the severity field of this event.
 *
 * @param _severity Must be one of ValidationEvent.WARNING,
 * ValidationEvent.ERROR, or ValidationEvent.FATAL_ERROR.
 * @throws IllegalArgumentException if an illegal severity field is supplied
 */
public void setSeverity( int _severity ) {

    if( _severity != ValidationEvent.WARNING &&
        _severity != ValidationEvent.ERROR &&
        _severity != ValidationEvent.FATAL_ERROR ) {
            throw new IllegalArgumentException(
                Messages.format( Messages.ILLEGAL_SEVERITY ) );
    }

    this.severity = _severity;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:ValidationEventImpl.java

示例6: severityToString

private String severityToString(int severity) {
  switch (severity) {
    case ValidationEvent.WARNING:
      return "WARN ";
    case ValidationEvent.ERROR:
      return "ERROR";
    default:
      return "FATAL";
  }
}
 
开发者ID:FIXTradingCommunity,项目名称:fix-orchestra,代码行数:10,代码来源:DocGenerator.java

示例7: handleEvent

public boolean handleEvent(ValidationEvent event) {
	if ((event.getSeverity() == ValidationEvent.FATAL_ERROR)
			|| (event.getSeverity() == ValidationEvent.ERROR)) {
		return false;
	} else if (event.getSeverity() == ValidationEvent.WARNING) {
		log.debug("Validation warning: " + event.getMessage() + ".");
		return true;
	} else {
		log.warn("Unknown validation event type.");
		return false;
	}
}
 
开发者ID:loomchild,项目名称:segment,代码行数:12,代码来源:LoggingValidationEventHandler.java

示例8: handlePrintConversionException

/**
 * Reports a print conversion error while marshalling.
 */
public static void handlePrintConversionException(
    Object caller, Exception e, XMLSerializer serializer ) throws SAXException {

    if( e instanceof SAXException )
        // assume this exception is not from application.
        // (e.g., when a marshaller aborts the processing, this exception
        //        will be thrown)
        throw (SAXException)e;

    ValidationEvent ve = new PrintConversionEventImpl(
        ValidationEvent.ERROR, e.getMessage(),
        new ValidationEventLocatorImpl(caller), e );
    serializer.reportError(ve);
}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:17,代码来源:RuntimeUtil.java

示例9: handleTypeMismatchError

/**
 * Reports that the type of an object in a property is unexpected.
 */
public static void handleTypeMismatchError( XMLSerializer serializer,
        Object parentObject, String fieldName, Object childObject ) throws SAXException {

     ValidationEvent ve = new ValidationEventImpl(
        ValidationEvent.ERROR, // maybe it should be a fatal error.
         Messages.TYPE_MISMATCH.format(
            getTypeName(parentObject),
            fieldName,
            getTypeName(childObject) ),
        new ValidationEventLocatorExImpl(parentObject,fieldName) );

    serializer.reportError(ve);
}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:16,代码来源:RuntimeUtil.java

示例10: handleEvent

@Override
public boolean handleEvent(ValidationEvent event) {
	StringBuilder msg = new StringBuilder();
	LogLevel type = LogLevel.ERROR;

	switch (event.getSeverity()) {
	case ValidationEvent.FATAL_ERROR:
	case ValidationEvent.ERROR:
		msg.append("Invalid XML content");
		type = LogLevel.ERROR;
		isValid = false;
		break;
	case ValidationEvent.WARNING:
		msg.append("Warning");
		type = LogLevel.WARN;
		break;
	}

	if (event.getLocator() != null) {
		msg.append(" at [").append(event.getLocator().getLineNumber())
		.append(", ").append(event.getLocator().getColumnNumber()).append("]");
	}

	msg.append(": ").append(event.getMessage());		
	log.log(type, msg.toString());
	
	if (!isValid)
		cause = msg.toString();
	
	return isValid;
}
 
开发者ID:3dcitydb,项目名称:web-feature-service,代码行数:31,代码来源:ValidationEventHandlerImpl.java

示例11: getSeverity

private static String getSeverity(int severity) {
    switch (severity) {
    case ValidationEvent.FATAL_ERROR:
        return "FATAL";
    case ValidationEvent.ERROR:
        return "FATAL";
    case ValidationEvent.WARNING:
        return "WARNING";
    default:
        return "";
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:12,代码来源:MetadataValidationEventCollector.java

示例12: handleEvent

@Override
public boolean handleEvent(ValidationEvent ve)
{
	if (ve.getSeverity() == ValidationEvent.FATAL_ERROR
		|| ve.getSeverity() == ValidationEvent.ERROR)
	{
		ValidationEventLocator locator = ve.getLocator();
		log.error("{}: {} at line={}, column={}", locator.getURL(),
			ve.getMessage(), locator.getLineNumber(),
			locator.getColumnNumber());
		foundErrors = true;
	}
	return true;
}
 
开发者ID:outermedia,项目名称:solr-fusion,代码行数:14,代码来源:XmlValidationHandler.java

示例13: handleEvent

@Override
public boolean handleEvent(ValidationEvent event) {
    switch(event.getSeverity()) {
    case ValidationEvent.WARNING:
        return warning(event);
    case ValidationEvent.ERROR:
        return error(event);
    case ValidationEvent.FATAL_ERROR:
        return fatalError(event);
    }
    
    throw new IllegalArgumentException("Unsupported ValidationEvent severity: " + event.getSeverity());
}
 
开发者ID:TAXIIProject,项目名称:java-taxii,代码行数:13,代码来源:ValidationErrorHandler.java

示例14: reportError

/**
 * Report an error found as an exception.
 *
 * @param fieldName
 *      the name of the property being processed when an error is found.
 */
public final void reportError(String fieldName, Throwable t) throws SAXException {
    ValidationEvent ve = new ValidationEventImpl(ValidationEvent.ERROR,
        t.getMessage(), getCurrentLocation(fieldName), t);
    reportError(ve);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:XMLSerializer.java


注:本文中的javax.xml.bind.ValidationEvent.ERROR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。