[Mono-devel-list] About bug 75566

Alberto Avila albertoavila at gmail.com
Sat Jul 16 15:33:41 EDT 2005


Hi folks!

I've just submited the bug 75566 that you can find on
http://bugzilla.ximian.com/show_bug.cgi?id=75566

After i submited the bug i start looking at the current head revision
on the svn repository and i found that the exception is thrown on the
file DecimalFormatter.cs located at:

http://svn.myrealbox.com/viewcvs/trunk/mcs/class/corlib/System/DecimalFormatter.cs?view=markup

 in the method:  public static string NumberToString(string format,
NumberFormatInfo nfi, Decimal value)

In this line:

            if (!DecimalFormatter.ParseFormat(format, out specifier,
out precision))
            {
                throw new FormatException (Locale.GetText ("The
specified format is invalid"));
            }

I looked at the ParseFormat source and find out kinda weird, the line
of code where the methos returns false (making NumbertToString throw a
exception) is:

            int length = format.Length;
            if (length < 1 || length > 3)
                return false;

Why the method only accepts format strings betwen 1 and 3 characters?
After that line there is a series of if-else to do stuff where the
length of the string is 1,2 or 3 characters.

Why does it do that? Or do i just get lost in the code?

Looks pretty weird for me.

Greets
		    


-- 
Alberto Avila
Desarrollador



More information about the Mono-devel-list mailing list