本文整理汇总了Java中com.google.caja.reporting.MessageLevel.WARNING属性的典型用法代码示例。如果您正苦于以下问题:Java MessageLevel.WARNING属性的具体用法?Java MessageLevel.WARNING怎么用?Java MessageLevel.WARNING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.caja.reporting.MessageLevel
的用法示例。
在下文中一共展示了MessageLevel.WARNING属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseImpl
private CssTree.StyleSheet parseImpl(String css) throws ParseException {
InputSource inputSource = new InputSource(FAKE_SOURCE);
CharProducer producer = CharProducer.Factory.create(new StringReader(css),
inputSource);
TokenStream<CssTokenType> lexer = new CssLexer(producer);
TokenQueue<CssTokenType> queue = new TokenQueue<CssTokenType>(lexer, inputSource,
new Criterion<Token<CssTokenType>>() {
public boolean accept(Token<CssTokenType> t) {
return CssTokenType.SPACE != t.type
&& CssTokenType.COMMENT != t.type;
}
});
if (queue.isEmpty()) {
// Return empty stylesheet
return new CssTree.StyleSheet(null, Collections.<CssTree.CssStatement>emptyList());
}
MessageQueue mq = new SimpleMessageQueue();
CssParser parser = new CssParser(queue, mq, MessageLevel.WARNING);
return parser.parseStyleSheet();
}
示例2: compile
private static PluginCompiler compile(Dom htmlDom, CompilerResult result_out, PluginMeta meta, HtmlSchema schema, MessageQueue messageQueue)
{
PluginCompiler compiler = new PluginCompiler(BuildInfo.getInstance(), meta, messageQueue);
compiler.setHtmlSchema(schema);
try
{
compiler.addInput(htmlDom, new URI(""));
}
catch (URISyntaxException e)
{
s_logger.log(Level.SEVERE, "", e);
result_out.onFailure(E_CompilationStatus.COMPILER_EXCEPTION);
return null;
}
boolean successfulCompile = compiler.run();
boolean foundErrorsInMessageQueue = false;
MessageLevel lowestReportingLevel = MessageLevel.FATAL_ERROR;
MessageLevel highestAllowableLevel = MessageLevel.WARNING;
List<Message> messages = messageQueue.getMessages();
for( int i = 0; i < messages.size(); i++ )
{
Message message = messages.get(i);
if( message.getMessageLevel().ordinal() >= lowestReportingLevel.ordinal() )
{
CompilerMessage compilerError = createMessage(message);
result_out.addMessage(compilerError);
if( message.getMessageLevel().ordinal() > highestAllowableLevel.ordinal() )
{
foundErrorsInMessageQueue = true;
}
}
//s_logger.severe(message.getMessageLevel() + ": " + message.toString());
}
if( !foundErrorsInMessageQueue )
{
if( successfulCompile )
{
return compiler;
}
else
{
s_logger.severe("Compiler::run() failed, but no error messages were found.");
result_out.onFailure(E_CompilationStatus.COMPILER_EXCEPTION);
}
}
else
{
// result has compiler errors inside already.
}
return null;
}