You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "Kasper Sørensen (JIRA)" <ji...@apache.org> on 2013/11/19 14:51:20 UTC

[jira] [Updated] (METAMODEL-30) CsvDataContext.executeCountQuery breaks if Resource.getSize() returns -1

     [ https://issues.apache.org/jira/browse/METAMODEL-30?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kasper Sørensen updated METAMODEL-30:
-------------------------------------

    Attachment: METAMODEL-30.patch

My proposed patch

> CsvDataContext.executeCountQuery breaks if Resource.getSize() returns -1
> ------------------------------------------------------------------------
>
>                 Key: METAMODEL-30
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-30
>             Project: Metamodel
>          Issue Type: Bug
>            Reporter: Kasper Sørensen
>            Assignee: Kasper Sørensen
>         Attachments: METAMODEL-30.patch
>
>
> On line 282 of CsvDataContext we check the size of the CSV resource (typically file) like this:
> final long length = _resource.getSize();
> But the Resource interface says that a resource may return -1 to this method, if the size is not determinable.
> In that case our code breaks since there will eventually be a negative sample data array created from this value.
> Rather we should check for the exceptional -1 value and handle the sample array size accordingly.



--
This message was sent by Atlassian JIRA
(v6.1#6144)