[jira] [Commented] (AVRO-1544) Union of enum and null can result in NPE on validate if null is not first

2014-08-04 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14085478#comment-14085478
 ] 

Hudson commented on AVRO-1544:
--

SUCCESS: Integrated in AvroJava #471 (See 
[https://builds.apache.org/job/AvroJava/471/])
AVRO-1544. Java: Fix GenericData#validate for unions with null.  Contributed by 
Matthew Hayes. (cutting: rev 1615764)
* /avro/trunk/CHANGES.txt
* 
/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
* 
/avro/trunk/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java


> Union of enum and null can result in NPE on validate if null is not first
> -
>
> Key: AVRO-1544
> URL: https://issues.apache.org/jira/browse/AVRO-1544
> Project: Avro
>  Issue Type: Bug
>  Components: java
>Affects Versions: 1.7.6
>Reporter: Matthew Hayes
>Assignee: Matthew Hayes
> Fix For: 1.7.8
>
> Attachments: AVRO-1544-v2.patch, AVRO-1544.patch
>
>
> The ENUM case in validate is missing a null check for datum:
> {code}
> case ENUM:
>   return schema.getEnumSymbols().contains(datum.toString());
> {code}
> This leads to a surprising error where a NPE is thrown for a union of enum 
> and null when the enum is first in the union.  If null is first it works.  
> The fix is a simple.  I'm creating a patch that adds the fix and a unit test 
> for this case.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (AVRO-1544) Union of enum and null can result in NPE on validate if null is not first

2014-08-04 Thread Matthew Hayes (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14085213#comment-14085213
 ] 

Matthew Hayes commented on AVRO-1544:
-

Awesome thanks! :)

> Union of enum and null can result in NPE on validate if null is not first
> -
>
> Key: AVRO-1544
> URL: https://issues.apache.org/jira/browse/AVRO-1544
> Project: Avro
>  Issue Type: Bug
>  Components: java
>Affects Versions: 1.7.6
>Reporter: Matthew Hayes
>Assignee: Matthew Hayes
> Fix For: 1.7.8
>
> Attachments: AVRO-1544-v2.patch, AVRO-1544.patch
>
>
> The ENUM case in validate is missing a null check for datum:
> {code}
> case ENUM:
>   return schema.getEnumSymbols().contains(datum.toString());
> {code}
> This leads to a surprising error where a NPE is thrown for a union of enum 
> and null when the enum is first in the union.  If null is first it works.  
> The fix is a simple.  I'm creating a patch that adds the fix and a unit test 
> for this case.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (AVRO-1544) Union of enum and null can result in NPE on validate if null is not first

2014-08-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14085206#comment-14085206
 ] 

ASF subversion and git services commented on AVRO-1544:
---

Commit 1615764 from [~cutting] in branch 'avro/trunk'
[ https://svn.apache.org/r1615764 ]

AVRO-1544. Java: Fix GenericData#validate for unions with null.  Contributed by 
Matthew Hayes.

> Union of enum and null can result in NPE on validate if null is not first
> -
>
> Key: AVRO-1544
> URL: https://issues.apache.org/jira/browse/AVRO-1544
> Project: Avro
>  Issue Type: Bug
>  Components: java
>Affects Versions: 1.7.6
>Reporter: Matthew Hayes
> Fix For: 1.7.8
>
> Attachments: AVRO-1544-v2.patch, AVRO-1544.patch
>
>
> The ENUM case in validate is missing a null check for datum:
> {code}
> case ENUM:
>   return schema.getEnumSymbols().contains(datum.toString());
> {code}
> This leads to a surprising error where a NPE is thrown for a union of enum 
> and null when the enum is first in the union.  If null is first it works.  
> The fix is a simple.  I'm creating a patch that adds the fix and a unit test 
> for this case.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (AVRO-1544) Union of enum and null can result in NPE on validate if null is not first

2014-08-01 Thread Sean Busbey (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14083313#comment-14083313
 ] 

Sean Busbey commented on AVRO-1544:
---

I think the patch is ready to apply, but am sadly not a committer.

> Union of enum and null can result in NPE on validate if null is not first
> -
>
> Key: AVRO-1544
> URL: https://issues.apache.org/jira/browse/AVRO-1544
> Project: Avro
>  Issue Type: Bug
>  Components: java
>Affects Versions: 1.7.6
>Reporter: Matthew Hayes
> Attachments: AVRO-1544-v2.patch, AVRO-1544.patch
>
>
> The ENUM case in validate is missing a null check for datum:
> {code}
> case ENUM:
>   return schema.getEnumSymbols().contains(datum.toString());
> {code}
> This leads to a surprising error where a NPE is thrown for a union of enum 
> and null when the enum is first in the union.  If null is first it works.  
> The fix is a simple.  I'm creating a patch that adds the fix and a unit test 
> for this case.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (AVRO-1544) Union of enum and null can result in NPE on validate if null is not first

2014-07-31 Thread Matthew Hayes (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14081395#comment-14081395
 ] 

Matthew Hayes commented on AVRO-1544:
-

Any objections to applying the patch?

> Union of enum and null can result in NPE on validate if null is not first
> -
>
> Key: AVRO-1544
> URL: https://issues.apache.org/jira/browse/AVRO-1544
> Project: Avro
>  Issue Type: Bug
>  Components: java
>Affects Versions: 1.7.6
>Reporter: Matthew Hayes
> Attachments: AVRO-1544-v2.patch, AVRO-1544.patch
>
>
> The ENUM case in validate is missing a null check for datum:
> {code}
> case ENUM:
>   return schema.getEnumSymbols().contains(datum.toString());
> {code}
> This leads to a surprising error where a NPE is thrown for a union of enum 
> and null when the enum is first in the union.  If null is first it works.  
> The fix is a simple.  I'm creating a patch that adds the fix and a unit test 
> for this case.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (AVRO-1544) Union of enum and null can result in NPE on validate if null is not first

2014-07-14 Thread Sean Busbey (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14060737#comment-14060737
 ] 

Sean Busbey commented on AVRO-1544:
---

+1 LGTM. Ran through without fix and test failed, after fix test passed.

> Union of enum and null can result in NPE on validate if null is not first
> -
>
> Key: AVRO-1544
> URL: https://issues.apache.org/jira/browse/AVRO-1544
> Project: Avro
>  Issue Type: Bug
>  Components: java
>Affects Versions: 1.7.6
>Reporter: Matthew Hayes
> Attachments: AVRO-1544-v2.patch, AVRO-1544.patch
>
>
> The ENUM case in validate is missing a null check for datum:
> {code}
> case ENUM:
>   return schema.getEnumSymbols().contains(datum.toString());
> {code}
> This leads to a surprising error where a NPE is thrown for a union of enum 
> and null when the enum is first in the union.  If null is first it works.  
> The fix is a simple.  I'm creating a patch that adds the fix and a unit test 
> for this case.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (AVRO-1544) Union of enum and null can result in NPE on validate if null is not first

2014-07-12 Thread Sean Busbey (JIRA)

[ 
https://issues.apache.org/jira/browse/AVRO-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14059982#comment-14059982
 ] 

Sean Busbey commented on AVRO-1544:
---

AVRO-997 is def not backwards compatible. It's waiting for 1.8.0. Once this 
goes in, I'll rebase it onto the current trunk so it can happily keep waiting.

A few points of feedback:

* TestGenericData has several lines with trailing whitespace, could you clean 
those up?
* Could you change the test to use GenericData.EnumSymbol instead of String? 
(that way the tests won't have to change when 1.8.0 changes to strict 
enforcement of use of GenericData.EnumSymbol.)
* How about changing the check to be consistent with the fail-first style 
elsewhere in GenericData? e.g.
{code}
+ if (datum == null) return false;
return schema.getEnumSymbols().contains(datum.toString());
{code}

> Union of enum and null can result in NPE on validate if null is not first
> -
>
> Key: AVRO-1544
> URL: https://issues.apache.org/jira/browse/AVRO-1544
> Project: Avro
>  Issue Type: Bug
>  Components: java
>Affects Versions: 1.7.6
>Reporter: Matthew Hayes
> Attachments: AVRO-1544.patch
>
>
> The ENUM case in validate is missing a null check for datum:
> {code}
> case ENUM:
>   return schema.getEnumSymbols().contains(datum.toString());
> {code}
> This leads to a surprising error where a NPE is thrown for a union of enum 
> and null when the enum is first in the union.  If null is first it works.  
> The fix is a simple.  I'm creating a patch that adds the fix and a unit test 
> for this case.



--
This message was sent by Atlassian JIRA
(v6.2#6252)