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

Danish Amjad updated FLINK-17818:
---------------------------------
    Description: 
When a file is read with a CSVReader and a POJO is specified and the filed 
names are not specified, the output is obviously not correct. The API is not 
throwing any error despite a null check inside the API. i.e.

{code}
Preconditions.checkNotNull(pojoFields, "POJO fields must be specified (not 
null) if output type is a POJO.");
{code}

The *root cause* of the problem is that the _fieldNames_ argument is a variable 
argument and the variable is 'empty but not null' when not given any value. So, 
the check passes without failing.

I am not sure if it is a feature of the API or an actual bug because there is a 
test checking the NPE when a null is passed.

  was:
When a file is read with a CSVReader and a POJO is specified and the filed 
names are not specified, the output is obviously not correct. The API is not 
throwing any error despite a null check inside the API. i.e.

{code}
Preconditions.checkNotNull(pojoFields, "POJO fields must be specified (not 
null) if output type is a POJO.");
{code}

The *root cause* of the problem is that the _fieldNames_ argument is a variable 
argument and the variable is 'empty but not null' when not given any value. So, 
the check passes without failing.


> CSV Reader with Pojo Type and no field names fails
> --------------------------------------------------
>
>                 Key: FLINK-17818
>                 URL: https://issues.apache.org/jira/browse/FLINK-17818
>             Project: Flink
>          Issue Type: Bug
>          Components: API / DataSet
>    Affects Versions: 1.10.1
>            Reporter: Danish Amjad
>            Priority: Minor
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> When a file is read with a CSVReader and a POJO is specified and the filed 
> names are not specified, the output is obviously not correct. The API is not 
> throwing any error despite a null check inside the API. i.e.
> {code}
> Preconditions.checkNotNull(pojoFields, "POJO fields must be specified (not 
> null) if output type is a POJO.");
> {code}
> The *root cause* of the problem is that the _fieldNames_ argument is a 
> variable argument and the variable is 'empty but not null' when not given any 
> value. So, the check passes without failing.
> I am not sure if it is a feature of the API or an actual bug because there is 
> a test checking the NPE when a null is passed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to