Bug in DateAndTime abtXmlFromTimeString:

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

Bug in DateAndTime abtXmlFromTimeString:

Postby Sam De Block » Mon Feb 05, 2007 3:00 am

There is a bug in DateAndTime abtXmlFromTimeString: which results in the milliseconds + timezoneoffset not being correctly parsed.

Run any of these examples and notice the difference.
Code: Select all
A1) DateAndTime abtXmlFromString: '1994-11-05T08:15:30-05:00'.
A2) DateAndTime abtXmlFromTimeString: '08:15:30-05:00'

B1) DateAndTime abtXmlFromString: '1994-11-05T13:15:30Z'.
B2) DateAndTime abtXmlFromTimeString: '13:15:30Z'.

C1) DateAndTime abtXmlFromString: '1994-11-05T13:15:30.123Z'.
C2) DateAndTime abtXmlFromTimeString: '13:15:30.123Z'.

The original code in abtXmlFromTimeString: results in the data stream being one position too far ahead.
Code: Select all
sec := ( data abrUpToAny: #( $+ $- $. )) abtAsInteger.

The code in abtXmlFromString: uses a different method to parse the seconds:
Code: Select all
sec := (data next:2) abtAsInteger.

So it's fixable in 2 ways:
A) replace the original code with:
Code: Select all
sec := (data next:2) abtAsInteger.

B)Or insert
Code: Select all
data skip: -1.
right before the following line:
Code: Select all
   mSec := self abtXmlMillisecondsFrom: data. :
Sam De Block
Posts: 17
Joined: Thu Nov 09, 2006 4:25 am

Postby tc » Tue Feb 06, 2007 12:38 am

Hi Sam!

Thanks for the post, we'll jump on that bug to get it fixed.

Posts: 304
Joined: Tue Oct 17, 2006 7:40 am
Location: Raleigh, NC

Postby wembley » Wed Mar 28, 2007 6:39 am

Sam -

Fix will be available in V7.5.1.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest