Java Code Examples for ghidra.app.util.importer.MessageLog#copyFrom()

The following examples show how to use ghidra.app.util.importer.MessageLog#copyFrom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlLoader.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private boolean doImportWork(final ProgramXmlMgr mgr, final List<Option> options,
		final MessageLog log, Program prog, TaskMonitor monitor,
		final boolean isAddToProgram) throws IOException {
	MessageLog mgrLog = null;
	boolean success = false;
	try {
		XmlProgramOptions xmlOptions = new XmlProgramOptions();
		xmlOptions.setOptions(options);
		xmlOptions.setAddToProgram(isAddToProgram);
		mgrLog = mgr.read(prog, monitor, xmlOptions);
		log.copyFrom(mgrLog);
		success = true;
	}
	catch (Exception e) {
		String message = "(empty)";
		if (mgrLog != null && !"".equals(mgrLog.toString())) {
			message = mgrLog.toString();
		}
		if (log != null && !"".equals(log.toString())) {
			message = log.toString();
		}
		Msg.warn(this, "XML import exception, log: " + message, e);
		throw new IOException(e.getMessage(), e);
	}
	return success;
}
 
Example 2
Source File: AbstractBinaryFormatAnalyzer.java    From ghidra with Apache License 2.0 5 votes vote down vote up
final public boolean added(Program program, AddressSetView set, TaskMonitor monitor,
		MessageLog log) throws CancelledException {

	try {
		return command.applyTo(program, monitor);
	}
	catch (Exception e) {
		log.appendException(e);
		log.setStatus(e.toString());
	}
	finally {
		log.copyFrom(command.getMessages());
	}
	return false;
}