Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MalformedInputException on valid BSON. #33

Closed
mikelehen opened this issue Nov 13, 2013 · 13 comments
Closed

MalformedInputException on valid BSON. #33

mikelehen opened this issue Nov 13, 2013 · 13 comments

Comments

@mikelehen
Copy link

Hitting a MalformedInputException on a particular bson file. Unfortunately, I can't share it since it has customer data in it. The BSON seems to be valid (bsondump has no problem with it). I'll try to dig in deeper when I get a chance, but logging an issue in case it's useful.

Exception in thread "main" java.lang.RuntimeException: Input length = 1
at com.fasterxml.jackson.databind.MappingIterator.next(MappingIterator.java:124)
at scala.collection.JavaConversions$JIteratorWrapper.next(JavaConversions.scala:575)
at scala.collection.Iterator$class.foreach(Iterator.scala:772)
at scala.collection.JavaConversions$JIteratorWrapper.foreach(JavaConversions.scala:573)
at bson2json.App$.main(App.scala:37)
at bson2json.App.main(App.scala)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
at java.nio.charset.CoderResult.throwException(CoderResult.java:277)
at de.undercouch.bson4jackson.io.LittleEndianInputStream.readUTF(LittleEndianInputStream.java:293)
at de.undercouch.bson4jackson.io.LittleEndianInputStream.readUTF(LittleEndianInputStream.java:227)
at de.undercouch.bson4jackson.BsonParser.readString(BsonParser.java:570)
at de.undercouch.bson4jackson.BsonParser.nextToken(BsonParser.java:292)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringMap(MapDeserializer.java:422)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:314)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:26)
at com.fasterxml.jackson.databind.MappingIterator.nextValue(MappingIterator.java:189)
at com.fasterxml.jackson.databind.MappingIterator.next(MappingIterator.java:120)
... 5 more

@michel-kraemer
Copy link
Owner

Without test data this is going to be a tough one. MalformedInputException usually means the string contains invalid characters (in this case invalid for UTF-8). Can you confirm this? Would it be possible to provide a test file that contains only this specific string?

Cheers,
Michel

@michel-kraemer
Copy link
Owner

I'm about to release a new version of bson4jackson that is compatible to Jackson 2.3. I will close this issue due to inactivity. If you get to reproduce the problem with data that can be shared feel free to open the issue again.

Thanks,
Michel

@bguerout
Copy link

bguerout commented Dec 7, 2013

Hi,

Someone has described same behavior on Jongo ML : https://groups.google.com/forum/?fromgroups=#!topic/jongo-user/Lj8bvsBjEao

I was able to reproduce the bug described in this issue with bson4jackson 2.3.0 using the content.txt (json file) provided into the post.
I'm going to investigate

@bguerout
Copy link

bguerout commented Dec 7, 2013

@bguerout
Copy link

Hi @michel-kraemer, can this issue be reopened ?

@michel-kraemer
Copy link
Owner

@bguerout I'm sorry for the late answer. End of the year is always a busy time at the office! :-/ I'll try to investigate the issue later today or tomorrow. If it can be reproduced, it can be fixed!

@bguerout
Copy link

No problem, i know what you are talking about :-)

@michel-kraemer
Copy link
Owner

The commit I just uploaded should fix the problem. Can you please test it and report if the problem persists? Building bson4jackson should be as simple as running ./gradlew install but I can send you a binary if you like.

@bguerout
Copy link

Indeed this is fixed.
Thanks

@michel-kraemer
Copy link
Owner

Thanks for the feedback. If you need a new version just let me know.

@mikelehen
Copy link
Author

Thanks! Whenever you release a new version (to maven), I can easily check to see if my case is fixed as well.

@michel-kraemer
Copy link
Owner

Version 2.3.1 has just been released. Should be available at Maven central in a couple of minutes.

Cheers,
Michel

@mikelehen
Copy link
Author

Sorry for the delay, but 2.3.1 does indeed fix the issue I was hitting. Thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants