Closed Kaushal1829 closed 5 months ago
hi @Kaushal1829 - thanks for this. You need to use the "Report a Bug with scanner run dfa" to report issues related with Graph Engine. Can you please update this accordingly? Thank you.
@johnbelosf I use the same "Report a Bug with scanner run dfa" to report issue related with Graph Engine
@Kaushal1829 you need to follow the troubleshooting steps and then use the template provided
@johnbelosf I have updated the scenario and troubleshooting steps did I miss something please let me know ill update
Error while creating work item!
Error while creating work item!
This issue has been linked to a new work item: W-15246399
Marking this as a duplicate of https://github.com/forcedotcom/sfdx-scanner/issues/1497
CodeAnalyzerDFA-Feb15a.csv
I have been facing this issue did not get any resolution please help someone:
Graph Engine identified your source and sink, but you must manually verify that you have a sanitizer in this path. Then, add an engine directive to skip the path. Next, create a Github issue for the Code Analyzer team that includes the error and stack trace. After we fix this issue, check the Code Analyzer release notes for more info. Error and stacktrace: UnexpectedException: ArrayLoadExpression{properties={FirstChild=true, BeginLine=704, DefiningType_CaseSafe=visualizationscontroller, LastChild=true, DefiningType=VisualizationsController, EndLine=704, childIdx=0, BeginColumn=55}}: com.salesforce.graph.symbols.PathScopeVisitor.afterVisit(PathScopeVisitor.java:761);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.afterVisit(DefaultSymbolProviderVertexVisitor.java:737);com.salesforce.graph.vertex.ArrayLoadExpressionVertex.afterVisit(ArrayLoadExpressionVertex.java:58);com.salesforce.graph.ops.expander.ApexPathExpander.performAfterVisit(ApexPathExpander.java:577);com.salesforce.graph.ops.expander.ApexPathExpander.visit(ApexPathExpander.java:536);com.salesforce.graph.ops.expander.ApexPathExpander.visit(ApexPathExpander.java:523)
For reference, I am sharing one class and method where I am facing an internal execution error :
Facing the issue on below methods:
Especially can check in this method, private Date getStartDate() mentioned in error line 704 can see the below query
else if(String.valueOf(objectId.getSObjectType()) == LEADVAR){ returnStartDate = ((DateTime) [SELECT MIN(Response_Completed_Datec) FROM Survey_Response__c WHERE Lead_Idc = :objectId and Survey_Id__c = :surveyId][0].get('expr0')).date();
setAverageCountVisible getStartMonth getStartDay getStartYear validateFilter identifyAvailableTrends getSurveyConfig applyFilters getColorSet prepareChartsJSON getTimeTrendOptions QuarterData getSurveyList
public void applyFilters(){ if(this.validateFilter()){ //Validate input parameters before proceeding if(surveyId.equalsIgnoreCase(SURVEY_NONE)){ hasError = true; ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,Label.No +SPACE_STRING+ Label.data_available)); } else { //Set Response SOQL start and end filters sd = DateTime.newInstanceGMT(selectedStartDate, Time.newInstance(0,0,0,0)).addSeconds(-timeOffset/1000); ed = DateTime.newInstanceGMT(selectedEndDate.addDays(1), Time.newInstance(0,0,0,0)).addSeconds(-timeOffset/1000); numberOfResponses = 0; try{ survey = Selectors.getKMSurveyDetailsById(new Set{surveyId}, String.valueOf(objectId.getSObjectType()).toLowerCase()).get(surveyId);
public void QuarterData(){ Set filteredKMModels = filterKMModels(CHART_TYPE_BAR);
private Date getStartDate() { Date returnStartDate = fetchStartDate(); if(returnStartDate == NULL_DATE) { try{ if(!SURVEY_NONE.equalsIgnoreCase(surveyId)){ if(String.valueOf(objectId.getSObjectType()) == ACCOUNTVAR){ returnStartDate = ((DateTime) [SELECT MIN(Response_Completed_Datec) FROM Survey_Responsec WHERE Accountc = :objectId and Survey_Idc = :surveyId][0].get('expr0')).date(); } else if(String.valueOf(objectId.getSObjectType()) == CONTACTVAR){ returnStartDate = ((DateTime) [SELECT MIN(Response_Completed_Datec) FROM Survey_Response__c WHERE Contact_Idc = :objectId and Survey_Idc = :surveyId][0].get('expr0')).date(); } else if(String.valueOf(objectId.getSObjectType()) == LEADVAR){ returnStartDate = ((DateTime) [SELECT MIN(Response_Completed_Datec) FROM Survey_Responsec WHERE Lead_Id__c = :objectId and Survey_Idc = :surveyId][0].get('expr0')).date(); } } } catch(NullPointerException ex){ //this exceptions occurs if no response is present for that survey //handled in ui - survey with no responses are not visible in picklist } } returnStartDate = returnStartDate == NULL_DATE ? Date.newInstance(2015,1,1) : returnStartDate; return returnStartDate;
Steps To Reproduce: I ran the following scanner: sf scanner run dfa --format=csv --outfile=CodeAnalyzerDFA-Feb15a.csv --target="./" --projectdir="./" --category="Security"
Desktop: Provide these details:
Operating System: Windows11 Code Analyzer version: v3.20.0 Salesforce CLI version: @salesforce/cli/2.30.8 win32-x64 node-v20.11.1 Additional Context:
Workaround: Tried to run the dfA scanner commend and got the issue like Unexpected exception only did not find the exact solution i have methods and class where got the issue. After running the code analyzer getting issues in 3 and 4 classes internal execution error
Urgency: High