Closed
Bug 282245
Opened 19 years ago
Closed 19 years ago
SOAPCall encodes SOAPParameter with floating point number value with comma (,) instead of point (.)
Categories
(Core Graveyard :: Web Services, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla1.8beta2
People
(Reporter: martin.honnen, Assigned: bzbarsky)
Details
Attachments
(3 files)
1.27 KB,
text/html
|
Details | |
2.64 KB,
patch
|
peterv
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
1.91 KB,
patch
|
peterv
:
review+
peterv
:
superreview+
|
Details | Diff | Splinter Review |
With Mozilla 1.8 trunk builds (just tested with latest nightly Mozilla 1.8b Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050214 but also seen one some earlier nightlies) I find that SOAPCall encodes floating point number values the wrong way, instead of the point (.) a comma (,) is used to separate the decimals. This does not happen with 1.7 releases (tested with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0). I am testing on a German edition of Windows XP but of course in SOAP the encoding of a number should not in any way be influenced by the locale settings, the XSD data type representation for doubles always uses a '.' as the separator. Test case will be uploaded next, it uses JavaScript to create one SOAPParameter with a floating point number value, then creates a SOAPCall, calls encode on it and then outputs the serialization of the SOAP message. With the Mozilla 1.8 nightly the result is e.g. <number-input xsi:type="xs:double">2,500000</number-input> for the JavaScript number value 2.5 passed in while Mozilla 1.7 releases correctly encode as <number-input xsi:type="xs:double">2.500000</number-input>
Reporter | ||
Comment 1•19 years ago
|
||
Reporter | ||
Comment 2•19 years ago
|
||
I am just trying some older builds to try to find when the bug was introduced: Bug does not occur with Mozilla 1.8a Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a) Gecko/20040430 Bug does occur with Mozilla 1.8a2 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a2) Gecko/20040705
Reporter | ||
Comment 3•19 years ago
|
||
I have tried to look into the C++ code to understand where the comma might come from respectively where the floating point number value is converted to a string and I think it is done in <http://lxr.mozilla.org/mozilla/source/extensions/webservices/soap/src/nsDefaultSOAPEncoder.cpp#992> the value is originally an nsIVariant and the method GetAsAString is called to make it into a string. Then I have looked which other components use nsIVariant and <http://lxr.mozilla.org/mozilla/ident?i=nsIVariant> shows that the send method of XMLHttpRequest also takes a variant. Indeed a test case <http://www34.brinkster.com/libertydevelop/mozillaBugs/soap/floatingPointXMLHttp.html> using script and XMLHttpRequest to send a floating point JavaScript number value to an ASP script that simply echoes back what it receives shows the same problem as the SOAP encoding, floating point number values such as e.g. 2.5 are converted to the string e.g. 2,500000 with a comma (,) instead of a dot (.) to separate the decimals in Mozilla 1.8 nightlies, at least on my machine here with the German edition of Windows XP. In Germany floating point numbers indeed use the comma as the separator so it could be that GetAsString has somewhere been changed to look at the locale settings when converting floating point numbers. But that is just a guess. Boris, do you have an idea what is happening here, why the floating point numbers are converted to a string with a comma as the decimal separator in Mozilla 1.8 nightlies for more than six months it seems? For a SOAP parameter that is certainly plain wrong, I don't know whether other uses of nsIVariant needed that change.
Comment 4•19 years ago
|
||
I would imagine that PR_smprintf is doing the locale stuff. That's basically what the variant is doing when you convert to string.
Assignee | ||
Comment 5•19 years ago
|
||
Yes, absolutely. Using PR_smprintf for locale-insensitive stuff is wrong, wrong, wrong. See http://lxr.mozilla.org/seamonkey/source/xpcom/string/src/nsStringObsolete.cpp#1300 Is there any reason this code isn't just using AppendFloat/AppendInt on an nsC?String, anyway? Note that the code has been this way for nsIVariant since 2001. So either SOAP started using nsIVariant recently, or something. nsIVariant continues to be severely underdefined as to what it returns; jst, dbaron do you think anything would break if I weaned it off PR_smprintf?
Comment 6•19 years ago
|
||
I don't see any reason not to use the Append[Float|Int] functions.
Assignee | ||
Comment 7•19 years ago
|
||
I didn't use AppendInt for the ints because it doesn't really do unsigned stuff. In any case, that method just calls PR_snprintf, so we should be OK there.
Assignee | ||
Updated•19 years ago
|
Attachment #174498 -
Flags: superreview?(dbaron)
Attachment #174498 -
Flags: review?(dbradley)
Attachment #174498 -
Flags: superreview?(dbaron) → superreview+
Comment 8•19 years ago
|
||
Note that there's a bunch of PR_smprintf's in nsDefaultSOAPEncoder.cpp too.
Assignee | ||
Comment 9•19 years ago
|
||
Attachment #174586 -
Flags: superreview?(peterv)
Attachment #174586 -
Flags: review?(peterv)
Updated•19 years ago
|
Attachment #174586 -
Flags: superreview?(peterv)
Attachment #174586 -
Flags: superreview+
Attachment #174586 -
Flags: review?(peterv)
Attachment #174586 -
Flags: review+
Comment 10•19 years ago
|
||
Comment on attachment 174498 [details] [diff] [review] Patch Though you don't really need to cast. Either way, r=peterv.
Attachment #174498 -
Flags: review?(dbradley) → review+
Assignee | ||
Updated•19 years ago
|
Assignee: web-services → bzbarsky
Target Milestone: --- → mozilla1.8beta2
Assignee | ||
Comment 11•19 years ago
|
||
Fixed.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 12•19 years ago
|
||
Verifying fixed with Mozilla 1.8b2 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050226)
Status: RESOLVED → VERIFIED
Updated•7 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•