Closed GoogleCodeExporter closed 9 years ago
I found out why it's only returning 200 entries. In the userservice.cs file,
in the
Query method, a call to feed.Parse leaves the original "next" AtomLink in the
feed
and appends the new "next" AtomLink to the feed. When a call to
feed.Links.FindService("next", null) is made, it returns the first "next"
AtomLink it
finds, when it should return the AtomLink from the last call. I made a change
in my
copy of the code as a temporary fix, but I'd imagine that you guys would want
to
change the behavior of wherever the feed.Parse call goes. To get it to work
for me I
got a list of all the "next" AtomLinks, and used the last in the list for my
new Uri.
Sorry I didn't go further with it, but I'm a VB guy. Semicolons and squiggly
brackets make me agitated. :)
I changed the code to:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
public UserFeed Query(UserQuery feedQuery)
{
try
{
Stream feedStream = Query(feedQuery.Uri);
UserFeed feed = new UserFeed(feedQuery.Uri, this);
feed.Parse(feedStream, AlternativeFormat.Atom);
feedStream.Close();
if (feedQuery.RetrieveAllUsers)
{
AtomLink next, prev = null;
List<AtomLink> nexts;
prev = new AtomLink();
next = feed.Links.FindService("next", null);
while ((next != null) && (next.HRef != prev.HRef))
{
prev = next;
feedStream = Query(new Uri(next.HRef.ToString()));
feed.Parse(feedStream,AlternativeFormat.Atom);
feedStream.Close();
nexts = feed.Links.FindServiceList("next", null);
next = nexts[nexts.Count - 1];
}
}
return feed;
}
catch (GDataRequestException e)
{
AppsException a = AppsException.ParseAppsException(e);
throw (a == null ? e : a);
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
From:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
public UserFeed Query(UserQuery feedQuery)
{
try
{
Stream feedStream = Query(feedQuery.Uri);
UserFeed feed = new UserFeed(feedQuery.Uri, this);
feed.Parse(feedStream, AlternativeFormat.Atom);
feedStream.Close();
if (feedQuery.RetrieveAllUsers)
{
AtomLink next, prev = null;
while ((next = feed.Links.FindService("next", null)) != null &&
next != prev)
{
feedStream = Query(new Uri(next.HRef.ToString()));
feed.Parse(feedStream, AlternativeFormat.Atom);
feedStream.Close();
prev = next;
}
}
return feed;
}
catch (GDataRequestException e)
{
AppsException a = AppsException.ParseAppsException(e);
throw (a == null ? e : a);
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Original comment by edwin.la...@gmail.com
on 2 Dec 2009 at 11:00
Thanks for the detailed bug report. This helped a lot. The bug is that
feed.Parse()
did not take into account that it might be called several times on the same
object.
I modified the .Parse() implementation to reset it's collections before
parsing. If
you would be so kind to download new DLLs from the subversion repository and
try out
if that fixes your issue.
Frank Mantek
Google
Original comment by fman...@gmail.com
on 8 Dec 2009 at 1:36
Thanks Frank,
It works now!
Original comment by edwin.la...@gmail.com
on 8 Dec 2009 at 6:14
Then i declare it FIXED :)
Original comment by fman...@gmail.com
on 9 Dec 2009 at 8:40
Original issue reported on code.google.com by
edwin.la...@gmail.com
on 2 Dec 2009 at 12:45