NotSerializable Exception

Questions on using RSyntaxTextArea should go here.

Moderator: robert

NotSerializable Exception

Postby latusaki » Tue Apr 17, 2012 1:53 pm

I want to send RSyntaxTextDocuments over the network. Although I am getting the following exception :
Caused by: java.io.NotSerializableException: org.fife.ui.rsyntaxtextarea.modes.JavaTokenMaker

Until now I was replacing the RSyntaxDocument with plain document for sending and on receive replace it with a RSyntaxDocument again.
Although it turns out this approach creates some other problems.
Would it be complicated making RSyntaxDocument serializable ?
Thanks !
latusaki
 

Re: NotSerializable Exception

Postby robert » Thu Apr 19, 2012 3:45 am

I just pushed a change to SVN (revision 480) that should make it serializable, though I did not test it. Try checking out the latest and see if it works for you. Let me know if you have any more problems!
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: NotSerializable Exception

Postby latusaki » Thu Apr 19, 2012 1:54 pm

Thanks for your response Roberts!
I think I tried same fix with you before. This is what I get:

Exception in thread "pool-5-thread-1" java.lang.IllegalArgumentException: java.io.NotSerializableException: javax.swing.text.StyleConstants is not serializable as a key in an AttributeSet
latusaki
 

Re: NotSerializable Exception

Postby latusaki » Thu Apr 19, 2012 2:01 pm

Maybe making a seriaizable subclass of javax.swing.text.StyleConstants could fix this?
latusaki
 

Re: NotSerializable Exception

Postby robert » Sun Apr 22, 2012 5:16 am

Hmm, this sounds tough, because RSTA doesn't explicitly use the SyntaxConstants class anywhere, which means this is something stemming from the Swing text package in general. You might have an easier time just serializing the Content of the RSyntaxDocument and sending that? That should be serializable, and smaller than the entire RSyntaxDocument. You might have to subclass RSyntaxDocument and override the getContent() method to make it public to do this.
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: NotSerializable Exception

Postby latusaki » Sun Apr 22, 2012 1:10 pm

Yes thats what I have been doing so far. Take the text off the document send it and put it back in a document on receive. This causes some problems (doesn't have to do with rsyntax). In any case thanks for checking it !
latusaki
 


Return to Help

Who is online

Users browsing this forum: No registered users and 4 guests

cron