Re: Problem passing a SetValueProxy as a parameter in RequestFactory?

2011-05-13 Thread Eric Andresen
It looks like I'm running into the problem inside EntityCodex.decode() :  
In the red code below, I see it iterate over all three items in my 
collection, but each time the element that comes out of the decode call 
has the same hashCode, so the HashSet ignores it.  The hashCode always seems 
to be 1832980284, regardless of what the actual hashCode of my underlying 
object is.

Does anyone know if it is possible to control this behavior?  I guess worst 
case I could change my Set to a List and just remove any duplicates myself, 
but it seems weird to have Set support if it doesn't work right.

Thanks,
Eric


public static Object decode(EntitySource source, Class? type, Class? 
elementType,
  Splittable split) {
if (split == null || split == Splittable.NULL) {
  return null;
}

// Collection support
if (elementType != null) {
  CollectionObject collection = null;
  if (List.class.equals(type)) {
collection = new ArrayListObject();
  } else if (Set.class.equals(type)) {
collection = new HashSetObject();
  } else {
throw new UnsupportedOperationException();
  }

  // Decode values
  if (ValueCodex.canDecode(elementType)) {
for (int i = 0, j = split.size(); i  j; i++) {
  if (split.isNull(i)) {
collection.add(null);
  } else {
Object element = ValueCodex.decode(elementType, split.get(i));
collection.add(element);
  }
}
  } else {
for (int i = 0, j = split.size(); i  j; i++) {
  if (split.isNull(i)) {
collection.add(null);
  } else {
Object element = decode(source, elementType, null, 
split.get(i));
collection.add(element);
  }
}
  }
  return collection;
}

if (source.isEntityType(type) || source.isValueType(type) || 
EntityProxyId.class.equals(type)) {
  return source.getBeanForPayload(split).as();
}

// Fall back to values
return ValueCodex.decode(type, split);
  }

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Problem passing a SetValueProxy as a parameter in RequestFactory?

2011-05-13 Thread Brian Reilly
This sounds like a problem that I ran into this as well, and even had
a chance to sit down with David Chandler at Google I/O to look over
it. Your case is more straightforward than mine (which involved trying
to add to a Set on fetched ValueProxy) but I'd bet it's the same
problem. I'm planning to file a bug about it after gathering a little
more information and simplifying my test case.

In the mean time, Lists don't seem to have the same problem, if that
helps you at all.

-- Brian


On Thu, May 12, 2011 at 4:19 PM, Eric Andresen ericandre...@gmail.com wrote:
 I have an application that creates a SetMyClassProxy (a ValueProxy), and
 sends that set across the wire using the RequestFactory.
 When I add 3 distinct elements into the set and fire the context, I only get
 one item in the set on the server side.
 What is interesting is that I can see my setters being called inside my bean
 class, so I know all three instances are constructed.  I only see the
 hashCode() method called once, meaning something inside the RequestFactory
 must be clobbering them before they're added to the HashSet.
 Has anyone seen this behavior before?  I have other places in the
 application that pass SetEntityProxys across the wire, so it's not
 happening all the time.
 Thanks,
 Eric

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Problem passing a SetValueProxy as a parameter in RequestFactory?

2011-05-13 Thread Eric Andresen
I switched my Sets to Lists and it works no problem.
What is interesting is that I use SetEntityProxy all over the place
without any trouble, but when I use the SetValueProxy it seems to fail.
 If I had to speculate, i'd guess that the RF is trying to recreate the
collection using a hashcode based on the id of the proxy, which doesn't
exist for a ValueProxy.


Thanks,
Eric

On Fri, May 13, 2011 at 8:58 AM, Brian Reilly brian.irei...@gmail.comwrote:

 This sounds like a problem that I ran into this as well, and even had
 a chance to sit down with David Chandler at Google I/O to look over
 it. Your case is more straightforward than mine (which involved trying
 to add to a Set on fetched ValueProxy) but I'd bet it's the same
 problem. I'm planning to file a bug about it after gathering a little
 more information and simplifying my test case.

 In the mean time, Lists don't seem to have the same problem, if that
 helps you at all.

 -- Brian


 On Thu, May 12, 2011 at 4:19 PM, Eric Andresen ericandre...@gmail.com
 wrote:
  I have an application that creates a SetMyClassProxy (a ValueProxy),
 and
  sends that set across the wire using the RequestFactory.
  When I add 3 distinct elements into the set and fire the context, I only
 get
  one item in the set on the server side.
  What is interesting is that I can see my setters being called inside my
 bean
  class, so I know all three instances are constructed.  I only see the
  hashCode() method called once, meaning something inside the
 RequestFactory
  must be clobbering them before they're added to the HashSet.
  Has anyone seen this behavior before?  I have other places in the
  application that pass SetEntityProxys across the wire, so it's not
  happening all the time.
  Thanks,
  Eric
 
  --
  You received this message because you are subscribed to the Google Groups
  Google Web Toolkit group.
  To post to this group, send email to google-web-toolkit@googlegroups.com
 .
  To unsubscribe from this group, send email to
  google-web-toolkit+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/google-web-toolkit?hl=en.
 

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Problem passing a SetValueProxy as a parameter in RequestFactory?

2011-05-13 Thread Brian Reilly
I did some debugging, looking into the GWT source, and it seems like
there's a problem with decoding the elements of the set. The JSON sent
over the wire looks fine, but when the data structure is being
constructed on the server side, all of the properties are null at the
time that hashCode() is called on the server-side proxy instance. So,
it's trying to pay attention to more than the ID, but it's doing it
too soon.. before the proxies have been fully initialized.

I submitted an issue for this:
http://code.google.com/p/google-web-toolkit/issues/detail?id=6354

-- Brian


On Fri, May 13, 2011 at 11:26 AM, Eric Andresen ericandre...@gmail.com wrote:
 I switched my Sets to Lists and it works no problem.
 What is interesting is that I use SetEntityProxy all over the place
 without any trouble, but when I use the SetValueProxy it seems to fail.
  If I had to speculate, i'd guess that the RF is trying to recreate the
 collection using a hashcode based on the id of the proxy, which doesn't
 exist for a ValueProxy.


 Thanks,
 Eric
 On Fri, May 13, 2011 at 8:58 AM, Brian Reilly brian.irei...@gmail.com
 wrote:

 This sounds like a problem that I ran into this as well, and even had
 a chance to sit down with David Chandler at Google I/O to look over
 it. Your case is more straightforward than mine (which involved trying
 to add to a Set on fetched ValueProxy) but I'd bet it's the same
 problem. I'm planning to file a bug about it after gathering a little
 more information and simplifying my test case.

 In the mean time, Lists don't seem to have the same problem, if that
 helps you at all.

 -- Brian


 On Thu, May 12, 2011 at 4:19 PM, Eric Andresen ericandre...@gmail.com
 wrote:
  I have an application that creates a SetMyClassProxy (a ValueProxy),
  and
  sends that set across the wire using the RequestFactory.
  When I add 3 distinct elements into the set and fire the context, I only
  get
  one item in the set on the server side.
  What is interesting is that I can see my setters being called inside my
  bean
  class, so I know all three instances are constructed.  I only see the
  hashCode() method called once, meaning something inside the
  RequestFactory
  must be clobbering them before they're added to the HashSet.
  Has anyone seen this behavior before?  I have other places in the
  application that pass SetEntityProxys across the wire, so it's not
  happening all the time.
  Thanks,
  Eric
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Google Web Toolkit group.
  To post to this group, send email to
  google-web-toolkit@googlegroups.com.
  To unsubscribe from this group, send email to
  google-web-toolkit+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/google-web-toolkit?hl=en.
 

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.


 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Problem passing a SetValueProxy as a parameter in RequestFactory?

2011-05-12 Thread Eric Andresen
I have an application that creates a SetMyClassProxy (a ValueProxy), and 
sends that set across the wire using the RequestFactory.

When I add 3 distinct elements into the set and fire the context, I only get 
one item in the set on the server side.

What is interesting is that I can see my setters being called inside my bean 
class, so I know all three instances are constructed.  I only see the 
hashCode() method called once, meaning something inside the RequestFactory 
must be clobbering them before they're added to the HashSet.

Has anyone seen this behavior before?  I have other places in the 
application that pass SetEntityProxys across the wire, so it's not 
happening all the time.  

Thanks,
Eric

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.