Ok, im gonna go ahead and just paste most of the stack trace in, (its massive) :
java.io.NotSerializableException: com.sun.java.swing.plaf.windows.XPStyle
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteObject(Unknown Source)
at javax.swing.JComponent.writeObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeArray(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.access$300(Unknown Source)
at java.io.ObjectOutputStream$PutFieldImpl.writeFields(Unknown Source)
at java.io.ObjectOutputStream.writeFields(Unknown Source)
at java.awt.Container.writeObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeArray(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.access$300(Unknown Source)
at java.io.ObjectOutputStream$PutFieldImpl.writeFields(Unknown Source)
at java.io.ObjectOutputStream.writeFields(Unknown Source)
at java.awt.Container.writeObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeArray(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.access$300(Unknown Source)
at java.io.ObjectOutputStream$PutFieldImpl.writeFields(Unknown Source)
at java.io.ObjectOutputStream.writeFields(Unknown Source)
at java.awt.Container.writeObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeArray(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.access$300(Unknown Source)
at java.io.ObjectOutputStream$PutFieldImpl.writeFields(Unknown Source)
at java.io.ObjectOutputStream.writeFields(Unknown Source)
at java.awt.Container.writeObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at saiman.quantgcms.QuantitationSessionManagementViewPerspectiveUI.saveSession(QuantitationSessionManagementViewPerspectiveUI.java:235)
at saiman.quantgcms.QuantitationSessionManagementViewPerspectiveUI.fileSave(QuantitationSessionManagementViewPerspectiveUI.java:147)
at saiman.quantgcms.QuantitationSessionManagementUIEnsemble.buttonClickedHeader(QuantitationSessionManagementUIEnsemble.java:69)
at saiman.uiobjnew.PerspectiveActionToolBarHeader.buttonBlicked(PerspectiveActionToolBarHeader.java:23)
at saiman.uiobjnew.PerspectiveToolBarButton.buttonBlicked(PerspectiveToolBarButton.java:37)
at saiman.uiobjnew.PerspectiveToolBarButtonActionListener.actionPerformed(PerspectiveToolBarButtonActionListener.java:18)
... lots of event things
The stack hits my code at: saiman.quantgcms.QuantitationSessionManagementViewPerspectiveUI.saveSession(QuantitationSessionManagementViewPerspectiveUI.java:235)
which is on the line marked below:
FileOutputStream fos = new FileOutputStream(file);
ObjectOutputStream out = new ObjectOutputStream(fos);
CalibrantContainer calibrantContainer = frame.getCalibrantContainer();
out.writeObject(calibrantContainer); //<<<<< error here
out.close();
fos.close();
I'm new to Serialization, and i should have built my class (its quite big) arround it, rather than make the class serializable right at the end. But I didn't plan it particually well...
I know there are Serializable and Nonserializable Objects, my calibrantContainer object implements serializable (or extends JayPanel whch extends JPanel):
public class CalibrantContainer extends JayPanel implements TargettingProcessUpdateListener, IQuantitationDataFileListContainer
{
transient private static final long serialVersionUID = -52662875082249716L;
now, i know that NotSerializableException occours when i am trying to serialize something tha is Nonserializable, and that Nonserializable objects need to be declaired transient. So as a test (to norrow down this com.sun.java.swing.plaf.windows.XPStyle) i made all fields transient, like this in the JayPanel:
public class JayPanel extends JPanel{
private static final long serialVersionUID = 5592038570698995942L;
transient protected GridBagLayout gbl;
transient protected GridBagConstraints gbc;
transient Border border;
transient TitledBorder enabledTitledBorder;
transient TitledBorder disabledTitledBorder;
transient String title;
public JayPanel(){
super();
initaliseJayPanel("");
}
//other methods
}
edit : just tested and my JayPanel serializes on its own
and I still get it, the stack trace is useless at telling me where this com.sun.java.swing.plaf.windows.XPStyle is, I have not used anything called XPStyle (that i know of) and with all fields transient, how could there possibly be a NotSerializableException?
I would appreciate it if anyone could help me somehow find this "XPStyle" or decifer what the stack trace can tell me. Or any other usefull debugging tips!
Regards
edit: tested JayPanel, it works fine - so there must be something in my class that is not serializable. Even though everything is transient (i left the JayPanel code in, because its what I have done to try and make my other class work)