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] InternalExecutionError on Standard Salesforce methods #1409

Closed
jaelee125 opened this issue Mar 20, 2024 · 4 comments
Closed

[BUG] InternalExecutionError on Standard Salesforce methods #1409

jaelee125 opened this issue Mar 20, 2024 · 4 comments
Labels
duplicate This issue or pull request already exists

Comments

@jaelee125
Copy link

jaelee125 commented Mar 20, 2024

Decimal.setScale method is causing InternalExecution Error

Double value = Decimal.valueOf(Double.valueOf(fieldValue)).setScale(scale);

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: MethodCallExpressionVertex{fullMethodName=setScale, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, BeginLine=1453, DefiningType_CaseSafe=sn_networkcontroller, LastChild=false, DefiningType=SN_NetworkController, EndLine=1453, Name_CaseSafe=, childIdx=0, BeginColumn=65, ReferenceType=METHOD, Name=}}}, chainedNames=[], properties={FirstChild=true, FullMethodName=setScale, BeginLine=1453, FullMethodName_CaseSafe=setscale, DefiningType_CaseSafe=sn_networkcontroller, LastChild=false, DefiningType=SN_NetworkController, EndLine=1453, MethodName_CaseSafe=setscale, childIdx=0, BeginColumn=65, MethodName=setScale}}: com.salesforce.graph.symbols.apex.ApexSimpleValue.apply(ApexSimpleValue.java:55);com.salesforce.graph.symbols.apex.ApexNumberValue.apply(ApexNumberValue.java:42);com.salesforce.graph.symbols.apex.ApexDecimalValue.apply(ApexDecimalValue.java:49);com.salesforce.graph.symbols.PathScopeVisitor.handleApexValueMethod(PathScopeVisitor.java:1487);com.salesforce.graph.symbols.PathScopeVisitor.afterVisit(PathScopeVisitor.java:1242);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.afterVisit(DefaultSymbolProviderVertexVisitor.java:800)","https://forcedotcom.github.io/sfdx-scanner/en/v3.x/salesforce-graph-engine/rules/#ApexFlsViolationRule","InternalExecutionError","sfge"

@jaelee125 jaelee125 changed the title [BUG] InternalExecution Error [BUG] InternalExecutionError Mar 20, 2024
@jaelee125 jaelee125 changed the title [BUG] InternalExecutionError [BUG] InternalExecutionError - Decimal.setScale method Mar 20, 2024
@jaelee125 jaelee125 changed the title [BUG] InternalExecutionError - Decimal.setScale method [BUG] InternalExecutionError on Standard Salesforce methods Mar 20, 2024
@jaelee125
Copy link
Author

Url.getOrgDomainUrl().toExternalForm() is causing InternalExecution Error

String url = Url.getOrgDomainUrl().toExternalForm() + '/lightning/n/Specright_Network?c__tab=Search&c__object=' + objectApiName + '&c__uuid=' + recordId;

"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: UnimplementedMethodException: ApexStringValue:getOrgDomainUrl, vertex=MethodCallExpressionVertex{fullMethodName=Url.getOrgDomainUrl, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[Url], BeginLine=51, DefiningType_CaseSafe=sn_commentcallback, LastChild=true, DefiningType=SN_CommentCallback, EndLine=51, Name_CaseSafe=url, childIdx=0, BeginColumn=17, ReferenceType=METHOD, Name=Url}}}, chainedNames=[Url], properties={FirstChild=true, FullMethodName=Url.getOrgDomainUrl, BeginLine=51, FullMethodName_CaseSafe=url.getorgdomainurl, DefiningType_CaseSafe=sn_commentcallback, LastChild=true, DefiningType=SN_CommentCallback, EndLine=51, MethodName_CaseSafe=getorgdomainurl, childIdx=0, BeginColumn=21, MethodName=getOrgDomainUrl}}: com.salesforce.graph.symbols.apex.ApexStringValue.apply(ApexStringValue.java:708);com.salesforce.graph.symbols.PathScopeVisitor.handleApexValueMethod(PathScopeVisitor.java:1487);com.salesforce.graph.symbols.PathScopeVisitor.afterVisit(PathScopeVisitor.java:1242);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.afterVisit(DefaultSymbolProviderVertexVisitor.java:800);com.salesforce.graph.vertex.MethodCallExpressionVertex.afterVisit(MethodCallExpressionVertex.java:79);com.salesforce.graph.ops.expander.ApexPathExpander.performAfterVisit(ApexPathExpander.java:577)","https://forcedotcom.github.io/sfdx-scanner/en/v3.x/salesforce-graph-engine/rules/#ApexFlsViolationRule","InternalExecutionError","sfge"

