Skip to content

Commit

Permalink
Display message on successful/failed ZAP import
Browse files Browse the repository at this point in the history
  • Loading branch information
CoreyD97 committed Dec 5, 2023
1 parent 589e5f5 commit b630d53
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Expand Up @@ -67,6 +67,7 @@ protected void done() {

} catch (Exception e) {
// Cancelled.
log.error(e);
}
}

Expand Down
Expand Up @@ -257,6 +257,7 @@ public static ArrayList<HttpRequestResponse> importFromExportedJson() {
return requests;
}

//TODO Integrate progress bar with SwingWorkerWithProgressDialog
public static boolean loadImported(ArrayList<HttpRequestResponse> requests, Boolean sendToAutoExporters) {
EntryImportWorker importWorker = LoggerPlusPlus.instance.getLogProcessor().createEntryImportBuilder()
.setOriginatingTool(ToolType.EXTENSIONS)
Expand Down
Expand Up @@ -202,7 +202,13 @@ public void actionPerformed(ActionEvent e) {
importGroup.add(new JButton(new AbstractAction("Import From OWASP ZAP") {
@Override
public void actionPerformed(ActionEvent e) {
ArrayList<HttpRequestResponse> requests = LoggerImport.importZAP();
ArrayList<HttpRequestResponse> requests;
try{
requests = LoggerImport.importZAP();
} catch (Exception ex){
JOptionPane.showMessageDialog(LoggerPlusPlus.instance.getLoggerFrame(), "Could not import ZAP entries. Exception: \n" + ex.getMessage(), "ZAP Import Failed", JOptionPane.ERROR_MESSAGE);
return;
}

if (LoggerPlusPlus.instance.getExportController().getEnabledExporters().size() > 0) {
int res = JOptionPane.showConfirmDialog(LoggerPlusPlus.instance.getLoggerFrame(),
Expand All @@ -213,6 +219,8 @@ public void actionPerformed(ActionEvent e) {
} else {
LoggerImport.loadImported(requests, false);
}

JOptionPane.showMessageDialog(LoggerPlusPlus.instance.getLoggerFrame(), requests.size() + " ZAP entries imported successfully", "ZAP Import", JOptionPane.INFORMATION_MESSAGE);
}
}));

Expand Down

0 comments on commit b630d53

Please sign in to comment.