{"action":"created","issue":{"url":"https://api.github.com/repos/uniVocity/univocity-parsers/issues/24","labels_url":"https://api.github.com/repos/uniVocity/univocity-parsers/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/uniVocity/univocity-parsers/issues/24/comments","events_url":"https://api.github.com/repos/uniVocity/univocity-parsers/issues/24/events","html_url":"https://github.com/uniVocity/univocity-parsers/issues/24","id":73756753,"number":24,"title":"CsvParser does not report certain serious errors.","user":{"login":"derekmahar","id":6047,"avatar_url":"https://avatars.githubusercontent.com/u/6047?v=3","gravatar_id":"","url":"https://api.github.com/users/derekmahar","html_url":"https://github.com/derekmahar","followers_url":"https://api.github.com/users/derekmahar/followers","following_url":"https://api.github.com/users/derekmahar/following{/other_user}","gists_url":"https://api.github.com/users/derekmahar/gists{/gist_id}","starred_url":"https://api.github.com/users/derekmahar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekmahar/subscriptions","organizations_url":"https://api.github.com/users/derekmahar/orgs","repos_url":"https://api.github.com/users/derekmahar/repos","events_url":"https://api.github.com/users/derekmahar/events{/privacy}","received_events_url":"https://api.github.com/users/derekmahar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-06T22:29:21Z","updated_at":"2015-05-07T00:49:07Z","closed_at":null,"body":"[`CsvParser`](https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/csv/CsvParser.java) suppresses certain serious exceptions instead of throwing or returning them to the client.  For example, when using a [`BeanListProcessor`](https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/processor/BeanListProcessor.java), when `CsvParser` encounters a bean field for which a corresponding column name does not exist in the CSV file, `CsvParser` creates a [`TextParsingException`](https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/TextParsingException.java) containing the following message, but it neither throws this exception nor returns it to the client:\r\n\r\n> java.lang.IllegalStateException: Could not find field with name 'Account Concurrency Code' in input. Names found: [Report Type, Filer Name, Filer Address, Filer City, Filer State/Province/Region, Filer Country, Filer GIIN, Filer TIN, Sponsored Entity Name, Sponsored Entity Address, Sponsored Entity City, Sponsored Entity State/Province/Region, Sponsored Entity Country, Sponsored Entity GIIN, Sponsored Entity TIN, Account Holder Name, Account Holder Address, Account Holder City, Account Holder State/Province/Region, Account Holder Country, Account Holder TIN, Account Holder Type, Owner Name, Owner Address, Owner City, Owner State/Province/Region, Owner Country, Owner TIN, Account Number, Account Currency Code, Account Balance, Interest, Gross proceeds/Redemptions, Dividends, Other, Pooled Reporting Type, Number of Accounts, Aggregate Payment Amount, Aggregate Account Balance, Pooled Currency Code]\r\n\r\nThe source of the problem appears to be in the [catch block](https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/AbstractParser.java#L103) of method [`AbstractParser#parse(Reader)`](https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/AbstractParser.java#L76).  Though the call to method [`AbstractParser#handleException(Throwable)`](https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/AbstractParser.java#L177) returns a `TextParsingException` which it subsequently passes to method [`AbstractParser#stopParsing(Throwable)`](https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/AbstractParser.java#L261), none of these methods actually throw the exception (`AbstractParser#stopParsing(Throwable)` throws it, but only if it encounters *another* exception) and `AbstractParser#parse(Reader)` doesn't return the exception to its client.  When such an exception happens, [`BeanListProcessor#getBeans()`](https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/processor/BeanListProcessor.java#L74) also does not fail, but instead returns an empty list.  Consequently, `CsvParser` effectively suppresses serious exceptions without giving the client any clue as to why `BeanListProcessor` produces an empty result."},"comment":{"url":"https://api.github.com/repos/uniVocity/univocity-parsers/issues/comments/99661468","html_url":"https://github.com/uniVocity/univocity-parsers/issues/24#issuecomment-99661468","issue_url":"https://api.github.com/repos/uniVocity/univocity-parsers/issues/24","id":99661468,"user":{"login":"derekmahar","id":6047,"avatar_url":"https://avatars.githubusercontent.com/u/6047?v=3","gravatar_id":"","url":"https://api.github.com/users/derekmahar","html_url":"https://github.com/derekmahar","followers_url":"https://api.github.com/users/derekmahar/followers","following_url":"https://api.github.com/users/derekmahar/following{/other_user}","gists_url":"https://api.github.com/users/derekmahar/gists{/gist_id}","starred_url":"https://api.github.com/users/derekmahar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekmahar/subscriptions","organizations_url":"https://api.github.com/users/derekmahar/orgs","repos_url":"https://api.github.com/users/derekmahar/repos","events_url":"https://api.github.com/users/derekmahar/events{/privacy}","received_events_url":"https://api.github.com/users/derekmahar/received_events","type":"User","site_admin":false},"created_at":"2015-05-07T00:49:07Z","updated_at":"2015-05-07T00:49:07Z","body":"How can I examine the stack trace or retrieve the error message if the\nparser doesn't actually throw the exception? The error handler constructs\nthe exception, but then never actually throws it!\n\nThe exception message that I reported I copied from a watch variable in the\nEclipse debugger after the debugger stopped at a breakpoint that I had\nplaced in the error handler.  As far as I can tell, there is no other way\nto access the exception and its contents.\n\nDerek\nOn 6 May 2015 7:46 pm, \"Jeronimo Backes\" <notifications@github.com> wrote:\n\n> you WILL always find the original exception! The original exception appears\n> in the exception chain. Look at the stacktrace. There's a reason why the\n> Exception class has the \"reason\" attribute.\n>\n> The exception message you got could not be more clear, and it helps you\n> find the problem. This is the whole point of Java's exception handling.\n>\n> Don't get too mired by the \"catch ( Throwable ex ) \" blocks. They are there\n> to grab any error and populate a rich message with heaps of details about\n> the state of the parser when the error occurred, the potential causes of\n> the errors, and suggestions for you to fix the error.\n>\n> In fact, I think the exception message you got is pretty fantastic and is\n> much more helpful than receiving an IndexOutOfBoundsException and leave you\n> without a clue why you got an error.\n>\n> Best regards\n>\n> On Thursday, May 7, 2015, Derek Mahar <notifications@github.com> wrote:\n>\n> > CsvParser\n> > <\n> https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/csv/CsvParser.java\n> >\n> > suppresses certain serious exceptions instead of throwing or returning\n> them\n> > to the client. For example, when using a BeanListProcessor\n> > <\n> https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/processor/BeanListProcessor.java\n> >,\n> > when CsvParser encounters a bean field for which a corresponding column\n> > name does not exist in the CSV file, CsvParser creates a\n> > TextParsingException\n> > <\n> https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/TextParsingException.java\n> >\n> > containing the following message, but it neither throws this exception\n> nor\n> > returns it to the client:\n> >\n> > java.lang.IllegalStateException: Could not find field with name 'Account\n> > Concurrency Code' in input. Names found: [Report Type, Filer Name, Filer\n> > Address, Filer City, Filer State/Province/Region, Filer Country, Filer\n> > GIIN, Filer TIN, Sponsored Entity Name, Sponsored Entity Address,\n> Sponsored\n> > Entity City, Sponsored Entity State/Province/Region, Sponsored Entity\n> > Country, Sponsored Entity GIIN, Sponsored Entity TIN, Account Holder\n> Name,\n> > Account Holder Address, Account Holder City, Account Holder\n> > State/Province/Region, Account Holder Country, Account Holder TIN,\n> Account\n> > Holder Type, Owner Name, Owner Address, Owner City, Owner\n> > State/Province/Region, Owner Country, Owner TIN, Account Number, Account\n> > Currency Code, Account Balance, Interest, Gross proceeds/Redemptions,\n> > Dividends, Other, Pooled Reporting Type, Number of Accounts, Aggregate\n> > Payment Amount, Aggregate Account Balance, Pooled Currency Code]\n> >\n> > The source of the problem appears to be in the catch block\n> > <\n> https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/AbstractParser.java#L103\n> >\n> > of method AbstractParser#parse(Reader)\n> > <\n> https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/AbstractParser.java#L76\n> >.\n> > Though the call to method AbstractParser#handleException(Throwable)\n> > <\n> https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/AbstractParser.java#L177\n> >\n> > returns a TextParsingException which it subsequently passes to method\n> > AbstractParser#stopParsing(Throwable)\n> > <\n> https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/AbstractParser.java#L261\n> >,\n> > none of these methods actually throw the exception (\n> > AbstractParser#stopParsing(Throwable) throws it, but only if it\n> > encounters *another* exception) and AbstractParser#parse(Reader) doesn't\n> > return the exception to its client. When such an exception happens,\n> > BeanListProcessor#getBeans()\n> > <\n> https://github.com/uniVocity/univocity-parsers/blob/v1.5.3/src/main/java/com/univocity/parsers/common/processor/BeanListProcessor.java#L74\n> >\n> > also does not fail, but instead returns an empty list. Consequently,\n> > CsvParser effectively suppresses serious exceptions without giving the\n> > client any clue as to why BeanListProcessor produces an empty result.\n> >\n> > —\n> > Reply to this email directly or view it on GitHub\n> > <https://github.com/uniVocity/univocity-parsers/issues/24>.\n> >\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/uniVocity/univocity-parsers/issues/24#issuecomment-99648295>\n> .\n>\n"}}