myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prakash Udupa (Created) (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Created] (TRINIDAD-2155) Incomplete serialization implementation in AccessibilityProfile$SerializableAccessibilityProfile
Date Tue, 01 Nov 2011 21:15:32 GMT
Incomplete serialization implementation in AccessibilityProfile$SerializableAccessibilityProfile
------------------------------------------------------------------------------------------------

                 Key: TRINIDAD-2155
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2155
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Archetype
    Affects Versions: 2.0.2-core
            Reporter: Prakash Udupa


Issue:
--------

Regarding the serializable  inner class of AccessibilityProfile...
private static final class SerializableAccessibilityProfile extends AccessibilityProfile implements
Serializable

The super class no-arg constructor has private access, this will lead to the following error...

Exception in thread "main" java.io.InvalidClassException: org.apache.myfaces.trinidad.context.AccessibilityProfile$SerializableAccessibilityProfile;
org.apache.myfaces.trinidad.context.AccessibilityProfile$SerializableAccessibilityProfile;
no valid constructor
	at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:713)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1733)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
	at client.AccSerialTest.main(AccSerialTest.java:22)
Caused by: java.io.InvalidClassException: org.apache.myfaces.trinidad.context.AccessibilityProfile$SerializableAccessibilityProfile;
no valid constructor
	at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:471)
	at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1106)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
	at client.AccSerialTest.main(AccSerialTest.java:19)

Testcase:
--------------

package client;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import org.apache.myfaces.trinidad.context.AccessibilityProfile;

public class AccSerialTest
{

  public static void main(String[] args)
    throws Exception
  {
    System.out.println("SERIALIZING");
    AccessibilityProfile acc = AccessibilityProfile.getDefaultInstance();
    ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("c:\\Temp\\serial.txt"));
    os.writeObject(acc);
    System.out.println("DE-SERIALIZING");
    ObjectInputStream is = new ObjectInputStream(new FileInputStream("c:\\Temp\\serial.txt"));
    is.readObject();
  }
}

Fix:
-----

Make the constructor protected. Patch attached.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message