热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.w3c.dom.DOMError.getMessage()方法的使用及代码示例

本文整理了Java中org.w3c.dom.DOMError.getMessage()方法的一些代码示例,展示了DOMError.getMessage()

本文整理了Java中org.w3c.dom.DOMError.getMessage()方法的一些代码示例,展示了DOMError.getMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DOMError.getMessage()方法的具体详情如下:
包路径:org.w3c.dom.DOMError
类名称:DOMError
方法名:getMessage

DOMError.getMessage介绍

[英]An implementation specific string describing the error that occurred.
[中]描述所发生错误的特定于实现的字符串。

代码示例

代码示例来源:origin: robovm/robovm

/**
* Implementation of DOMErrorHandler.handleError that
* adds copy of error to list for later retrieval.
*
*/
public boolean handleError(DOMError error) {
boolean fail = true;
String severity = null;
if (error.getSeverity() == DOMError.SEVERITY_WARNING) {
fail = false;
severity = "[Warning]";
} else if (error.getSeverity() == DOMError.SEVERITY_ERROR) {
severity = "[Error]";
} else if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) {
severity = "[Fatal Error]";
}

System.err.println(severity + ": " + error.getMessage() + "\t");
System.err.println("Type : " + error.getType() + "\t" + "Related Data: "
+ error.getRelatedData() + "\t" + "Related Exception: "
+ error.getRelatedException() );

return fail;
}
}

代码示例来源:origin: plutext/docx4j

/**
* Implementation of DOMErrorHandler.handleError that
* adds copy of error to list for later retrieval.
*
*/
public boolean handleError(DOMError error) {
boolean fail = true;
String severity = null;
if (error.getSeverity() == DOMError.SEVERITY_WARNING) {
fail = false;
severity = "[Warning]";
} else if (error.getSeverity() == DOMError.SEVERITY_ERROR) {
severity = "[Error]";
} else if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) {
severity = "[Fatal Error]";
}

System.err.println(severity + ": " + error.getMessage() + "\t");
System.err.println("Type : " + error.getType() + "\t" + "Related Data: "
+ error.getRelatedData() + "\t" + "Related Exception: "
+ error.getRelatedException() );

return fail;
}
}

代码示例来源:origin: apache/cxf

public boolean handleError(DOMError error) {
errorBuilder.append(error.getMessage());
LOG.warning(error.getMessage());
return true;
}
});

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public boolean handleError(DOMError error) {
errorBuilder.append(error.getMessage());
LOG.warning(error.getMessage());
return true;
}
});

代码示例来源:origin: org.apache.cxf/cxf-rt-core

public boolean handleError(DOMError error) {
errorBuilder.append(error.getMessage());
LOG.warning(error.getMessage());
return true;
}
});

代码示例来源:origin: ca.uhn.hapi/hapi-base

public boolean handleError(DOMError error) {
if (error.getSeverity() == DOMError.SEVERITY_WARNING) {
log.warn("Warning: {}", error.getMessage());
} else {
throw new RuntimeException((Exception) error.getRelatedException());
}
return true;
}

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

public void assertLowerSeverity(DOMTestCase testCase, String id, int severity) {
Iterator iter = errors.iterator();
while (iter.hasNext()) {
DOMError error = (DOMError) iter.next();
if (error.getSeverity() >= severity) {
testCase.fail(id + error.getMessage());
}
}
}
}

代码示例来源:origin: ca.uhn.hapi/hapi-osgi-base

public boolean handleError(DOMError error) {
if (error.getSeverity() == DOMError.SEVERITY_WARNING) {
log.warn("Warning: {}", error.getMessage());
} else {
throw new RuntimeException((Exception) error.getRelatedException());
}
return true;
}

代码示例来源:origin: ca.uhn.hapi/hapi-osgi-base

public boolean handleError(DOMError error) {
validationErrors.add(new ValidationException(getSeverity(error) + error.getMessage()));
return true;
}

代码示例来源:origin: jboss/jbossxb

String formatMessage(DOMError error)
{
StringBuffer buf = new StringBuffer();
DOMLocator location = error.getLocation();
if (location != null)
{
buf.append(location.getLineNumber()).append(':').append(location.getColumnNumber());
}
else
{
buf.append("[location unavailable]");
}
buf.append(' ').append(error.getMessage());
return buf.toString();
}
}

代码示例来源:origin: ca.uhn.hapi/hapi-base

public boolean handleError(DOMError error) {
validationErrors.add(new ValidationException(getSeverity(error) + error.getMessage()));
return true;
}

代码示例来源:origin: jboss/jbossxb

String formatMessage(DOMError error)
{
StringBuffer buf = new StringBuffer();
DOMLocator location = error.getLocation();
if(location != null)
{
buf.append(location.getLineNumber())
.append(':')
.append(location.getColumnNumber());
}
else
{
buf.append("[location unavailable]");
}
buf.append(' ').append(error.getMessage());
return buf.toString();
}
}

代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin

public boolean handleError(DOMError domError) {
Util.log("DOMError: " + domError.getMessage());
Object relatedException = domError.getRelatedException();
if (relatedException != null) {
Util.log("DOMError: " + relatedException);
if (relatedException instanceof Throwable) {
((Throwable) relatedException).printStackTrace(System.out);
}
}
return false;
}
};

代码示例来源:origin: org.opengis.cite/schema-utils

public boolean handleError(DOMError error) {
switch (error.getSeverity()) {
case DOMError.SEVERITY_WARNING:
addDOMError(ErrorSeverity.WARNING, error.getMessage(),
error.getLocation());
break;
case DOMError.SEVERITY_ERROR:
addDOMError(ErrorSeverity.ERROR, error.getMessage(),
error.getLocation());
break;
case DOMError.SEVERITY_FATAL_ERROR:
addDOMError(ErrorSeverity.CRITICAL, error.getMessage(),
error.getLocation());
break;
}
return (error.getSeverity() != DOMError.SEVERITY_FATAL_ERROR);
}

代码示例来源:origin: espertechinc/esper

public boolean handleError(DOMError error) {
String from = schemaResource != null ? schemaResource : "string";
log.warn("DOM error reported loading schema from " + from + ":\n" +
" message: " + error.getMessage() + "\n" +
" type: " + error.getType() + "\n" +
" related data: " + error.getRelatedData() + "\n" +
" related exception: " + error.getRelatedException() + "\n" +
" severity: " + error.getSeverity() + "\n" +
" location: " + error.getLocation());
if (error.getRelatedException() instanceof Throwable) {
Throwable t = (Throwable) error.getRelatedException();
log.warn("DOM error related exception: " + t.getMessage(), t);
}
return false;
}
}

代码示例来源:origin: xalan/serializer

/**
* Implementation of DOMErrorHandler.handleError that
* adds copy of error to list for later retrieval.
*
*/
public boolean handleError(DOMError error) {
boolean fail = true;
String severity = null;
if (error.getSeverity() == DOMError.SEVERITY_WARNING) {
fail = false;
severity = "[Warning]";
} else if (error.getSeverity() == DOMError.SEVERITY_ERROR) {
severity = "[Error]";
} else if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) {
severity = "[Fatal Error]";
}

System.err.println(severity + ": " + error.getMessage() + "\t");
System.err.println("Type : " + error.getType() + "\t" + "Related Data: "
+ error.getRelatedData() + "\t" + "Related Exception: "
+ error.getRelatedException() );

return fail;
}
}

代码示例来源:origin: MobiVM/robovm

/**
* Implementation of DOMErrorHandler.handleError that
* adds copy of error to list for later retrieval.
*
*/
public boolean handleError(DOMError error) {
boolean fail = true;
String severity = null;
if (error.getSeverity() == DOMError.SEVERITY_WARNING) {
fail = false;
severity = "[Warning]";
} else if (error.getSeverity() == DOMError.SEVERITY_ERROR) {
severity = "[Error]";
} else if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) {
severity = "[Fatal Error]";
}

System.err.println(severity + ": " + error.getMessage() + "\t");
System.err.println("Type : " + error.getType() + "\t" + "Related Data: "
+ error.getRelatedData() + "\t" + "Related Exception: "
+ error.getRelatedException() );

return fail;
}
}

代码示例来源:origin: ibinti/bugvm

/**
* Implementation of DOMErrorHandler.handleError that
* adds copy of error to list for later retrieval.
*
*/
public boolean handleError(DOMError error) {
boolean fail = true;
String severity = null;
if (error.getSeverity() == DOMError.SEVERITY_WARNING) {
fail = false;
severity = "[Warning]";
} else if (error.getSeverity() == DOMError.SEVERITY_ERROR) {
severity = "[Error]";
} else if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) {
severity = "[Fatal Error]";
}

System.err.println(severity + ": " + error.getMessage() + "\t");
System.err.println("Type : " + error.getType() + "\t" + "Related Data: "
+ error.getRelatedData() + "\t" + "Related Exception: "
+ error.getRelatedException() );

return fail;
}
}

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

/**
* Public constructor
*
*/
public DOMErrorImpl(DOMError src) {
this.severity = src.getSeverity();
this.message = src.getMessage();
this.type = src.getType();
this.relatedException = src.getRelatedException();
this.relatedData = src.getRelatedData();
this.location = new DOMLocatorImpl(src.getLocation());
}

代码示例来源:origin: elodina/xml-avro

void throwExceptionIfHasError() {
if (exception != null)
throw new ConverterException(exception);
if (error != null) {
if (error.getRelatedException() instanceof Throwable)
throw new ConverterException((Throwable) error.getRelatedException());
DOMLocator locator = error.getLocation();
String location = "at:" + locator.getUri() + ", line:" + locator.getLineNumber() + ", char:" + locator.getColumnNumber();
throw new ConverterException(location + " " + error.getMessage());
}
}
}

推荐阅读
author-avatar
景科儒_189
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有