axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jürgen Keil (JIRA) <j...@apache.org>
Subject [jira] [Created] (AXIS2-5448) WSDL2C: sporadic failures in deserializer code generated for xs:date, returns wrong date value
Date Sun, 04 Nov 2012 11:54:12 GMT
Jürgen Keil created AXIS2-5448:
----------------------------------

             Summary: WSDL2C: sporadic failures in deserializer code generated for xs:date,
returns wrong date value
                 Key: AXIS2-5448
                 URL: https://issues.apache.org/jira/browse/AXIS2-5448
             Project: Axis2
          Issue Type: Bug
          Components: adb, codegen
    Affects Versions: 1.6.2
         Environment: iOS 5.1 or MacOS X 10.7.5

            Reporter: Jürgen Keil


The xml deserializer code generated for xs:date calls axutil_date_time_deserialize_date_time()
instead of axutil_date_time_deserialize_date() to convert a date from string format (e.g.
"2012-09-30")
to a axutil_date_time_t.

This results in random failures parsing the date. The deserialized date sometimes contains
the current date instead of the date value that was present in the xml data.


How does it fail in axutil_date_time_deserialize_date_time() ? It fails because:

- A wrong sscanf format string is used to parse the date, sscanf is unable to fill all arguments.
sscanf returns 3, and axutil_date_time_deserialize_date_time() does not recognize this failure.

- after that,  axutil_date_time_deserialize_date_time() accesses uninitialized variables for
"hour",
"min", and "sec", and may randomly return parse errors, because hour, min, sec contain a value
that is out of range.  The end result is that sometimes no parsed date is written to the deserialized
date, and we get the current date instead.

In the debugger, we have this:

(gdb) bt
#0  axutil_date_time_deserialize_date_time (date_time=0x1001024d0, env=0x1001009b0, date_time_str=0x100102410
"2012-09-30") at date_time.c:275
#1  0x0000000100002a9d in adb_ISODate_deserialize_from_string (_ISODate=0x100102380, env=0x1001009b0,
node_value=0x100102410 "2012-09-30", parent=0x0) at adb_ISODate.c:180
#2  0x0000000100002bcd in adb_ISODate_deserialize_obj (_ISODate=0x100102380, env=0x1001009b0,
dp_parent=<value temporarily unavailable, due to optimizations>, dp_is_early_node_valid=0x0,
dont_care_minoccurs=1352029547) at adb_ISODate.c:256
#3  0x0000000100001de8 in adb_Document_deserialize_obj (_Document=0x100101a40, env=0x1001009b0,
dp_parent=<value temporarily unavailable, due to optimizations>, dp_is_early_node_valid=<value
temporarily unavailable, due to optimizations>, dont_care_minoccurs=0) at adb_Document.c:367
#4  0x0000000100001548 in main (argc=<value temporarily unavailable, due to optimizations>,
argv=<value temporarily unavailable, due to optimizations>) at test.c:44
(gdb) n
271	    if(*date_time_str == '-')
(gdb) n     
275	    sscanf(date_time_str + is_year_neg, "%d-%d-%dT%d:%d:%fZ", &year, &mon, &day,
&hour, &min, &sec);
(gdb) p hour
$8 = 1352028776
(gdb) p min 
$9 = 1113587712
(gdb) p sec
$10 = 1.4821702e-39
(gdb) n
271	    if(*date_time_str == '-')
(gdb) print $rax
$11 = 3
(gdb) p hour
$12 = 1352028776
(gdb) p min
$13 = 1113587712
(gdb) p sec
$14 = 1.4821702e-39
(gdb) p year
$15 = 2012
(gdb) p mon
$17 = 9
(gdb) p day
$18 = 30
(gdb) c
Continuing.

OK               (<-- xml deserializer returned AXIS2_SUCCESS)
2012-11-04  (<-- wrong date, expected date is 2012-09-30)




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message