Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
final improvements after manual checking
  • Loading branch information
kerenr-jfrog committed Apr 2, 2025
commit de30f5ab181d049c177d43523d2915094e1112d3
23 changes: 13 additions & 10 deletions bundle/src/main/java/com/jfrog/ide/eclipse/scan/ScanManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class ScanManager {
private JfrogCliDriver cliDriver;
private SarifParser sarifParser;
private AtomicBoolean scanInProgress = new AtomicBoolean(false);
private AtomicBoolean cancellationRequested = new AtomicBoolean(false);

private ScanManager() {
this.iworkspace = ResourcesPlugin.getWorkspace();
Expand All @@ -62,31 +61,32 @@ public void startScan(Composite parent, boolean isDebugLogs) {

// If scan is in progress - do not perform another scan
if (isScanInProgress()) {
// TODO: pop up a window message
Logger.getInstance().info("Previous scan still running...");
log.info("Previous scan still running...");
return;
}

scanInProgress.compareAndSet(false, true);
Comment thread
kerenr-jfrog marked this conversation as resolved.
Outdated
resetIssuesView(IssuesTree.getInstance());

// refresh projects list
this.projects = this.iworkspace.getRoot().getProjects();
projects = iworkspace.getRoot().getProjects();
if (projects.length == 0) {
log.info("No projects to scan.");
}
Comment thread
kerenr-jfrog marked this conversation as resolved.
Outdated

if (isDebugLogs) {
auditEnvVars.put("JFROG_CLI_LOG_LEVEL", "DEBUG");
auditEnvVars.put("CI", "true");
}

for (IProject project : projects) {
scanAndUpdateResults(IssuesTree.getInstance(), parent, isDebugLogs, project, auditEnvVars);
}
}

public void checkCanceled() {
if (monitor != null && monitor.isCanceled()) {
cancellationRequested.set(true);
throw new CancellationException("Xray scan was canceled"); // TODO: pop up a message
throw new CancellationException("Xray scan was canceled");
}
}

Expand Down Expand Up @@ -151,7 +151,7 @@ private ScanRunnable(Composite parent, IssuesTree issuesTree, boolean isDebugLog
@Override
public void run(IProgressMonitor monitor) throws CoreException {
ScanManager.this.monitor = monitor;
if (isDisposed() || monitor.isCanceled()) {
if (isDisposed()) {
return;
Comment thread
kerenr-jfrog marked this conversation as resolved.
}

Expand All @@ -160,13 +160,15 @@ public void run(IProgressMonitor monitor) throws CoreException {
try {
if (project.isOpen()) {
IPath projectPath = project.getLocation();
CommandResults auditResults = cliDriver.runCliAudit(new File(projectPath.toString()), null, "eclipse-plugin", null, envVars);
CommandResults auditResults = cliDriver.runCliAudit(new File(projectPath.toString()), null, CliDriverWrapper.CLIENT_ID_SERVER, null, envVars);
if (!auditResults.isOk()) {
// log the issue to the problems tab
log.error("Audit scan failed with an error: " + auditResults.getErr());
return;
}

checkCanceled();

log.info("Finished audit scan successfully.\n" + auditResults.getRes());
if (isDebugLogs) {
log.debug(auditResults.getErr());
Expand All @@ -178,7 +180,8 @@ public void run(IProgressMonitor monitor) throws CoreException {

// TODO: update issues tree
Comment thread
kerenr-jfrog marked this conversation as resolved.
Comment thread
kerenr-jfrog marked this conversation as resolved.
}

} catch (CancellationException ce) {
log.info(ce.getMessage());
} catch (Exception e) {
CliDriverWrapper.getInstance().showCliError("An error occurred while performing audit scan", e);
} finally {
Expand Down