{"action":"created","issue":{"url":"https://api.github.com/repos/antlr/antlr4/issues/1009","labels_url":"https://api.github.com/repos/antlr/antlr4/issues/1009/labels{/name}","comments_url":"https://api.github.com/repos/antlr/antlr4/issues/1009/comments","events_url":"https://api.github.com/repos/antlr/antlr4/issues/1009/events","html_url":"https://github.com/antlr/antlr4/issues/1009","id":109476201,"number":1009,"title":"ArrayIndexOutOfBoundsException caused by incomplete command line options","user":{"login":"ebourg","id":54304,"avatar_url":"https://avatars.githubusercontent.com/u/54304?v=3","gravatar_id":"","url":"https://api.github.com/users/ebourg","html_url":"https://github.com/ebourg","followers_url":"https://api.github.com/users/ebourg/followers","following_url":"https://api.github.com/users/ebourg/following{/other_user}","gists_url":"https://api.github.com/users/ebourg/gists{/gist_id}","starred_url":"https://api.github.com/users/ebourg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebourg/subscriptions","organizations_url":"https://api.github.com/users/ebourg/orgs","repos_url":"https://api.github.com/users/ebourg/repos","events_url":"https://api.github.com/users/ebourg/events{/privacy}","received_events_url":"https://api.github.com/users/ebourg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-02T11:41:03Z","updated_at":"2015-10-05T03:55:48Z","closed_at":null,"body":"Hi,\r\n\r\nUsing ANTLR 4.5.1 I noticed that an incomplete command line option triggers an ArrayIndexOutOfBoundsException, for example:\r\n\r\n    $ antlr4 -o\r\n    Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: 1\r\n            at org.antlr.v4.Tool.handleArgs(Tool.java:241)\r\n            at org.antlr.v4.Tool.<init>(Tool.java:219)\r\n            at org.antlr.v4.Tool.main(Tool.java:188)\r\n\r\n    $ antlr4 -encoding\r\n    Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: 1\r\n            at org.antlr.v4.Tool.handleArgs(Tool.java:241)\r\n            at org.antlr.v4.Tool.<init>(Tool.java:219)\r\n            at org.antlr.v4.Tool.main(Tool.java:188)\r\n\r\nComparatively, with antlr3 a proper error message is displayed:\r\n\r\n    $ antlr3 -o\r\n    missing output directory with -fo/-o option; ignoring\r\n\r\n    $ antlr3 -language\r\n    missing language name; ignoring\r\n"},"comment":{"url":"https://api.github.com/repos/antlr/antlr4/issues/comments/145424496","html_url":"https://github.com/antlr/antlr4/issues/1009#issuecomment-145424496","issue_url":"https://api.github.com/repos/antlr/antlr4/issues/1009","id":145424496,"user":{"login":"sharwell","id":1408396,"avatar_url":"https://avatars.githubusercontent.com/u/1408396?v=3","gravatar_id":"","url":"https://api.github.com/users/sharwell","html_url":"https://github.com/sharwell","followers_url":"https://api.github.com/users/sharwell/followers","following_url":"https://api.github.com/users/sharwell/following{/other_user}","gists_url":"https://api.github.com/users/sharwell/gists{/gist_id}","starred_url":"https://api.github.com/users/sharwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharwell/subscriptions","organizations_url":"https://api.github.com/users/sharwell/orgs","repos_url":"https://api.github.com/users/sharwell/repos","events_url":"https://api.github.com/users/sharwell/events{/privacy}","received_events_url":"https://api.github.com/users/sharwell/received_events","type":"User","site_admin":false},"created_at":"2015-10-05T03:55:48Z","updated_at":"2015-10-05T03:55:48Z","body":"> Probably better to switch to args4j, which handles all this very nicely.\r\n\r\nargs4j is a relatively large dependency for what amounts to a very small task in ANTLR. I think we should just fix the handling for this case and not bother changing everything else out."}}