|
-
September 30th, 1999, 12:43 PM
#1
Serialisation
Desparately seeking Help.
We are using Netscape Communicator Ver 4.5.
We are using a frame in our applet to display some information. We are
also providing an option to serialize the content of the frame and
download to the local(client) machine. We are using Netscape capability
API to get permission to write into local machine. The download works
fine until we select a button that throws a modal dialog window. After
we open and close the modal dialog box, if we try to download, the
download fails with the following error in Java console:
java.io.NotSerializableException: netscape.applet.MozillaAppletContext
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.io.IOException.<init>(Compiled Code)
at java.io.ObjectStreamException.<init>(Compiled Code)
at java.io.NotSerializableException.<init>(Compiled Code)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at java.io.ObjectOutputStream.outputArray(Compiled Code)
However if we make the dialog as non-modal it is able to serialize
without problem. But making it non-modal creates other problems for us.
I would greatly appreciate if you can share whatever you know about this
problem.
Here's a sample program we developed that can be used to simulate this
problem.
void downld_ActionPerformed_Interaction1(java.awt.event.ActionEvent
event)
{
FileOutputStream fop_fileopstream = null;
ObjectOutputStream oos_seropstream = null;
Object obj_evtSource = null;
//PrivilegeManager.enablePrivilege("UniversalFileWrite");
// save report to local machine
try
{
PrivilegeManager.enablePrivilege("UniversalFileWrite");
}
catch (netscape.security.ForbiddenTargetException p_exfte)
{
return;
}
try
{
// create a ouput stream to store the report in a file
fop_fileopstream = new
FileOutputStream("c:\\vidhya\\reportview.ser");
// create a objet stream for the file stream
oos_seropstream = new ObjectOutputStream(fop_fileopstream);
oos_seropstream.writeObject(pop);
}
catch(InvalidClassException p_exinvclassexception)
{
p_exinvclassexception.printStackTrace();
}
catch(NotSerializableException p_exnotserexception)
{
p_exnotserexception.printStackTrace();
}
catch(IOException p_exioexception)
{
p_exioexception.printStackTrace();
}
finally
{
try
{
oos_seropstream.close();
fop_fileopstream.close();
}
catch(IOException p_ioeException){}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|