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

NoViableAltException java.lang.NullPointerException #22

Closed
laserbyte opened this issue Nov 9, 2014 · 5 comments
Closed

NoViableAltException java.lang.NullPointerException #22

laserbyte opened this issue Nov 9, 2014 · 5 comments

Comments

@laserbyte
Copy link

I'm getting multiple NoViableAltException java.lang.NullPointerException errors like the following when scanning a folder:

-------NoViableAltException(94@[])
java.lang.NullPointerException
        at org.antlr.runtime.tree.BaseTreeAdaptor.isNil(BaseTreeAdaptor.java:70)
        at org.antlr.runtime.tree.CommonTreeNodeStream.nextElement(CommonTreeNodeStream.java:91)
        at org.antlr.runtime.misc.LookaheadStream.fill(LookaheadStream.java:107)
        at org.antlr.runtime.misc.LookaheadStream.syncAhead(LookaheadStream.java:101)
        at org.antlr.runtime.misc.LookaheadStream.LT(LookaheadStream.java:122)
        at org.antlr.runtime.tree.CommonTreeNodeStream.LA(CommonTreeNodeStream.java:120)
        at cfml.parsing.cfscript.CFScriptTree.scriptBlock(CFScriptTree.java:249)
        at cfml.parsing.CFMLParser.parseScript(CFMLParser.java:329)
        at com.cflint.CFLint.process(CFLint.java:280)
        at com.cflint.CFLint.processStack(CFLint.java:197)
        at com.cflint.CFLint.process(CFLint.java:275)
        at com.cflint.CFLint.processStack(CFLint.java:197)
        at com.cflint.CFLint.process(CFLint.java:284)
        at com.cflint.CFLint.processStack(CFLint.java:197)
        at com.cflint.CFLint.process(CFLint.java:284)
        at com.cflint.CFLint.processStack(CFLint.java:197)
        at com.cflint.CFLint.process(CFLint.java:284)
        at com.cflint.CFLint.processStack(CFLint.java:197)
        at com.cflint.CFLint.process(CFLint.java:188)
        at com.cflint.CFLint.scan(CFLint.java:145)
        at com.cflint.CFLint.scan(CFLint.java:139)
        at com.cflint.CFLint.scan(CFLint.java:116)
        at com.cflint.main.CFLintMain.execute(CFLintMain.java:251)
        at com.cflint.main.CFLintMain.main(CFLintMain.java:164)
@ryaneberly
Copy link
Contributor

The CF parser we use is the same one used by CFEclipse. It is pretty good, but has some known issues. It is likely that if you opened the same file in CFEclipse you would see the validation/parsing errors in CFEclipse as well.

If you are comfortable attaching an example, I can probably determine what the issue is for you. Often the CF code can be tweaked slightly to be favorable parsed.

That said, jjames has also been exploring possibly updating the parser to eliminate these kinds of problems.

@ryaneberly
Copy link
Contributor

closed. need an example to duplicate this one

@laserbyte
Copy link
Author

Here is an example if you wouldn't mind re-opening the issue.

Thanks!

<cfset lParams = "name,addy,city,state,zip" />

<cfquery name="qPeople" datasource="#request.app.datasource.name#">
    select *
    from people
    where 1 = 1
    <cfloop index="i" list="#lParams#" >
        <cfif url[#i#] neq 'null' AND Trim(url[#i#]) neq "">
            <cfif i eq "name">
                lastname LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#url[i]#%" />
        </cfif>
    </cfloop>
</cfquery>

@ryaneberly
Copy link
Contributor

Thanks laserbyte,
Reopened

@ryaneberly ryaneberly reopened this Jan 22, 2015
@ryaneberly
Copy link
Contributor

fixed in antlr4 branch, releasing soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants