[infinispan-issues] [JBoss JIRA] (IPROTO-63) writeObject throws IllegalArgumentException with oneof label

Ryan Emerson (JIRA) issues at jboss.org
Mon Jul 2 06:11:00 EDT 2018


     [ https://issues.jboss.org/browse/IPROTO-63?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan Emerson updated IPROTO-63:
-------------------------------
    Description: 
The below schema results in the following exception:

Schema:
{code:java}
message EntryVersion {
    oneof version {
        NumericVersion numeric = 1;
        ClusteredVersion clustered = 2;
    }
//    optional NumericVersion numeric = 1;
//    optional ClusteredVersion clustered = 2;
}

message NumericVersion {
    required int64 version = 1;
}

message ClusteredVersion {
    required int64 version = 1;
    required int32 topology = 2;
}
{code}

Exception:

{code:java}
java.lang.IllegalArgumentException: Declared field type is not a message or an enum : numeric
{code}

It seems this is caused because the type for the field "numeric" is null in the associated FieldDescriptor object that is retrieved in the [writeObject impl|https://github.com/infinispan/protostream/blob/master/core/src/main/java/org/infinispan/protostream/impl/ProtoStreamWriterImpl.java#L452-L470]. 

If the oneof label is replaced with the commented optional fields, the marshallers work as expected.


  was:
The below schema results in the following exception:

Schema:
{code:java}
message EntryVersion {
    oneof version {
        NumericVersion numeric = 1;
        ClusteredVersion clustered = 2;
    }
//    optional NumericVersion numeric = 1;
//    optional ClusteredVersion clustered = 2;
}

message NumericVersion {
    required int64 version = 1;
}

message ClusteredVersion {
    required int64 version = 1;
    required int32 topology = 2;
}
{code}

Exception:

{code:java}
java.lang.IllegalArgumentException: Declared field type is not a message or an enum : numeric
{code}

It seems this is caused because the type for the field "numeric" is null in the associated FieldDescriptor object that is retrieved in the [writeObject impl|https://github.com/infinispan/protostream/blob/master/core/src/main/java/org/infinispan/protostream/impl/ProtoStreamWriterImpl.java#L452-L470]. 




> writeObject throws IllegalArgumentException with oneof label
> ------------------------------------------------------------
>
>                 Key: IPROTO-63
>                 URL: https://issues.jboss.org/browse/IPROTO-63
>             Project: Infinispan ProtoStream
>          Issue Type: Bug
>            Reporter: Ryan Emerson
>
> The below schema results in the following exception:
> Schema:
> {code:java}
> message EntryVersion {
>     oneof version {
>         NumericVersion numeric = 1;
>         ClusteredVersion clustered = 2;
>     }
> //    optional NumericVersion numeric = 1;
> //    optional ClusteredVersion clustered = 2;
> }
> message NumericVersion {
>     required int64 version = 1;
> }
> message ClusteredVersion {
>     required int64 version = 1;
>     required int32 topology = 2;
> }
> {code}
> Exception:
> {code:java}
> java.lang.IllegalArgumentException: Declared field type is not a message or an enum : numeric
> {code}
> It seems this is caused because the type for the field "numeric" is null in the associated FieldDescriptor object that is retrieved in the [writeObject impl|https://github.com/infinispan/protostream/blob/master/core/src/main/java/org/infinispan/protostream/impl/ProtoStreamWriterImpl.java#L452-L470]. 
> If the oneof label is replaced with the commented optional fields, the marshallers work as expected.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the infinispan-issues mailing list