Attribute / element name collision (same local name, different namepace) cannot be configured during deserialization

オープン
#65 コメント 9 件 リアクション 9 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
java
領域
backend

調査の方向性

com.fasterxml.jackson.dataformat.xml.failing.TestDeserialization の失敗しているテスト、特に testAttrElementConflict とその MAPPER.readValue 呼び出しから始めてください。失敗を再現し、デシリアライズ中に state という名前の属性と要素がどのように解決されるかを追跡し、stateAttr に "stateAttr"、state に "stateElement" を設定した状態でテストが成功したら issue の完了とみなしてください。

索引モデルが issue の本文から書いたものです。

説明

most-wanted name-collision

If an element has an attribute and sub-element with the same name, the attribute seems to be ignored and the element value used, despite collision resolving configuration with @JacksonXmlProperty(localName="state", isAttribute=true) (for colliding name state). Here is concrete example

static class TwoStates {
  @JacksonXmlProperty(localName="state", isAttribute=true)
  public String stateAttr = "NOT SET";
  public String state = "NOT SET";
}

The following input should deserialize the appropriate distinct values into the appropriate distinct fields:
<Wrapper state='stateAttr'><state>stateElement</state></Wrapper>

Here is a failing test snippet for com.fasterxml.jackson.dataformat.xml.failing.TestDeserialization

        private static class TwoStates
    {
        @JacksonXmlProperty(localName="state", isAttribute=true)
        public String stateAttr = "NOT SET";
        public String state = "NOT SET";

        @Override public String toString() { return "TwoStates: stateAttr: " + stateAttr + " state: " + state; }
    }

    public void testAttrElementConflict() throws Exception
    {
        TwoStates ob = MAPPER.readValue("<Wrapper state='stateAttr'><state>stateElement</state></Wrapper>",
                TwoStates.class);
        assertNotNull(ob);
                System.err.println("ob: " + ob);
        assertEquals("stateElement", ob.state);
        assertEquals("stateAttr", ob.stateAttr); // attribute stateAttr is ignored so this fails
    }
主要言語
Java
スター
636
フォーク
250
平均マージ
7時間 10分
マージ済み PR(30日)
8

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

FasterXML/jackson-dataformat-xml のほかの issue

FasterXML/jackson-dataformat-xml の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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