Open Vintic opened 5 years ago
Ok, I found how to hide errors in console from external librari: `PrintStream originalStream = System.err; System.setErr(dummyStream); lintresult = cfLintAPI.scan(Collections.singletonList(tempFile.getAbsolutePath())); System.setErr(originalStream);
PrintStream dummyStream = new PrintStream(new OutputStream(){ public void write(int b) { // NO-OP } });`
Reopening as this is still probably an error that should be looked at.
I think, that can provide a file, which is checked.
This happens to me when using lambda expressions:
this.constraints = {
name : { required : true },
email : { required : true, type : "email", udf : ( value, target ) => {
if( isNull( arguments.value ) ) return false;
return qb.from( "users" ).where( "email", arguments.value ).count() == 0;
} },
username : { required : true, udf : ( value, target ) => {
if( isNull( arguments.value ) ) return false;
return qb.from( "users" ).where( "username", arguments.value ).count() == 0;
}},
password : { required : true }
};
I have verified that the exception is caused by the lambda expressions which now Lucee and Adobe 2018 support
@lmajano What version of CFLint/CFParser are you using? Arrow function support was added in CFParser 2.10.0, which is only being used in the latest CFLint v1.5.0 snapshots.
1.4.1 the latest stable
@lmajano Can you clone the latest on the dev
branch and build it with gradlew build
to see if the issue is fixed?
So I just tried linting with @lmajano's code using the latest snapshot and there is an issue with the parsing. I don't know yet if it's the same issue as the OP.
Help me please. Why this can happen? Or how I can hide this message?
java.lang.NullPointerException at cfml.parsing.cfscript.CFFunctionExpression.lambda$new$4(CFFunctionExpression.java:33) at java.util.ArrayList.forEach(ArrayList.java:1257) at cfml.parsing.cfscript.CFFunctionExpression.<init>(CFFunctionExpression.java:33) at cfml.parsing.cfscript.CFFunctionExpression.<init>(CFFunctionExpression.java:22) at cfml.parsing.cfscript.walker.CFExpressionVisitor.visitQualifiedFunctionCall(CFExpressionVisitor.java:457) at cfml.parsing.cfscript.walker.CFExpressionVisitor.visitQualifiedFunctionCall(CFExpressionVisitor.java:77) at cfml.CFSCRIPTParser$QualifiedFunctionCallContext.accept(CFSCRIPTParser.java:7255) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46) at cfml.parsing.cfscript.walker.CFExpressionVisitor.visitMemberExpression(CFExpressionVisitor.java:286) at cfml.parsing.cfscript.walker.CFExpressionVisitor.visitMemberExpression(CFExpressionVisitor.java:77) at cfml.CFSCRIPTParser$MemberExpressionContext.accept(CFSCRIPTParser.java:6724) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46) at cfml.parsing.cfscript.walker.CFExpressionVisitor.visitUnaryExpression(CFExpressionVisitor.java:242) at cfml.parsing.cfscript.walker.CFExpressionVisitor.visitBaseExpression(CFExpressionVisitor.java:223) at cfml.parsing.cfscript.walker.CFExpressionVisitor.visitBaseExpression(CFExpressionVisitor.java:77) at cfml.CFSCRIPTParser$BaseExpressionContext.accept(CFSCRIPTParser.java:5856) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46) at cfml.CFSCRIPTParserBaseVisitor.visitStartExpression(CFSCRIPTParserBaseVisitor.java:237) at cfml.CFSCRIPTParser$StartExpressionContext.accept(CFSCRIPTParser.java:3117) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at cfml.parsing.cfscript.walker.CFExpressionVisitor.visitAssignmentExpression(CFExpressionVisitor.java:195) at cfml.parsing.cfscript.walker.CFExpressionVisitor.visitAssignmentExpression(CFExpressionVisitor.java:77) at cfml.CFSCRIPTParser$AssignmentExpressionContext.accept(CFSCRIPTParser.java:5634) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46) at cfml.CFSCRIPTParserBaseVisitor.visitCfmlExpression(CFSCRIPTParserBaseVisitor.java:447) at cfml.CFSCRIPTParser$CfmlExpressionContext.accept(CFSCRIPTParser.java:5385) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at cfml.parsing.CFMLParser.parseCFMLExpression(CFMLParser.java:174) at com.cflint.CFLint.process(CFLint.java:466) at com.cflint.CFLint.processStack(CFLint.java:399) at com.cflint.CFLint.process(CFLint.java:342) at com.cflint.CFLint.scan(CFLint.java:295) at com.cflint.CFLint.scan(CFLint.java:206) at com.cflint.api.CFLintAPI.scan(CFLintAPI.java:65) at mteam.md.tasks.postCommitTasks.RejectCfErrors.checkContent(RejectCfErrors.java:89)
Error in: <cfset access_level_check = APPLICATION.sage_security.CheckSecurityLevel( @ 58: Error: "null" Location: cfml.parsing.cfscript.CFFunctionExpression.lambda$new$4(CFFunctionExpression.java:33)