本文整理汇总了Java中org.codehaus.groovy.control.messages.Message类的典型用法代码示例。如果您正苦于以下问题:Java Message类的具体用法?Java Message怎么用?Java Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Message类属于org.codehaus.groovy.control.messages包,在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: write
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
private void write(PrintWriter writer, Janitor janitor, List messages, String txt) {
if (messages==null || messages.isEmpty()) return;
Iterator iterator = messages.iterator();
while (iterator.hasNext()) {
Message message = (Message) iterator.next();
message.write(writer, janitor);
if (configuration.getDebug() && (message instanceof SyntaxErrorMessage)){
SyntaxErrorMessage sem = (SyntaxErrorMessage) message;
sem.getCause().printStackTrace(writer);
}
writer.println();
}
writer.print(messages.size());
writer.print(" "+txt);
if (messages.size()>1) writer.print("s");
writer.println();
}
开发者ID:apache,项目名称:groovy,代码行数:20,代码来源:ErrorCollector.java
示例2: fromGroovyException
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
public static ScriptError fromGroovyException(MultipleCompilationErrorsException e) {
ErrorCollector errorCollector = e.getErrorCollector();
if (errorCollector.getErrorCount() > 0) {
Message error = errorCollector.getError(0);
if (error instanceof SyntaxErrorMessage) {
SyntaxException cause = ((SyntaxErrorMessage) error).getCause();
return new ScriptError(cause.getMessage(), cause.getStartLine(), cause.getStartColumn(),
cause.getEndLine(), cause.getEndColumn());
} else {
throw new AssertionError("SyntaxErrorMessage is expected");
}
} else {
throw new AssertionError("At least one error is expected");
}
}
开发者ID:powsybl,项目名称:powsybl-core,代码行数:16,代码来源:ScriptError.java
示例3: handleMalformedDependency
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
private void handleMalformedDependency(Expression expression) {
Message message = createSyntaxErrorMessage(
String.format(
"The string must be of the form \"group:module:version\"%n"),
expression);
getSourceUnit().getErrorCollector().addErrorAndContinue(message);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:DependencyManagementBomTransformation.java
示例4: handleDuplicateDependencyManagementBomAnnotation
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
private void handleDuplicateDependencyManagementBomAnnotation(
AnnotationNode annotationNode) {
Message message = createSyntaxErrorMessage(
"Duplicate @DependencyManagementBom annotation. It must be declared at most once.",
annotationNode);
getSourceUnit().getErrorCollector().addErrorAndContinue(message);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:DependencyManagementBomTransformation.java
示例5: mangleMultipleCompilationErrorsException
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
private RuntimeException mangleMultipleCompilationErrorsException(MultipleCompilationErrorsException e, List<StringSection> sections) {
RuntimeException result = e;
ErrorCollector collector = e.getErrorCollector();
@SuppressWarnings({"unchecked"})
List<Message> errors = (List<Message>) collector.getErrors();
if (!errors.isEmpty()) {
Message firstMessage = errors.get(0);
if (firstMessage instanceof SyntaxErrorMessage) {
@SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
SyntaxException syntaxException = ((SyntaxErrorMessage) firstMessage).getCause();
Position errorPosition = new Position(syntaxException.getLine(), syntaxException.getStartColumn());
//find the string section which precedes the row/col of the thrown exception
StringSection precedingSection = findPrecedingSection(errorPosition, sections);
//and now use the string section to mangle the line numbers so that they refer to the
//appropriate line in the source template data
if (precedingSection != null) {
//if the error was thrown on the same row as where the last string section
//ended, fix column value
offsetPositionFromSection(errorPosition, precedingSection);
//the below being true indicates that we had an unterminated ${ or <% sequence and
//the column is thus meaningless, we reset it to where the %{ or <% starts to at
//least give the user a sporting chance
if (sections.get(sections.size() - 1) == precedingSection) {
errorPosition.column = precedingSection.lastSourcePosition.column;
}
String message = mangleExceptionMessage(e.getMessage(), errorPosition);
result = new TemplateParseException(message, e, errorPosition.row, errorPosition.column);
}
}
}
return result;
}
开发者ID:apache,项目名称:groovy,代码行数:38,代码来源:StreamingTemplateEngine.java
示例6: addErrorAndContinue
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
/**
* Adds an error to the message set, but does not cause a failure. The message is not required to have a source
* line and column specified, but it is best practice to try and include that information.
*/
public void addErrorAndContinue(Message message) {
if (this.errors == null) {
this.errors = new LinkedList();
}
this.errors.add(message);
}
开发者ID:apache,项目名称:groovy,代码行数:12,代码来源:ErrorCollector.java
示例7: addError
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
/**
* Adds a non-fatal error to the message set, which may cause a failure if the error threshold is exceeded.
* The message is not required to have a source line and column specified, but it is best practice to try
* and include that information.
*/
public void addError(Message message) throws CompilationFailedException {
addErrorAndContinue(message);
if (errors!=null && this.errors.size() >= configuration.getTolerance()) {
failIfErrors();
}
}
开发者ID:apache,项目名称:groovy,代码行数:13,代码来源:ErrorCollector.java
示例8: getError
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
/**
* Returns the specified error message, or null.
*/
public Message getError(int index) {
if (index < getErrorCount()) {
return (Message) this.errors.get(index);
}
return null;
}
开发者ID:apache,项目名称:groovy,代码行数:10,代码来源:ErrorCollector.java
示例9: getSyntaxError
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
/**
* Convenience routine to return the specified error's
* underlying SyntaxException, or null if it isn't one.
*/
public SyntaxException getSyntaxError(int index) {
SyntaxException exception = null;
Message message = getError(index);
if (message != null && message instanceof SyntaxErrorMessage) {
exception = ((SyntaxErrorMessage) message).getCause();
}
return exception;
}
开发者ID:apache,项目名称:groovy,代码行数:14,代码来源:ErrorCollector.java
示例10: getException
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
/**
* Convenience routine to return the specified error's
* underlying Exception, or null if it isn't one.
*/
public Exception getException(int index) {
Exception exception = null;
Message message = getError(index);
if (message != null) {
if (message instanceof ExceptionMessage) {
exception = ((ExceptionMessage) message).getCause();
}
else if (message instanceof SyntaxErrorMessage) {
exception = ((SyntaxErrorMessage) message).getCause();
}
}
return exception;
}
开发者ID:apache,项目名称:groovy,代码行数:19,代码来源:ErrorCollector.java
示例11: writeErrorMessage
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
private void writeErrorMessage(PrintWriter p, Message message) {
if (message instanceof ExceptionMessage) {
// Just writes the cause
//noinspection ThrowableResultOfMethodCallIgnored
p.format("%n- %s", ((ExceptionMessage) message).getCause().getMessage());
}
}
开发者ID:nemerosa,项目名称:ontrack,代码行数:8,代码来源:ExpressionEngineImpl.java
示例12: createSyntaxErrorMessage
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
private Message createSyntaxErrorMessage(String message, ASTNode node) {
return new SyntaxErrorMessage(
new SyntaxException(message, node.getLineNumber(), node.getColumnNumber(),
node.getLastLineNumber(), node.getLastColumnNumber()),
getSourceUnit());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:DependencyManagementBomTransformation.java
示例13: handleMalformedDependency
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
private void handleMalformedDependency(Expression expression) {
Message message = createSyntaxErrorMessage(
"The string must be of the form \"group:module:version\"\n", expression);
getSourceUnit().getErrorCollector().addErrorAndContinue(message);
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:6,代码来源:DependencyManagementBomTransformation.java
示例14: addFatalError
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
/**
* Adds a fatal exception to the message set and throws
* the unit as a PhaseFailedException.
*/
public void addFatalError(Message message) throws CompilationFailedException {
addError(message);
failIfErrors();
}
开发者ID:apache,项目名称:groovy,代码行数:9,代码来源:ErrorCollector.java
示例15: getLastError
import org.codehaus.groovy.control.messages.Message; //导入依赖的package包/类
/**
* Returns the last error reported
*/
public Message getLastError() {
return (Message) this.errors.getLast();
}
开发者ID:apache,项目名称:groovy,代码行数:7,代码来源:ErrorCollector.java
注:本文中的org.codehaus.groovy.control.messages.Message类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论