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, problem in a List #1143

Closed
efwalter opened this issue Aug 3, 2023 · 4 comments
Closed

[BUG] ClassCastException, problem in a List #1143

efwalter opened this issue Aug 3, 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 Aug 3, 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.DefaultVertex cannot be cast to class com.salesforce.graph.vertex.VariableExpressionVertex (com.salesforce.graph.vertex.DefaultVertex and com.salesforce.graph.vertex.VariableExpressionVertex are in unnamed module of loader 'app'): com.salesforce.graph.vertex.AssignmentExpressionVertex.getLhs(AssignmentExpressionVertex.java:70);com.salesforce.graph.symbols.PathScopeVisitor.visit(PathScopeVisitor.java:719);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.visit(DefaultSymbolProviderVertexVisitor.java:309);com.salesforce.graph.vertex.AssignmentExpressionVertex.visit(AssignmentExpressionVertex.java:27);com.salesforce.graph.ops.expander.ApexPathExpander.shouldVisitChildren(ApexPathExpander.java:573);com.salesforce.graph.ops.expander.ApexPathExpander.lambda$visit$1(ApexPathExpander.java:519)

To Reproduce
Running the scanner in a class is causing a issue in the following line:
sFields[10] = fieldlist.get(sAlias + 'ProcessAddress').Field_Name__c;
the problem is in the left part of the code in the sFields[10]

Desktop:

  • OS: macOS Ventura 13.4.1 (c)
  • Scanner Version 3.13.0

Additional context

"Workaround":

"Urgency":

@jfeingold35
Copy link
Collaborator

@efwalter , can you please post a more complete code snippet? It'll be hard for us to reproduce this one without knowing what sFields is supposed to be.

@efwalter
Copy link
Author

efwalter commented Aug 4, 2023

Sure:

    for (CustomObject__c x : CustomSettings.getall().values()) {
            List<String> sFields = new List<String> ();
            
            String sAlias = x.NAMESPACE__Alias__c;
            String sNameSpace = x.NAMESPACE__Namespace__c;

           .....hidden content ....

            if (fieldlist.containskey(sAlias + 'ProcessAddress') && sFields != null && sFields.size()>10) {
                sFields[10] = fieldlist.get(sAlias + 'ProcessAddress').NAMESPACE__Field_Name__c;
            }

@johnbelosf johnbelosf added the BUG P3 Rarely Malfunction label Feb 20, 2024
Copy link

git2gus bot commented Feb 20, 2024

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

@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

4 participants