Hi,

In the series of bugs in new calendar .NET API 1.1.0.0, there is another bug 
and i found it through the following :

I am trying to add an exception in a Google Event as follows :

OriginalEvent originalEvent = new OriginalEvent();
originalEvent.OriginalStartTime = originalWhen;
originalEvent.Href = selfURIContent;
originalEvent.IdOriginal = Common.GetGcalEventSubID(selfURIContent);
gCalExceptionEvent.OriginalEvent = originalEvent;

As soon as i executed my code, it threw an exception at : 
originalEvent.OriginalStartTime

which is 

//////////////////////////////////////////////////////////////////////
/// <summary>accessor method public original Start Time</summary> 
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public When OriginalStartTime
{
get 
{ 
return FindExtension(GDataParserNameTable.XmlWhenElement,
BaseNameTable.gNamespace) as When;
}
set 
{ 
ReplaceExtension(GDataParserNameTable.XmlWhenElement,
BaseNameTable.gNamespace, value);
}
}

and 

public void ReplaceExtension(string localName, string ns, Object obj)
{
DeleteExtensions(localName, ns);
this.ExtensionElements.Add(obj);
}


/// <summary>
/// Delete's all Extensions from the Extension list that match
/// a localName and a Namespace. 
/// </summary>
/// <param name="localName">the local name to find</param>
/// <param name="ns">the namespace to match, if null, ns is ignored</param>
/// <returns>int - the number of deleted extensions</returns>
public int DeleteExtensions(string localName, string ns)
{
// Find them first
ArrayList arr = FindExtensions(localName, ns);
foreach (object ob in arr)
{
this.extensions.Remove(ob);
}
return arr.Count;
}


basically, the erros is being thrown by FindExtensiosn method since it uses 
this.extensions which is null

/// <summary>
/// Finds all ExtensionElement based on it's local name
/// and it's namespace. If namespace is NULL, allwhere
/// the localname matches is found. If there are extensionelements that do 
/// not implment ExtensionElementFactory, they will not be taken into account
/// Primary use of this is to find XML nodes
/// </summary>
/// <param name="localName">the xml local name of the element to find</param>
/// <param name="ns">the namespace of the elementToPersist</param>
/// <returns>none</returns>
public ArrayList FindExtensions(string localName, string ns)
{
return Utilities.FindExtensions(this.extensions, localName, ns, new 
ArrayList());
}

I think that instead of using this.extensions directly, it should have been :

//////////////////////////////////////////////////////////////////////
/// <summary>the list of extensions for this container
/// the elements in that list MUST implement IExtensionElementFactory 
/// and IExtensionElement</summary> 
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public ArrayList ExtensionElements
{
get
{
if (this.extensions == null)
{
this.extensions = new ArrayList();
}
return this.extensions;
}
set { this.extensions = value; }
}

so that the function FindExtensions look like :

 
/// <summary>
/// Finds all ExtensionElement based on it's local name
/// and it's namespace. If namespace is NULL, allwhere
/// the localname matches is found. If there are extensionelements that do 
/// not implment ExtensionElementFactory, they will not be taken into account
/// Primary use of this is to find XML nodes
/// </summary>
/// <param name="localName">the xml local name of the element to find</param>
/// <param name="ns">the namespace of the elementToPersist</param>
/// <returns>none</returns>
public ArrayList FindExtensions(string localName, string ns)
{
return Utilities.FindExtensions(ExtensionElements, localName, ns, new 
ArrayList());
}


Please correct me if i am wrong somewhere.

Thanks
Kulvinder Singh


       
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to