[Mono-bugs] [Bug 547675] New: [PATCH] DateTimeOffset fails to parse timezone fragment when its value has no separator
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Oct 16 13:05:03 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=547675
Summary: [PATCH] DateTimeOffset fails to parse timezone
fragment when its value has no separator
Classification: Mono
Product: Mono: Class Libraries
Version: SVN
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: aenomoto at novell.com
QAContact: mono-bugs at lists.ximian.com
Found By: Community User
Created an attachment (id=322908)
--> (http://bugzilla.novell.com/attachment.cgi?id=322908)
patch and test
Copying the bug report from "santa marta"
http://irc.gimite.net/channel/mono-jp/archive/20091014
http://smdn.invisiblefulmoon.net/misc/forum/programming/#n8
DateTimeOffset.Parse() fails when the format string contains "zzz" and the
actual value string lacks time separator (':'). See repro for the actual
errors:
---- repro ----
using System;
namespace DateTimeOffsetTest {
class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine(Environment.OSVersion);
Console.WriteLine(Environment.Version);
Console.WriteLine();
foreach (var dtm in new[] {
"13/Oct/2009:22:35:35 +09:00",
"13/Oct/2009:22:35:35 +0900",
"13/Oct/2009:22:35:35 +09:30",
"13/Oct/2009:22:35:35 +0930",
}) {
try {
Console.Write("{0} => ", dtm);
Console.WriteLine(DateTimeOffset.ParseExact(dtm, "d/MMM/yyyy:HH:mm:ss
zzz", System.Globalization.CultureInfo.InvariantCulture));
}
catch (FormatException ex) {
Console.WriteLine(ex);
}
}
}
}
}
---- expected on .net 2.0 ----
13/Oct/2009:22:35:35 +09:00 => 2009/10/13 22:35:35 +09:00
13/Oct/2009:22:35:35 +0900 => 2009/10/13 22:35:35 +09:00
13/Oct/2009:22:35:35 +09:30 => 2009/10/13 22:35:35 +09:30
13/Oct/2009:22:35:35 +0930 => 2009/10/13 22:35:35 +09:30
---- actual results on mono ----
13/Oct/2009:22:35:35 +09:00 => 2009/10/13 22:35:35 +09:00
13/Oct/2009:22:35:35 +0900 => System.FormatException: Invalid format string
at System.DateTimeOffset.ParseExact (System.String input, System.String[]
formats, IFormatProvider formatProvider, DateTimeStyles styles) [0x00000]
at System.DateTimeOffset.ParseExact (System.String input, System.String
format, IFormatProvider formatProvider, DateTimeStyles styles) [0x00000]
at System.DateTimeOffset.ParseExact (System.String input, System.String
format, IFormatProvider formatProvider) [0x00000]
at DateTimeOffsetTest.MainClass.Main (System.String[] args) [0x00000]
13/Oct/2009:22:35:35 +09:30 => 2009/10/13 22:35:35 +09:30
13/Oct/2009:22:35:35 +0930 => System.FormatException: Invalid format string
at System.DateTimeOffset.ParseExact (System.String input, System.String[]
formats, IFormatProvider formatProvider, DateTimeStyles styles) [0x00000]
at System.DateTimeOffset.ParseExact (System.String input, System.String
format, IFormatProvider formatProvider, DateTimeStyles styles) [0x00000]
at System.DateTimeOffset.ParseExact (System.String input, System.String
format, IFormatProvider formatProvider) [0x00000]
at DateTimeOffsetTest.MainClass.Main (System.String[] args) [0x00000]
A fix is attached.
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list