rsingla / jslint4java

Automatically exported from code.google.com/p/jslint4java
Other
0 stars 0 forks source link

Ant task for jslint fails #101

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

        <echo>HelloWorld.json processing with jslint</echo>
        <jslint>
            <formatter type="plain" destfile="jslint.out"/>
            <fileset   file="HelloWorld.json"/>
        </jslint>

What is the expected output? What do you see instead?

Expected outputs are jslint results.

Actual outputs is exception trace:
HelloWorld.json processing with jslint
C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForAdvancedModeling\build.xml:
1542: 
java.lang.IllegalStateException: Calling Context.exit without previous 
Context.enter
    at org.mozilla.javascript.Context.exit(Context.java:468)
    at org.mozilla.javascript.Context.exit(Context.java:460)
    at com.googlecode.jslint4java.JSLintBuilder.fromReader(JSLintBuilder.java:127)
    at com.googlecode.jslint4java.JSLintBuilder.fromClasspathResource(JSLintBuilder.java:57)
    at com.googlecode.jslint4java.JSLintBuilder.fromClasspathResource(JSLintBuilder.java:40)
    at com.googlecode.jslint4java.JSLintBuilder.fromDefault(JSLintBuilder.java:69)
    at com.googlecode.jslint4java.ant.JSLintTask.makeLint(JSLintTask.java:244)
    at com.googlecode.jslint4java.ant.JSLintTask.execute(JSLintTask.java:156)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor113.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 17 seconds)

What version of the product are you using? On what operating system?

jslint4java-2.0.5.jar

Running apache-ant-1.9.4 under Windows 7 using Java version "1.8.0_31"

Please provide any additional information below.

Original issue reported on code.google.com by don.brut...@gmail.com on 10 Mar 2015 at 11:10

Attachments:

GoogleCodeExporter commented 9 years ago
This same example works OK via command-line invocation:

java -jar lib/jslint4java-2.0.5.jar HelloWorld.json

Attempting to apply jslint4java under Ant using a similar <java> invocation 
fails:

        <java classpath="${jslint.jar}" fork="${fork}">
            <arg value="HelloWorld.json"/>
        </java>
> build.xml:1543: Classname must not be null.

after some sleuthing, found a modified version that works:
        <java classname="com.googlecode.jslint4java.cli.Main" classpath="${jslint.jar}">
            <arg value="HelloWorld.json"/>
        </java>

This form of alternate invocation would be good to add to the jslint4java ant 
page at
http://docs.jslint4java.googlecode.com/git/2.0.5/ant.html

Note that your top-level page still links to the older version of that page:
http://docs.jslint4java.googlecode.com/git/2.0.1/ant.html

p.s. Running jslint --help reveals that a fairly old version of jslint.js is 
being used:
> using jslint version 2013-05-06

p.p.s. looking ahead, Douglas Crockford reports working on a rewritten version 
of jslint:
https://plus.google.com/118095276221607585885/posts/aeJGSb7zheb

Original comment by don.brut...@gmail.com on 10 Mar 2015 at 11:47