[services-geojson] NullPointerException in Feature.addXxxProperty() or getXxxProperty() methods
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 438
- フォーク
- 117
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
All methods like `addStringProperty()`, `addNumberProperty()`, `getStringProperty()`… don’t guard against a null properties field.
The “guard” is at a higher level, as using Feature static factory methods ensure that the properties field is never null.
However `Feature.GsonTypeAdapter.read()` directly calls the Feature constructor which doesn’t prevent a null properties field. So for example, if someone calls `FeatureCollection.fromJson()` which contains a feature that has a null properties field, it will be decoded by the GsonAdapter and then calling `addStringProperty()` on this feature will crash.
Small code sample to demonstrate that
```
public void addPropertyCrash() {
final String json = "{" +
"\"type\": \"FeatureCollection\"," +
"\"features\": [" +
"{" +
"\"type\": \"Feature\"," +
"\"properties\": null," +
"\"geometry\": null" +
"}" +
"]" +
"}";
FeatureCollection actual = FeatureCollection.fromJson(json);
actual.features().get(0).addStringProperty("key", "value");
}
```
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
FeatureCollection.fromJson() を通じて呼び出される Feature.GsonTypeAdapter.read() から始め、null の properties フィールドが Feature.addStringProperty() と関連する add/get メソッドにどのように到達するかを調査します。プロパティを追加したときに、提供された FeatureCollection JSON の例で NullPointerException が発生しなくなっていることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100