You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.RuntimeException: java.util.NoSuchElementException
at protobuf.codec.AbstractCodec.toMessage(AbstractCodec.java:74)
at protobuf.codec.AbstractCodec.toMessage(AbstractCodec.java:88)
at protobuf.codec.AbstractCodec.toMessage(AbstractCodec.java:83)
...
...
Caused by: java.util.NoSuchElementException
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1114)
at protobuf.codec.xml.XmlReader.parseElement(XmlReader.java:52)
at protobuf.codec.xml.XmlReader.parse(XmlReader.java:41)
at protobuf.codec.xml.XmlCodec.readFromStream(XmlCodec.java:56)
at protobuf.codec.AbstractCodec.toMessage(AbstractCodec.java:70)
... 26 more
to reproduce:
create a simple proto:
message MyObject{
optional string name = 1;
optional string value = 2;
}
java code:
try {
MyObject before = MyObject.newBuilder()
.setName("123456789")
//
.setValue(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")//
.build();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Codec codec = new XmlCodec();
codec.fromMessage(before, outputStream);
System.out.println(outputStream.toString());
MyObject after = codec.toMessage(MyObject.class, new ByteArrayInputStream(outputStream.toByteArray()));
Assert.assertEquals(after, before);
Assert.assertEquals(after.getName(), before.getName());
Assert.assertEquals(after.getValue(), before.getValue());
} catch (IOException e) {
Assert.fail(e.getMessage());
}
You can try using shorter string for setValue() and longer string for setName() to reproduce.
btw, if you change to use JsonCodec, the above case can pass.
Thanks
Ma Ling
The text was updated successfully, but these errors were encountered:
tutufool
pushed a commit
to tutufool/protobuf-codec
that referenced
this issue
Jan 22, 2013
Hi,
I got below exception when using XML codec:
java.lang.RuntimeException: java.util.NoSuchElementException
at protobuf.codec.AbstractCodec.toMessage(AbstractCodec.java:74)
at protobuf.codec.AbstractCodec.toMessage(AbstractCodec.java:88)
at protobuf.codec.AbstractCodec.toMessage(AbstractCodec.java:83)
...
...
Caused by: java.util.NoSuchElementException
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1114)
at protobuf.codec.xml.XmlReader.parseElement(XmlReader.java:52)
at protobuf.codec.xml.XmlReader.parse(XmlReader.java:41)
at protobuf.codec.xml.XmlCodec.readFromStream(XmlCodec.java:56)
at protobuf.codec.AbstractCodec.toMessage(AbstractCodec.java:70)
... 26 more
to reproduce:
create a simple proto:
message MyObject{
optional string name = 1;
optional string value = 2;
}
java code:
You can try using shorter string for setValue() and longer string for setName() to reproduce.
btw, if you change to use JsonCodec, the above case can pass.
Thanks
Ma Ling
The text was updated successfully, but these errors were encountered: