Hi,

We recently started getting weird XStream errors on code that was previously working fine. IMHO some (seemingly unreleated) change causes the serialization to output bad XML and this in turn makes the deserialization fall over later on.

The error message I'm getting is:

com.thoughtworks.xstream.converters.ConversionException: Cannot deserialize object with new readObject()/writeObject() methods
---- Debugging information ----
class               : java.util.HashSet
required-type       : java.util.HashSet
converter-type : com.thoughtworks.xstream.converters.reflection.SerializableConverter path : /com.vodecc.voipmng.boundary.wicket.streamsearch.StreamSearchResultsPage/children/com.vodecc.voipmng.boundary.wicket.general.UserInfoPanel/children/com.vodecc.voipmng.boundary.wicket.general.UserInfoPanel$UserEditableFragment/children/children/data/org.apache.wicket.model.PropertyModel/target/roles
line number         : 1
class[1]            : com.vodecc.voipmng.core.usermng.entity.CVod_UserBean
converter-type[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
class[2]            : org.apache.wicket.model.PropertyModel
class[3]            : [Ljava.lang.Object;
converter-type[2] : com.thoughtworks.xstream.converters.collections.ArrayConverter
class[4]            : org.apache.wicket.markup.html.basic.Label
class[5] : com.vodecc.voipmng.boundary.wicket.integration.StrutsActionLink class[6] : com.vodecc.voipmng.boundary.wicket.general.UserInfoPanel$UserEditableFragment class[7] : com.vodecc.voipmng.boundary.wicket.general.UserInfoPanel class[8] : com.vodecc.voipmng.boundary.wicket.streamsearch.StreamSearchResultsPage
version             : not available

The weird thing is this:

I created a stand-alone unit-test that serializes & deserializes a org.apache.wicket.model.PropertyModel that wraps a "CVod_UserBean" instance with a non-empty "roles" HashSet and it works just fine (see attached file working.xml). It's just not working when serializing the whole Apache Wicket page.

As a side note, the "roles" attribute actually holds a Hibernate PersistentSet. I'm using the HibernatePersistentCollectionConverter to handle this , after changing my unit-test to use PersistentSet instead of java.util.HashSet it still working correctly.

Comparing the working/broken (see attachments) I see that the *broken* XML lacks 'serialization='custom' attributes ... what is the meaning of these attributes and what might be the reason why their missing in the broken XML (both using an XStream instance with identical mappers/converters) ?

This is with XStream 1.4.8 and JDK 1.8.0_40 on 64-bit Linux.

Thanks,
Tobias
<?xml version="1.0" encoding="utf-8"?>
<org.apache.wicket.model.PropertyModel>
  <target class="com.vodecc.voipmng.core.usermng.entity.CVod_UserBean">
    <userId>101800</userId>
    <userFirstName>&lt; unknown &gt;</userFirstName>
    <userLastName>&lt; unknown &gt;</userLastName>
    <userLogonName>someUser</userLogonName>
    <userPassword>{BCRYPT}$2a$12$aICD4sxa22VmDHVLMt1zwugcAAV0E6aywlYf4dIdAv6L05oAh7ejG</userPassword>
    <userEmail>someUser@someDomain</userEmail>
    <userPwdQuestion>
      <pwdQuestionId>6</pwdQuestionId>
      <pwdQuestion>What is your mother's maiden name?</pwdQuestion>
    </userPwdQuestion>
    <userMustChangePwd>false</userMustChangePwd>
    <userActive>true</userActive>
    <roles>
      <com.vodecc.voipmng.core.usermng.entity.CVF__UserRole>
        <roleId>3</roleId>
        <roleName>Admin</roleName>
        <permissions>
          <com.vodecc.voipmng.core.enums.EVF__Permission>EXPORT_SIP_TRUNKS</com.vodecc.voipmng.core.enums.EVF__Permission>
        </permissions>
        <description>Default role</description>
        <autoJoin>false</autoJoin>
      </com.vodecc.voipmng.core.usermng.entity.CVF__UserRole>
    </roles>
    <searchSettings>
      <itemsPerPage>40</itemsPerPage>
      <displayMode>TEXT_AND_CHARTS</displayMode>
      <searchIntervalDuration>
        <iMillis>1800000</iMillis>
      </searchIntervalDuration>
    </searchSettings>
    <defaultTimezoneId>Europe/Berlin</defaultTimezoneId>
    <failedloginAttempts>0</failedloginAttempts>
    <lastPasswordChangeDate class="sql-timestamp" serialization="custom">
      <date>
        <long>1428649188000</long>
      </date>
      <sql-timestamp>
        <default>
          <nanos>786069000</nanos>
        </default>
      </sql-timestamp>
    </lastPasswordChangeDate>
    <dashboardDisabledBecauseOfError>false</dashboardDisabledBecauseOfError>
    <mosClassScaling>NARROWBAND</mosClassScaling>
  </target>
  <expression>userLogonName</expression>
</org.apache.wicket.model.PropertyModel>
<?xml version="1.0" encoding="utf-8"?>
<org.apache.wicket.model.PropertyModel>
  <target class="com.vodecc.voipmng.core.usermng.entity.CVod_UserBean">
    <userId>0</userId>
    <userMustChangePwd>false</userMustChangePwd>
    <userActive>false</userActive>
    <roles serialization="custom">
      <unserializable-parents />
      <set>
        <default />
        <int>16</int>
        <float>0.75</float>
        <int>1</int>
        <com.vodecc.voipmng.core.usermng.entity.CVF__UserRole>
          <roleId>0</roleId>
          <permissions serialization="custom">
            <unserializable-parents />
            <set>
              <default />
              <int>16</int>
              <float>0.75</float>
              <int>1</int>
              <com.vodecc.voipmng.core.enums.EVF__Permission>CREATE_ALARM_DEFINITION</com.vodecc.voipmng.core.enums.EVF__Permission>
            </set>
          </permissions>
          <autoJoin>false</autoJoin>
        </com.vodecc.voipmng.core.usermng.entity.CVF__UserRole>
      </set>
    </roles>
    <failedloginAttempts>0</failedloginAttempts>
    <dashboardDisabledBecauseOfError>false</dashboardDisabledBecauseOfError>
    <mosClassScaling>NARROWBAND</mosClassScaling>
  </target>
  <expression>userName</expression>
</org.apache.wicket.model.PropertyModel>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to