use of org.parosproxy.paros.db.DatabaseException in project zaproxy by zaproxy.
the class SearchAPI method search.
private void search(JSONObject params, ExtensionSearch.Type searchType, SearchResultsProcessor processor) throws InterruptedException {
ApiSearchListener searchListener = new ApiSearchListener();
// The search kicks off a background thread
extension.search(params.getString(PARAM_REGEX), searchListener, searchType, false, false, this.getParam(params, PARAM_BASE_URL, (String) null), this.getParam(params, PARAM_START, -1), this.getParam(params, PARAM_COUNT, -1), false);
while (!searchListener.isSearchComplete()) {
Thread.sleep(100);
}
TableHistory tableHistory = Model.getSingleton().getDb().getTableHistory();
for (Integer hRefId : searchListener.getHistoryReferencesIds()) {
try {
processor.processRecordHistory(tableHistory.read(hRefId.intValue()));
} catch (DatabaseException | HttpMalformedHeaderException e) {
log.error(e.getMessage(), e);
}
}
}
use of org.parosproxy.paros.db.DatabaseException in project zaproxy by zaproxy.
the class ExtensionHistory method searchHistory.
private void searchHistory(HistoryFilter historyFilter) {
Session session = getModel().getSession();
synchronized (historyTableModel) {
try {
// ZAP: Added type argument.
List<Integer> list = getModel().getDb().getTableHistory().getHistoryIdsOfHistType(session.getSessionId(), HistoryReference.TYPE_PROXIED, HistoryReference.TYPE_ZAP_USER, HistoryReference.TYPE_PROXY_CONNECT);
buildHistory(list, historyFilter);
} catch (DatabaseException e) {
logger.error(e.getMessage(), e);
}
}
}
use of org.parosproxy.paros.db.DatabaseException in project zaproxy by zaproxy.
the class ExtensionHistory method showFilterPlusDialog.
protected int showFilterPlusDialog() {
HistoryFilterPlusDialog dialog = getFilterPlusDialog();
dialog.setModal(true);
try {
dialog.setAllTags(getModel().getDb().getTableTag().getAllTags());
} catch (DatabaseException e) {
logger.error(e.getMessage(), e);
}
int exit = dialog.showDialog();
// cancel, state unchanged
int result = 0;
HistoryFilter historyFilter = dialog.getFilter();
if (exit == JOptionPane.OK_OPTION) {
searchHistory(historyFilter);
logPanel.setFilterStatus(historyFilter);
// applied
result = 1;
} else if (exit == JOptionPane.NO_OPTION) {
searchHistory(historyFilter);
logPanel.setFilterStatus(historyFilter);
// reset
result = -1;
}
return result;
}
use of org.parosproxy.paros.db.DatabaseException in project zaproxy by zaproxy.
the class ParosTableTag method delete.
/* (non-Javadoc)
* @see org.parosproxy.paros.db.paros.TableTag#delete(long, java.lang.String)
*/
@Override
public synchronized void delete(long historyId, String tag) throws DatabaseException {
try {
psDeleteTag.setLong(1, historyId);
psDeleteTag.setString(2, tag);
psDeleteTag.executeUpdate();
} catch (SQLException e) {
throw new DatabaseException(e);
}
}
use of org.parosproxy.paros.db.DatabaseException in project zaproxy by zaproxy.
the class ParosTableTag method deleteTagsForHistoryID.
/* (non-Javadoc)
* @see org.parosproxy.paros.db.paros.TableTag#deleteTagsForHistoryID(long)
*/
@Override
public synchronized void deleteTagsForHistoryID(long historyId) throws DatabaseException {
try {
psDeleteTagsForHistoryId.setLong(1, historyId);
psDeleteTagsForHistoryId.execute();
} catch (SQLException e) {
throw new DatabaseException(e);
}
}
Aggregations