[jdom-interest] org.jdom.Namespace not implementing Serializa ble?

Humphrey Sheil Humphrey.Sheil at Kadius.com
Fri Jul 21 02:44:08 PDT 2000


Hmm,

two strange things.  

1.  I sent a reply to the original mail to say that I was going to use
StringBuffer instead to work around this RMI limitation, but the original
reply I sent and not my second reply got sent out instead.

2.  I inspected the J2SE 1.3 source code (that I have) to see if this
limitation was still in place and it is.  Check out line 347 in
java.io.DataOutputStream:

	if (utflen > 65535)
	    throw new UTFDataFormatException();

The version string at the top of this file is  "* @(#)DataOutputStream.java
1.32 00/02/02".  Maybe there is a later version released which corresponds
to the release notes you specified below.

I'll run a quick test to see what the real deal is here.  In the meantime,
StringBuffer it is.


Humphrey


-----Original Message-----
From: Peterbauer Karl [mailto:Peterbau at kapsch.net]
Sent: 21 July 2000 10:42
To: 'Humphrey Sheil'; 'Jools Enticknap'
Cc: 'jdom-interest at jdom.org'
Subject: AW: [jdom-interest] org.jdom.Namespace not implementing
Serializa ble?


Please note that the 64k string limit has been eliminated in Sun's JDK 1.3,
at least they claim to, see
http://java.sun.com/j2se/1.3/docs/guide/rmi/relnotes.html
(Clearly this is no solution if you have older or other VM's out in the
field...)

Personally I would appreciate that any Object (Document, Element) which
implements java.io.Serializable can in fact be serialized ;-) 
In case of RMI, passing a Document as String clearly undermines the goal of
RMI, and if the client is an Applet, it has to load yet another jar....

-Karl

> -----Urspr> üngliche Nachricht-----
> Von:	Humphrey Sheil [SMTP:Humphrey.Sheil at kadius.com]
> Gesendet am:	Freitag, 21. Juli 2000 10:14
> An:	'Jools Enticknap'
> Cc:	'jdom-interest at jdom.org'
> Betreff:	RE: [jdom-interest] org.jdom.Namespace not implementing
Serializa ble?
> 
> Thanks,
> 
> I should have traversed the entire object graph to find this.
> 
> I was hoping to avoid having to serialize the Document to a string.  The
JDK
> has imposed a hard 64k limit on the serialized form of a string (in
> java.io.DataOutputStream), since it uses the first two bytes of the
> underlying array to store the size of the array.  Any bigger and a
> UTFDataFormatException will be thrown.
> 
> Humphrey
> 
> -----Original Message-----
> From: Jools Enticknap [mailto:jools at jools.org]
> Sent: 20 July 2000 19:32
> To: Humphrey Sheil
> Cc: 'jdom-interest at jdom.org'
> Subject: Re: [jdom-interest] org.jdom.Namespace not implementing
> Serializable?
> 
> 
> 
> 
> > 1.  Should Namespace be Serializable?  I don't think so - the javadoc
says
> > that it is not just a namespace - it is also a factory for creating
them.
> 
> It's still an issue, there was a discussion about it, check the archives.
> 
> > 
> > 2.  Anybody got any idea why RMI tries to serialize Namespace in the
first
> > place when I'm only trying to pass around an instance of a Document
> (which
> > contains no references to Namespace)?
> > 
> 
> A Document contains references to Element, which in turn has references to
> Namespace. For the object to be serialized all the objects it references
> to must also be serializable.
> 	
> Can I suggest that you serialize the document into a String and then send
> that over the wire. The client can then create a JDOM object from the
> String using the SAXBuilder class.
> 
> 
> 
> --Jools
> 
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
> t.com
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list