use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.
the class AbstractModuleCreator method createModule.
@Override
public CModule createModule(final SQLProvider provider, final INaviRawModule rawModule) throws CouldntLoadDataException, CouldntSaveDataException {
NaviLogger.info("Starting to convert raw module %s", rawModule.getName());
int moduleId = -1;
try {
// 1. Create the module in the database
NaviLogger.info("Creating a new module for raw module %s", rawModule.getName());
moduleId = createNewModule(rawModule);
} catch (final SQLException exception) {
throw new CouldntSaveDataException(exception);
}
// If the import process was successful we can load the module.
NaviLogger.info("Loading module %d", moduleId);
return readModule(moduleId, rawModule, provider);
}
use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.
the class CTraceCombinationFunctions method unionizeTraces.
/**
* Creates a new trace that contains those events that appear in any of the input traces.
*
* @param parent Parent window used for dialogs.
* @param provider Creates the new trace.
* @param traces The input traces.
*/
public static void unionizeTraces(final JFrame parent, final ITraceListProvider provider, final List<TraceList> traces) {
new Thread() {
@Override
public void run() {
try {
final CDefaultProgressOperation operation = new CDefaultProgressOperation("", false, false);
operation.getProgressPanel().setMaximum(3);
operation.getProgressPanel().setText("Combining traces");
final TraceList newTrace = provider.createTrace("Combined Trace", "");
operation.next();
createCombinedTrace(newTrace, traces, getUnionizedAddresses(traces));
operation.next();
newTrace.save();
operation.next();
operation.stop();
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00197: " + "Could not combine debug traces";
final String innerDescription = CUtilityFunctions.createDescription("The selected traces could not be combined into a larger trace.", new String[] { "There was a problem with the database connection." }, new String[] { "The trace list was not created. You could try to combine the lists again once the connection problem was resolved." });
NaviErrorDialog.show(parent, innerMessage, innerDescription, e);
}
}
}.start();
}
use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.
the class CProjectModulesModel method setValueAt.
@Override
public void setValueAt(final Object value, final int row, final int col) {
if ((col != NAME_COLUMN) && (col != DESCRIPTION_COLUMN)) {
throw new IllegalStateException("IE01161: Column can not be edited");
}
final INaviModule module = getModules().get(row);
if (col == NAME_COLUMN) {
try {
module.getConfiguration().setName((String) value);
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00156: " + "Could not save address space name";
final String innerDescription = CUtilityFunctions.createDescription(String.format("The new name of the address space '%s' could not be saved.", m_addressSpace.getConfiguration().getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The address space keeps its old name." });
NaviErrorDialog.show(null, innerMessage, innerDescription, e);
}
} else if (col == DESCRIPTION_COLUMN) {
try {
module.getConfiguration().setDescription((String) value);
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00157: " + "Could not save address space description";
final String innerDescription = CUtilityFunctions.createDescription(String.format("The new description of the address space '%s' could not be saved.", m_addressSpace.getConfiguration().getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The address space keeps its old description." });
NaviErrorDialog.show(null, innerMessage, innerDescription, e);
}
}
}
use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.
the class CAddressSpaceFunctions method addModule.
/**
* Adds a module to an address space.
*
* @param parent Parent window used to display dialogs.
* @param addressSpace The address space where the module is added.
* @param module The module that is added to the address space.
*/
public static void addModule(final JFrame parent, final INaviAddressSpace addressSpace, final INaviModule module) {
if (CMessageBox.showYesNoQuestion(parent, String.format("Do you really want to add the module '%s' to the address space '%s'?", module.getConfiguration().getName(), addressSpace.getConfiguration().getName())) == JOptionPane.YES_OPTION) {
new Thread() {
@Override
public void run() {
final CDefaultProgressOperation operation = new CDefaultProgressOperation("Adding modules to address space", false, true);
operation.getProgressPanel().setMaximum(1);
operation.getProgressPanel().setText("Adding module to address space" + ": '" + module.getConfiguration().getName() + "'");
try {
addressSpace.getContent().addModule(module);
} catch (final CouldntSaveDataException exception) {
CUtilityFunctions.logException(exception);
final String message = "E00026: " + "Module could not be added to address space";
final String description = CUtilityFunctions.createDescription(String.format("The module '%s' could not be added to the address space '%s'. Try adding the module to the address space again. If the problem persists, disconnect from and reconnect to the database, restart com.google.security.zynamics.binnavi, or contact the BinNavi support.", module.getConfiguration().getName(), addressSpace.getConfiguration().getName()), new String[] { "Database connection problems." }, new String[] { "The address space remains unchanged." });
NaviErrorDialog.show(parent, message, description, exception);
}
operation.stop();
}
}.start();
}
}
use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.
the class CAddressSpaceFunctions method removeModules.
/**
* Removes a module from an address space.
*
* @param parent Parent window used to display dialogs.
* @param addressSpace The address space the module belongs to.
* @param modules The modules to be removed from the address space.
*/
public static void removeModules(final JFrame parent, final INaviAddressSpace addressSpace, final INaviModule[] modules) {
new Thread() {
@Override
public void run() {
if (CMessageBox.showYesNoQuestion(parent, String.format("Do you really want to remove the following modules from the address space?\n\n%s", CNameListGenerators.getNameList(modules))) == JOptionPane.YES_OPTION) {
final CDefaultProgressOperation operation = new CDefaultProgressOperation("Removing modules from address space", false, true);
operation.getProgressPanel().setMaximum(modules.length);
for (final INaviModule module : modules) {
operation.getProgressPanel().setText("Removing modules from address space" + ": '" + module.getConfiguration().getName() + "'");
try {
addressSpace.getContent().removeModule(module);
} catch (final CouldntDeleteException exception) {
CUtilityFunctions.logException(exception);
final String message = "E00027: " + "Module could not be removed from address space";
final String description = CUtilityFunctions.createDescription(String.format("The module '%s' could not be removed from the address space '%s'. Try removing the module from the address space again. If the problem persists, disconnect from and reconnect to the database, restart com.google.security.zynamics.binnavi, or contact the BinNavi support.", module.getConfiguration().getName(), addressSpace.getConfiguration().getName()), new String[] { "Database connection problems." }, new String[] { "The address space remains unchanged." });
NaviErrorDialog.show(parent, message, description, exception);
} catch (final CouldntSaveDataException exception) {
CUtilityFunctions.logException(exception);
}
operation.getProgressPanel().next();
}
operation.stop();
}
}
}.start();
}
Aggregations