Skip to content

Commit 95b2dbb

Browse files
Code changes for behavious of plugin when empty scan id is entered (AST-83148) (#212)
* Code changes for behavious of plugin when empty scan id is entered * Resolved SCA vulnerability * changes for empty scan id
1 parent 3cc7870 commit 95b2dbb

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/utils/PluginConstants.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public class PluginConstants {
5353
/******************************** TREE MESSAGES ********************************/
5454
public static final String TREE_INVALID_SCAN_ID_FORMAT = "Invalid scan id format.";
5555
public static final String TREE_NO_RESULTS = "No results.";
56+
public static final String NO_SCAN_ID_PROVIDED = "No scan id provided.";
5657

5758
/******************************** PREFERENCES ********************************/
5859
public static final String PREFERENCES_API_KEY = "API key:";
@@ -133,4 +134,4 @@ public class PluginConstants {
133134
public static final String CX_PROJECT_MISMATCH = "Project mismatch";
134135
public static final String CX_PROJECT_MISMATCH_QUESTION = "The files open in your workspace don't match the files previously scanned in this Checkmarx project. Do you want to scan anyway?";
135136
public static final String CX_REFRESHING_TOOLBAR = "Checkmarx: Refreshing toolbar...";
136-
}
137+
}

checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/utils/PluginUtils.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ public static void showMessage(DisplayModel rootModel, TreeViewer viewer, String
132132
viewer.refresh();
133133
}
134134

135+
136+
/**
137+
* Clear message in the tree
138+
*
139+
*/
140+
public static void clearMessage(DisplayModel rootModel,TreeViewer viewer) {
141+
rootModel.children.clear();
142+
viewer.refresh();
143+
}
144+
135145
/**
136146
* Get Event Broker
137147
*
@@ -260,4 +270,4 @@ public static void clearVulnerabilitiesFromProblemsView() {
260270
CxLogger.error(String.format(PluginConstants.ERROR_FINDING_OR_DELETING_MARKER, e.getMessage()), e);
261271
}
262272
}
263-
}
273+
}

checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/views/CheckmarxView.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,12 @@ private Scan getLatestScanFromScanList(List<Scan> scanList) {
11141114
*/
11151115
private void setSelectionForProjectComboViewer() {
11161116
String scanId = scanIdComboViewer.getCombo().getText();
1117+
1118+
if(scanId.isEmpty()) {
1119+
PluginUtils.clearMessage(rootModel, resultsTree);
1120+
CxLogger.info(String.format(PluginConstants.NO_SCAN_ID_PROVIDED, scanId));
1121+
return;
1122+
}
11171123

11181124
if (currentScanId.equals(scanId)) {
11191125
PluginUtils.setTextForComboViewer(scanIdComboViewer, currentScanIdFormmated);
@@ -2681,4 +2687,4 @@ private void updateStartScanButton(boolean enabled) {
26812687
toolBarActions.getStartScanAction().setEnabled(false);
26822688
}
26832689
}
2684-
}
2690+
}

0 commit comments

Comments
 (0)