Skip to content

Commit

Permalink
Upgrade Antlr to 4.7.1 and get rid of bug workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsbasjes committed Jan 6, 2018
1 parent 0078275 commit 34a3fb9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,7 @@ v3.3
- By default do not load all test cases into memory
- Fixed NPE in parse error situation (Hacker scenario)
- Never let any NPE disturb the calling application ever again

v3.4
===
- Upgrade Antlr to 4.7.1 and get rid of bug workaround
2 changes: 1 addition & 1 deletion analyzer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<url>http://github.com/nielsbasjes/yauaa</url>

<properties>
<antlr.version>4.7</antlr.version>
<antlr.version>4.7.1</antlr.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import nl.basjes.parse.useragent.utils.Splitter;
import nl.basjes.parse.useragent.utils.VersionSplitter;
import nl.basjes.parse.useragent.utils.WordSplitter;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CodePointCharStream;
import org.antlr.v4.runtime.CommonTokenStream;
Expand Down Expand Up @@ -262,14 +261,7 @@ private UserAgentContext parseUserAgent(UserAgent userAgent) {
@Override
public void enterUserAgent(UserAgentContext ctx) {
// In case of a parse error the 'parsed' version of agent can be incomplete
// TODO: Remove this workaround for the Antlr 4.7 bug described here https://github.com/antlr/antlr4/issues/1949
// String input = ctx.start.getTokenSource().getInputStream().toString();
String input = "";
CharStream inputCharStream = ctx.start.getTokenSource().getInputStream();
if (inputCharStream.size() > 0) {
input = inputCharStream.toString();
}
inform(ctx, "agent", input);
inform(ctx, "agent", ctx.start.getTokenSource().getInputStream().toString());
}

@Override
Expand Down

0 comments on commit 34a3fb9

Please sign in to comment.