You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by du...@us.ibm.com on 2000/07/17 17:34:33 UTC

RE: cvs commit: xml-soap/java/src/org/apache/soap/encoding SOAPMa ppingRegistry.java

Actually, they wouldn't have to register it as the serializer for their
type. If they had a reference to this serializer (that they had retrieved),
they could invoke it directly. This might occur where someone wants to use
the functionality that's already in the pre-registered serializer for
String. I'll go either way on this particular point, because I originally
had it running everything through, was "coerced" into changing it, and then
"coerced" into thinking I was right the first time (and then happily
changed it back). Anybody else want to weigh in on this?

-Matt

Glen Daniels <gd...@allaire.com> on 07/17/2000 11:32:19 AM

Please respond to soap-dev@xml.apache.org

To:   "'soap-dev@xml.apache.org'" <so...@xml.apache.org>
cc:
Subject:  RE: cvs commit: xml-soap/java/src/org/apache/soap/encoding SOAPMa
      ppingRegistry.java




Hm.  But if it really *isn't* possible for any of the other serialized
types
to produce reserved characters, we're going to take an unnecessary
performance hit by cleaning every string.... right?  So I don't understand
why you agreed that changing it was a good idea after putting forth a
perfectly valid-seeming reason for keeping it the way you originally did
it?
:)

I mean if the only way someone can screw this up is to go in and change
SOAPMappingRegistry to register  "ser" as the serializer for their new
type... that's probably acceptable risk.

--Glen

> -----Original Message-----
> From: duftler@us.ibm.com [mailto:duftler@us.ibm.com]
> Sent: Monday, July 17, 2000 9:39 AM
> To: soap-dev@xml.apache.org
> Subject: RE: cvs commit: xml-soap/java/src/org/apache/soap/encoding
> SOAPMappingRegistry.java
>
>
> The reason I originally had it the other way was because
> java.lang.String
> is the only type of object that uses this serializer whose
> toString() can
> generate reserved characters. The only way this logic could
> go wrong would
> be for some client code to retrieve a serializer for a String (or a
> primitive or wrapper), and then to in fact serialize
> something else using
> the retrieved serializer. Since all the classes this serializer is
> registered for are final, someone would really have to want
> to generate
> reserved characters for this to happen.
>
> And after saying all this, I agree with you and have changed it. ;-)
>
> -Matt
>
> "Steven McDowall" <sj...@aptest.com> on 07/14/2000 01:56:04 PM
>
> Please respond to soap-dev@xml.apache.org
>
> To:   <so...@xml.apache.org>
> cc:
> Subject:  RE: cvs commit: xml-soap/java/src/org/apache/soap/encoding
>       SOAPMappingRegistry.java
>
>
>
>
>
> Looking at the code, I agree with Glen :-)
>
> I don't see any flaws with the following logic :
>
>      String content = Utils.cleanString(src.toString()) ;
>
>
> By always cleaning the string, we are safe from the "end
> users" ability to
> override the "toString" method of whatever random object and
> issuing a ">"
> there, which again would cause nasty problems.. :-)
>
> Better safe than sorry probably ... :-)
>
> -Steve
>
> -----Original Message-----
> From: Glen Daniels [mailto:gdaniels@allaire.com]
> Sent: Friday, July 14, 2000 12:55 PM
> To: 'soap-dev@xml.apache.org'
> Subject: RE: cvs commit: xml-soap/java/src/org/apache/soap/encoding
> SOAPMappingRegistry.java
>
>
>
> Does it really make sense to put the check for an explicit
> String object in
> there?  Wouldn't we want to just always clean the string
> representations of
> the serialized objects so as not to confuse the XML parser?
> Is it possible
> for any other type that would be handled here to spit out
> reserved chars?
>
> --G
>
> > -----Original Message-----
> > From: duftler@locus.apache.org [mailto:duftler@locus.apache.org]
> > Sent: Friday, July 14, 2000 1:00 PM
> > To: xml-soap-cvs@apache.org
> > Subject: cvs commit: xml-soap/java/src/org/apache/soap/encoding
> > SOAPMappingRegistry.java
> >
> >
> > duftler     00/07/14 10:00:01
> >
> >   Modified:    java/src/org/apache/soap/encoding
> > SOAPMappingRegistry.java
> >   Log:
> >   The serializer for java.lang.String will now escape the following
> >   characters: & " ' < >
> >   The Utils.cleanString(String) method was already there, it just
> >   wasn't being called by this serializer.
> >
> >   Revision  Changes    Path
> >   1.5       +5 -1
> > xml-soap/java/src/org/apache/soap/encoding/SOAPMappingRegistry.java
> >
> >   Index: SOAPMappingRegistry.java
> >
> ===================================================================
> >   RCS file:
> > /home/cvs/xml-soap/java/src/org/apache/soap/encoding/SOAPMappi
> > ngRegistry.java,v
> >   retrieving revision 1.4
> >   retrieving revision 1.5
> >   diff -u -r1.4 -r1.5
> >   --- SOAPMappingRegistry.java   2000/07/08 04:05:06  1.4
> >   +++ SOAPMappingRegistry.java   2000/07/14 17:00:01  1.5
> >   @@ -158,7 +158,11 @@
> >                                                 nsStack,
> >                                                 xjmr);
> >
>   -        sink.write(src.toString() + "</" + context + '>');
> >   +        String content = (javaType == String.class)
> >   +                         ? Utils.cleanString(src.toString())
> >   +                         : src.toString();
> >   +
> >   +        sink.write(content + "</" + context + '>');
> >
> >            nsStack.popScope();
> >          }
> >
> >
> >
> >
>
>
>
>