Search in sources :

Example 76 with CouldntSaveDataException

use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.

the class TraceList method setName.

public void setName(final String name) throws CouldntSaveDataException {
    Preconditions.checkNotNull(name, "IE00784: Name can not be null");
    if (traceName.equals(name)) {
        return;
    }
    sqlProvider.setName(this, name);
    traceName = name;
    for (final ITraceListListener listener : listeners) {
        try {
            listener.changedName(this);
        } catch (final Exception exception) {
            CUtilityFunctions.logException(exception);
        }
    }
}
Also used : ITraceListListener(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListListener) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)

Example 77 with CouldntSaveDataException

use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.

the class TraceList method setDescription.

public void setDescription(final String description) throws CouldntSaveDataException {
    Preconditions.checkNotNull(description, "IE00783: Comment can not be null");
    if (traceDescription.equals(description)) {
        return;
    }
    sqlProvider.setDescription(this, description);
    traceDescription = description;
    for (final ITraceListListener listener : listeners) {
        try {
            listener.changedDescription(this);
        } catch (final Exception exception) {
            CUtilityFunctions.logException(exception);
        }
    }
}
Also used : ITraceListListener(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListListener) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)

Example 78 with CouldntSaveDataException

use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.

the class DebuggerTemplate method setPort.

/**
   * Updates the port of the debug client.
   *
   * @param port The new debug client port.
   *
   * @throws CouldntSaveDataException Thrown if the port could not be updated.
   */
public void setPort(final int port) throws CouldntSaveDataException {
    Preconditions.checkArgument(NetHelpers.isValidPort(port), "IE00804: Invalid port");
    if (debugClientPort == port) {
        return;
    }
    sqlProvider.setPort(this, port);
    debugClientPort = port;
    for (final IDebuggerTemplateListener listener : listeners) {
        try {
            listener.changedPort(this);
        } catch (final Exception e) {
            CUtilityFunctions.logException(e);
        }
    }
}
Also used : IDebuggerTemplateListener(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebuggerTemplateListener) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)

Example 79 with CouldntSaveDataException

use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.

the class DebuggerTemplate method setHost.

/**
   * Sets the host of the debug client.
   *
   * @param host The host of the debug client.
   *
   * @throws CouldntSaveDataException Thrown if the debug host could not be updated.
   */
public void setHost(final String host) throws CouldntSaveDataException {
    Preconditions.checkNotNull(host, "IE00802: Host argument can not be null");
    if (debugClientHost.equals(host)) {
        return;
    }
    sqlProvider.setHost(this, host);
    debugClientHost = host;
    for (final IDebuggerTemplateListener listener : listeners) {
        try {
            listener.changedHost(this);
        } catch (final Exception e) {
            CUtilityFunctions.logException(e);
        }
    }
}
Also used : IDebuggerTemplateListener(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebuggerTemplateListener) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)

Example 80 with CouldntSaveDataException

use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.

the class AbstractModuleCreator method initializeModule.

@Override
public void initializeModule(final SQLProvider sqlProvider, final INaviModule module, final CModuleInitializeReporter reporter) throws CouldntSaveDataException {
    final int moduleId = module.getConfiguration().getId();
    final INaviRawModule rawModule = module.getConfiguration().getRawModule();
    if (!rawModule.isComplete()) {
        throw new CouldntSaveDataException("E00008: Raw module is incomplete");
    }
    try {
        reporter.report(ModuleInitializeEvents.Starting);
        final String query = " { call import(?,?,?) } ";
        final CallableStatement call = getProvider().getConnection().getConnection().prepareCall(query);
        call.setInt(1, rawModule.getId());
        call.setInt(2, moduleId);
        call.setInt(3, CUserManager.get(getProvider()).getCurrentActiveUser().getUserId());
        call.execute();
        module.setInitialized();
    } catch (final SQLException exception) {
        throw new CouldntSaveDataException(exception);
    } finally {
        reporter.report(ModuleInitializeEvents.Finished);
    }
}
Also used : INaviRawModule(com.google.security.zynamics.binnavi.disassembly.INaviRawModule) SQLException(java.sql.SQLException) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CallableStatement(java.sql.CallableStatement)

Aggregations

CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)133 SQLException (java.sql.SQLException)71 PreparedStatement (java.sql.PreparedStatement)38 CConnection (com.google.security.zynamics.binnavi.Database.CConnection)35 CallableStatement (java.sql.CallableStatement)20 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)17 CouldntDeleteException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException)13 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)10 CDefaultProgressOperation (com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation)10 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)9 ArrayList (java.util.ArrayList)9 MaybeNullException (com.google.security.zynamics.binnavi.Exceptions.MaybeNullException)8 CComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment)8 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)8 BigInteger (java.math.BigInteger)8 Connection (java.sql.Connection)8 ResultSet (java.sql.ResultSet)8 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)7 LoadCancelledException (com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)6 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)5