FasterXML / FasterXML/jackson-core

JsonParser.getCurrentLocation is not updated for `DataInput` input

オープン
#601 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
2.4k
フォーク
928
平均マージ
2日 18時間
マージ済み PR(30日)
24

説明

### Issue

Using a `JsonParser` instantiated via `JsonParser.createParser(DataInput)` does not update `JsonLocation` values returned by `JsonParser.getCurrentLocation` (everything defaults to -1).

Switching to `JsonParser.createParser(InputStream)` with the same input object populates the `JsonLocation` data as expected.

### Use case

I use `JsonParser` to manually extract slices of Netty byte buffers (that contain Json). To feed Netty ByteBufs to JsonParser, I have to wrap the `ByteBuf` in a `ByteBufInputStream` which `extends InputStream` and `implements DataInput`. `JsonParser` accepts both types so explicit casting is required.

* This works and populates `JsonLocation` values:
```
ByteBuf buf = ...;
JsonParser parser = JSON_FACTORY.createParser((InputStream) new ByteBufInputStream(buf));
```
* This does not populate `JsonLocation` values:
```
ByteBuf buf = ...;
JsonParser parser = JSON_FACTORY.createParser((DataInput) new ByteBufInputStream(buf));
```

Issue affects at least versions 2.9.8 and 2.10.2.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。