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


Java BuildEvent.getException方法代码示例

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


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

示例1: messageLogged

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = getLogLevelForMessagePriority(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:AntLoggingAdapter.java

示例2: messageLogged

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:AntLoggingAdapter.java

示例3: targetFinished

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * @see BuildListener#targetFinished
 * {@inheritDoc}.
 */
@Override
public void targetFinished(final BuildEvent event) {
    if (initialized) {
        final String targetName = event.getTarget().getName();
        final Log log = getLog(TARGET_LOG,
                event.getTarget().getName());
        if (event.getException() == null) {
            realLog(log, "Target end: " + targetName, Project.MSG_DEBUG, null);
        } else {
            realLog(log, "Target \"" + targetName
                    + "\" finished with error.", Project.MSG_ERR,
                    event.getException());
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:20,代码来源:CommonsLoggingListener.java

示例4: taskFinished

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * @see BuildListener#taskFinished
 * {@inheritDoc}.
 */
@Override
public void taskFinished(final BuildEvent event) {
    if (initialized) {
        final Task task = event.getTask();
        Object real = task;
        if (task instanceof UnknownElement) {
            final Object realObj = ((UnknownElement) task).getTask();
            if (realObj != null) {
                real = realObj;
            }
        }
        final Log log = getLog(real.getClass().getName(), null);
        if (event.getException() == null) {
            if (log.isTraceEnabled()) {
                realLog(log, "Task \"" + task.getTaskName() + "\" finished.",
                        Project.MSG_VERBOSE, null);
            }
        } else {
            realLog(log, "Task \"" + task.getTaskName()
                    + "\" finished with error.", Project.MSG_ERR,
                    event.getException());
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:29,代码来源:CommonsLoggingListener.java

示例5: buildFinished

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * @see org.apache.tools.ant.BuildListener#buildFinished(BuildEvent)
 * {@inheritDoc}.
 */
public void buildFinished(BuildEvent event) {
    log("< BUILD FINISHED", Project.MSG_DEBUG);

    if (record && out != null) {
        Throwable error = event.getException();

        if (error == null) {
            out.println(StringUtils.LINE_SEP + "BUILD SUCCESSFUL");
        } else {
            out.println(StringUtils.LINE_SEP + "BUILD FAILED"
                        + StringUtils.LINE_SEP);
            error.printStackTrace(out); //NOSONAR
        }
    }
    cleanup();
}
 
开发者ID:apache,项目名称:ant,代码行数:21,代码来源:RecorderEntry.java

示例6: stopTimer

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * stops the timer and stores the result as a project reference by the key 'referenceName'
 */
private void stopTimer(BuildEvent event) {
    List<ExecutionResult> results = event.getProject().getReference(EXECUTION_TIMER_BUILD_RESULTS);
    ExecutionStatus status = ExecutionStatus.SUCCESS;
    if (event.getException() != null) {
        status = ExecutionStatus.FAILED;
    } else if (event.getProject().getProperty(EasyAntMagicNames.PROJECT_EXECUTED_TARGETS) == null) {
        status = ExecutionStatus.SKIPPED;
    }

    ExecutionResult execResult = new ExecutionResult(event.getProject().getName(), System.currentTimeMillis()
            - buildStartTime, status);

    results.add(execResult);

}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:19,代码来源:MultiModuleLogger.java

示例7: messageLogged

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public synchronized void messageLogged(BuildEvent event)
{
	Throwable ex = event.getException();
	int level = event.getPriority();
	if (level <= Project.MSG_WARN || ex != null)
	{
		if (level == Project.MSG_ERR || ex != null)
		{
			this.out.append("Error:").appendln();
		}
		else
		{
			this.out.append("Warn:").appendln();
		}
		this.out.append(event.getMessage());
		if (ex != null)
		{
			this.out.appendln().append("Exception:").appendln();
			StringTool.appendStackTrace(ex, this.out);
		}
		this.out.appendln();
	}
}
 
开发者ID:micromagic,项目名称:eterna,代码行数:24,代码来源:AntCG.java

示例8: Event

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * Create a new regular event.
 * @param e the Ant build event
 * @param msgLogged true for logged events
 */
public Event(BuildEvent e, boolean msgLogged) {
    this.e = e;
    exception = e.getException();
    if (msgLogged) {
        level = e.getPriority();
    } else {
        level = -1;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:NbBuildLogger.java

示例9: taskFinished

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/**
 * Set status message appropriately when task completes or fails.
 */
@Override
public void taskFinished(BuildEvent buildEvent) {
  if(buildEvent.getException() != null) {
    statusChanged("Error exporting application");
  }
  else {
    statusChanged("Export complete");
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:13,代码来源:NameBearerHandle.java

示例10: sendException

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
private boolean sendException(BuildEvent event, boolean isFailOnError) {
    Throwable exception = event.getException();
    if (exception != null) {
        if (isFailOnError && !isInTryCatch()) {
            myAlwaysSend.sendMessage(EXCEPTION, event.getPriority(), exception);
            return true;
        }
        myMessagePriority.sendMessage(
            MESSAGE,
            isInTryCatch() ? Project.MSG_VERBOSE : Project.MSG_WARN,
            exception.getMessage()
        );
    }
    return false;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:16,代码来源:HybrisIdeaAntLogger.java

示例11: taskFinished

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
@Override
public void taskFinished(BuildEvent event) {
    if (tasks.peek() == Task.ROOT) {
        //we need to 'close' the root task to get nicer output
        logger.taskFinished(event);
    } else if (!suppressTaskFailures && event.getException() != null) {
        //the first (innermost) task failure should always be logged
        event.setMessage(event.getException().toString(), 0);
        event.setException(null);
        //note: we turn this into a plain message to avoid stack trace being logged by Idea
        logger.messageLogged(event);
        suppressTaskFailures = true;
    }
    tasks.pop();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:LangtoolsIdeaAntLogger.java

示例12: sendException

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
private boolean sendException(BuildEvent event, boolean isFailOnError) {
  Throwable exception = event.getException();
  if (exception != null) {
    if (isFailOnError) {
      myAlwaysSend.sendMessage(EXCEPTION, event.getPriority(), exception);
      return true;
    }
    myMessagePriority.sendMessage(MESSAGE, Project.MSG_WARN, exception.getMessage());
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:IdeaAntLogger2.java

示例13: buildFinished

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void buildFinished(final BuildEvent event) {
    if (event.getException() == null) {
        _log.debug("Build finished.");
    } else {
        _log.debug("Build finished.", event.getException());
    }
}
 
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:9,代码来源:Cob2XsdTaskTest.java

示例14: targetFinished

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void targetFinished(final BuildEvent event) {
    _log.debug("targetFinished.");
    if (event.getException() == null) {
        _log.debug("targetFinished " + event.getTarget().getName());
    } else {
        _log.debug("targetFinished " + event.getTarget().getName(),
                event.getException());
    }
}
 
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:11,代码来源:Cob2XsdTaskTest.java

示例15: targetFinished

import org.apache.tools.ant.BuildEvent; //导入方法依赖的package包/类
public void targetFinished(BuildEvent event) {
	if (Thread.currentThread().getThreadGroup() != group)
		return;

	Element myElement = (Element) elementStack.peek();

	String message = event.getMessage();
	if (message != null)
		myElement.setAttribute("message", message);

	Throwable t = event.getException();
	if (t != null) {
		myElement.setAttribute("status", "failure");
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		PrintStream ps = new PrintStream(baos);
		t.printStackTrace(ps);
		ps.flush();
		String errorMessage = t.getMessage();
		String stackTrace = baos.toString();

		Element error = results.createElement("error");
		Element errorMsgElement = results.createElement("message");
		errorMsgElement.appendChild(results.createTextNode(errorMessage));
		Element stackElement = results.createElement("stack");
		stackElement.appendChild(results.createCDATASection(stackTrace));
		error.appendChild(errorMsgElement);
		error.appendChild(stackElement);
		myElement.appendChild(error);
	} else {
		myElement.setAttribute("status", "success");
	}

	elementStack.pop();
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:35,代码来源:ConnectionBuildListener.java


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