forrestzhu / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

JsonParser is unable to process rows with null values of type EdmSimpleType.Byte #98

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a data source (e.g. a DB table) containing at least one NULLable 
column of type Byte (tinyint in MSSQL)
2. insert a datarow with NULL as value in this column into this data source
3. query such a data source using OData4j with JSON format enabled.

What is the expected output? What do you see instead?
Expected output: JSON Parser can process such a data row, the corresponding 
Byte field remains NULL.
Reality: JSON Parser throw a NullPointerException because a method 
OProperty<Byte> byte_(String name, byte value) is called with NULL as value. 
This is probably caused by using the scalar data type "byte" instead of Byte.

What version of the product are you using? On what operating system?
OData4j 0.5
Windows XP

Please provide any additional information below.
- The OData feed was produced by WCF Data Services
- The underlying data source was MS SQL 2005
- The column definition was tinyint (NULL)

Original issue reported on code.google.com by tomas.wa...@gmail.com on 12 Dec 2011 at 12:11

Attachments:

GoogleCodeExporter commented 8 years ago
I will take a look into this issue.

Original comment by stoy...@gmail.com on 19 Sep 2012 at 2:10

GoogleCodeExporter commented 8 years ago
This issue is not reproducible with the current state of the code (0.8). I 
created a unit test which should, according to the above description, fail with 
a NullPointerException. However, the unit test passes ok.
I also compared the code of JsonTypeConverter with the 0.5 state and noticed 
that it is considerably refactored, so that there is no way for the original 
exception to happen. The new code is already available in 0.7, so I believe the 
issue is not present there as well.

Original comment by stoy...@gmail.com on 21 Sep 2012 at 8:42

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for unit test. I will commit your patch and close this issue.

Original comment by stephan....@googlemail.com on 21 Sep 2012 at 11:13

GoogleCodeExporter commented 8 years ago

Original comment by stephan....@googlemail.com on 21 Sep 2012 at 11:15