Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ClassCastException: class com.salesforce.graph.vertex.VariableExpressionVertex$Single cannot be cast to class #1009

Closed
efwalter opened this issue Mar 8, 2023 · 4 comments
Labels
BUG P3 Rarely Malfunction duplicate This issue or pull request already exists SFGE Issues related to the Salesforce Graph Engine

Comments

@efwalter
Copy link

efwalter commented Mar 8, 2023

Describe the bug
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: ClassCastException: class com.salesforce.graph.vertex.VariableExpressionVertex$Single cannot be cast to class com.salesforce.graph.vertex.SoqlExpressionVertex (com.salesforce.graph.vertex.VariableExpressionVertex$Single and com.salesforce.graph.vertex.SoqlExpressionVertex are in unnamed module of loader 'app'): com.salesforce.graph.symbols.apex.system.SObjectAccessDecision.buildSanitizedValue(SObjectAccessDecision.java:171);com.salesforce.graph.symbols.apex.system.SObjectAccessDecision.executeMethod(SObjectAccessDecision.java:112);com.salesforce.graph.symbols.PathScopeVisitor.afterMethodCall(PathScopeVisitor.java:639);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.afterMethodCall(DefaultSymbolProviderVertexVisitor.java:294);com.salesforce.graph.ops.expander.ApexPathExpander.visit(ApexPathExpander.java:648);com.salesforce.graph.ops.expander.ApexPathExpander.visit(ApexPathExpander.java:544)

 SObjectAccessDecision sobjDecision = Security.stripInaccessible( AccessType.READABLE, Database.query( query ) );
 Map<String,Account> mapCategoryAccount = new Map<String,Account>( (List<Account>) sobjDecision.getRecords() );

To Reproduce
On the second line the scanner is throwing the error

Desktop (please complete the following information):

  • Mac OS Ventura 13.1
  • @salesforce/sfdx-scanner 3.10.0
@rmohan20
Copy link
Contributor

@efwalter Thanks for reporting this issue. We'll look into this.
As a workaround, can you try modifying your code to use an intermediary variable like this? This should unblock you for now:

SObjectAccessDecision sobjDecision = Security.stripInaccessible( AccessType.READABLE, Database.query( query ) );
List<Account> categoryAcctList = sobjDecision.getRecords();
Map<String,Account> mapCategoryAccount = new Map<String,Account>( categoryAcctList );

@rmohan20 rmohan20 added the BUG P3 Rarely Malfunction label Mar 10, 2023
@git2gus
Copy link

git2gus bot commented Mar 10, 2023

This issue has been linked to a new work item: W-12672792

@efwalter
Copy link
Author

the error still persist @rmohan20

@stephen-carter-at-sf stephen-carter-at-sf added the SFGE Issues related to the Salesforce Graph Engine label May 23, 2024
@stephen-carter-at-sf stephen-carter-at-sf added the duplicate This issue or pull request already exists label Jun 3, 2024
@stephen-carter-at-sf
Copy link
Collaborator

Marking this as a duplicate of #1497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG P3 Rarely Malfunction duplicate This issue or pull request already exists SFGE Issues related to the Salesforce Graph Engine
Projects
None yet
Development

No branches or pull requests

3 participants