@jaelee125
Copy link
Author

Schema.SObjectType: newSObjectType method is causing Internal Execution Error

Schema.SObjectType sObjectType = ((SObject) (Type.forName('Schema.' + sObjectAPIName).newInstance())).getSObjectType();
SObject record = sObjectType.newSObject(recordTypeId, false);

"1","3","/Users/jae/code/specright-network/specright-network/main/default/classes/SN_NetworkController.cls","903","19","SN_NetworkController","saveNetworkRecord","","","","InternalExecutionError","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: MethodCallExpressionVertex{fullMethodName=sObjectType.newSObject, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[sObjectType], BeginLine=962, DefiningType_CaseSafe=sn_networkcontroller, LastChild=false, DefiningType=SN_NetworkController, EndLine=962, Name_CaseSafe=sobjecttype, childIdx=0, BeginColumn=14, ReferenceType=METHOD, Name=sObjectType}}}, chainedNames=[sObjectType], properties={FirstChild=false, FullMethodName=sObjectType.newSObject, BeginLine=962, FullMethodName_CaseSafe=sobjecttype.newsobject, DefiningType_CaseSafe=sn_networkcontroller, LastChild=true, DefiningType=SN_NetworkController, EndLine=962, MethodName_CaseSafe=newsobject, childIdx=1, BeginColumn=26, MethodName=newSObject}}: com.salesforce.graph.symbols.apex.ApexValue.validateParameterSize(ApexValue.java:610);com.salesforce.graph.symbols.apex.schema.SObjectType._applyMethod(SObjectType.java:131);com.salesforce.graph.symbols.apex.schema.SObjectType.executeMethod(SObjectType.java:121);com.salesforce.graph.symbols.PathScopeVisitor.afterMethodCall(PathScopeVisitor.java:659);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.afterMethodCall(DefaultSymbolProviderVertexVisitor.java:318);com.salesforce.graph.ops.expander.ApexPathExpander.handleMethodCall(ApexPathExpander.java:681)","https://forcedotcom.github.io/sfdx-scanner/en/v3.x/salesforce-graph-engine/rules/#ApexFlsViolationRule","InternalExecutionError","sfge"

@sagar-j-sfdc sagar-j-sfdc added the duplicate This issue or pull request already exists label Apr 10, 2024
@sagar-j-sfdc
Copy link
Collaborator

This is a duplicate of #1044. As a workaround, try not to use the variable names same as the class name for e.g url and Url.

@sagar-j-sfdc sagar-j-sfdc closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2024
@nwcm
Copy link

nwcm commented Apr 10, 2024

@sagar-j-sfdc The original raised exception is not the same as the one you suggest this is a duplicate of. Additionally your work around doesn't work.

public with sharing class AllThingsDFAHates {
  @AuraEnabled
  public static void noSetScale(){
    Decimal dec = 1.00;

    dec.setScale(2);
  }
}
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: MethodCallExpressionVertex{fullMethodName=dec.setScale, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[dec], BeginLine=116, DefiningType_CaseSafe=allthingsdfahates, LastChild=false, DefiningType=AllThingsDFAHates, EndLine=116, Name_CaseSafe=dec, childIdx=0, BeginColumn=5, ReferenceType=METHOD, Name=dec}}}, chainedNames=[dec], properties={FirstChild=true, FullMethodName=dec.setScale, BeginLine=116, FullMethodName_CaseSafe=dec.setscale, DefiningType_CaseSafe=allthingsdfahates, LastChild=true, DefiningType=AllThingsDFAHates, EndLine=116, MethodName_CaseSafe=setscale, childIdx=0, BeginColumn=9, MethodName=setScale}}: com.salesforce.graph.symbols.apex.ApexSimpleValue.apply(ApexSimpleValue.java:55);com.salesforce.graph.symbols.apex.ApexNumberValue.apply(ApexNumberValue.java:42);com.salesforce.graph.symbols.apex.ApexDecimalValue.apply(ApexDecimalValue.java:49);com.salesforce.graph.symbols.PathScopeVisitor.handleApexValueMethod(PathScopeVisitor.java:1487);com.salesforce.graph.symbols.PathScopeVisitor.afterVisit(PathScopeVisitor.java:1242);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.afterVisit(DefaultSymbolProviderVertexVisitor.java:800)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants