What steps will reproduce the problem? 1. Add a UTF BOM character to the very start of a .js file that is going to be linted 2. Run the plugin
What is the expected output? What do you see instead? The expected output is an error about the problematic character or no error at all (why the BOM causes troubles?).
I see: Caused by: java.lang.NegativeArraySizeException at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:45) at java.lang.StringBuffer.<init>(StringBuffer.java:91) at com.googlecode.jslint4java.formatter.PlainFormatter.spaces(PlainFormatter.java:62) at com.googlecode.jslint4java.formatter.PlainFormatter.outputOneIssue(PlainFormatter.java:49) at com.googlecode.jslint4java.formatter.PlainFormatter.format(PlainFormatter.java:22) at com.googlecode.jslint4java.maven.ReportWriterImpl.report(ReportWriterImpl.java:78) at com.googlecode.jslint4java.maven.MultiReportWriter.report(MultiReportWriter.java:39) ....
What version of the product are you using? On what operating system? <groupId>com.googlecode.jslint4java</groupId> <artifactId>jslint4java-maven-plugin</artifactId> <version>2.0.2</version>
Please provide any additional information below.
I've put a breakpoint at PlainFomatter, line 49
sb.append(spaces(issue.getCharacter() - 1));
and I saw that the reason is "Unsafe char" at line 1. issue.getCharacter() returned 0.
Comment #1
Posted on Jul 25, 2012 by Happy BearI've been able to reproduce this. Let me take a look.
Comment #2
Posted on Jul 25, 2012 by Happy BearOK, it turns out I was not skipping the BOM correctly in the maven plugin. JSLint was warning about an invalid character at position 0, which I didn't handle. I've now fixed both problems.
https://github.com/happygiraffe/jslint4java/compare/033151c8e0...a74b1fda99
Comment #3
Posted on Jul 25, 2012 by Grumpy RhinoThank you!
Comment #4
Posted on Nov 28, 2012 by Happy BearIssue 87 has been merged into this issue.
Status: Fixed
Labels:
Type-Defect
Priority-Medium
Milestone-Release2.0.3