Ошибка при десериализации Java объекта из. xml файла с Xstream - PullRequest
0 голосов
/ 22 марта 2020

Я хочу десериализовать объект, и мои последние два поля - LocalDate

Мой XML файл после сериализации выглядит следующим образом:

<user>
  <id>1</id>
  <username>admin</username>
  <password>adminpass</password>
  <firstName>Administrator</firstName>
  <lastName>Administrator</lastName>
  <isAdmin>true</isAdmin>
  <dateCreated resolves-to="java.time.Ser" serialization="custom"/>
  <dateEdited resolves-to="java.time.Ser" serialization="custom"/>
  <formatter>
    <printerParser>
      <printerParsers>
        <java.time.format.DateTimeFormatterBuilder_-NumberPrinterParser>
          <field class="java.time.temporal.ChronoField">YEAR_OF_ERA</field>
          <minWidth>4</minWidth>
          <maxWidth>19</maxWidth>
          <signStyle>EXCEEDS_PAD</signStyle>
          <subsequentWidth>0</subsequentWidth>
        </java.time.format.DateTimeFormatterBuilder_-NumberPrinterParser>
        <java.time.format.DateTimeFormatterBuilder_-CharLiteralPrinterParser>
          <literal>-</literal>
        </java.time.format.DateTimeFormatterBuilder_-CharLiteralPrinterParser>
        <java.time.format.DateTimeFormatterBuilder_-NumberPrinterParser>
          <field class="java.time.temporal.ChronoField">MONTH_OF_YEAR</field>
          <minWidth>2</minWidth>
          <maxWidth>2</maxWidth>
          <signStyle>NOT_NEGATIVE</signStyle>
          <subsequentWidth>0</subsequentWidth>
        </java.time.format.DateTimeFormatterBuilder_-NumberPrinterParser>
        <java.time.format.DateTimeFormatterBuilder_-CharLiteralPrinterParser>
          <literal>-</literal>
        </java.time.format.DateTimeFormatterBuilder_-CharLiteralPrinterParser>
        <java.time.format.DateTimeFormatterBuilder_-NumberPrinterParser>
          <field class="java.time.temporal.ChronoField">DAY_OF_MONTH</field>
          <minWidth>2</minWidth>
          <maxWidth>2</maxWidth>
          <signStyle reference="../../java.time.format.DateTimeFormatterBuilder$NumberPrinterParser[2]/signStyle"/>
          <subsequentWidth>0</subsequentWidth>
        </java.time.format.DateTimeFormatterBuilder_-NumberPrinterParser>
        <java.time.format.DateTimeFormatterBuilder_-CharLiteralPrinterParser>
          <literal> </literal>
        </java.time.format.DateTimeFormatterBuilder_-CharLiteralPrinterParser>
        <java.time.format.DateTimeFormatterBuilder_-NumberPrinterParser>
          <field class="java.time.temporal.ChronoField">HOUR_OF_DAY</field>
          <minWidth>2</minWidth>
          <maxWidth>2</maxWidth>
          <signStyle reference="../../java.time.format.DateTimeFormatterBuilder$NumberPrinterParser[2]/signStyle"/>
          <subsequentWidth>0</subsequentWidth>
        </java.time.format.DateTimeFormatterBuilder_-NumberPrinterParser>
        <java.time.format.DateTimeFormatterBuilder_-CharLiteralPrinterParser>
          <literal>:</literal>
        </java.time.format.DateTimeFormatterBuilder_-CharLiteralPrinterParser>
        <java.time.format.DateTimeFormatterBuilder_-NumberPrinterParser>
          <field class="java.time.temporal.ChronoField">MINUTE_OF_HOUR</field>
          <minWidth>2</minWidth>
          <maxWidth>2</maxWidth>
          <signStyle reference="../../java.time.format.DateTimeFormatterBuilder$NumberPrinterParser[2]/signStyle"/>
          <subsequentWidth>0</subsequentWidth>
        </java.time.format.DateTimeFormatterBuilder_-NumberPrinterParser>
      </printerParsers>
      <optional>false</optional>
    </printerParser>
    <locale>en_US</locale>
    <decimalStyle>
      <zeroDigit>0</zeroDigit>
      <positiveSign>+</positiveSign>
      <negativeSign>-</negativeSign>
      <decimalSeparator>.</decimalSeparator>
    </decimalStyle>
    <resolverStyle>SMART</resolverStyle>
  </formatter>
</user>

Полученная ошибка:

com.thoughtworks.xstream.converters.reflection.ObjectAccessException: невозможно построить java .time.Ser

Я искал везде, но не могу найти, как это исправить , Это из-за API LocalDate?

...