Open dankurka opened 9 years ago
Reported by rdayal@google.com
on 2011-11-04 20:07:23
This happens with my setup as well - deeper in encode the object you're encoding is
expected to have an AutoBean already made for it, but somehow in `create` the nested
objects are not autobeaned.
I'm using 2.3, _before_ the move to web.bindery
Reported by rileylark
on 2011-11-16 21:04:13
Another work around detailed here:
https://groups.google.com/forum/#!msg/google-web-toolkit/nvIotNHy-Io/YcbECPWd-v4J
instead of:
beanList.getList().add( new Bean("hello1") );
use:
beanList.getList().add( beanFactory.bean(new Bean("hello1")).as() );
Reported by aidanok
on 2012-04-21 18:11:56
Hi,
we've ran into the same problem and I did some debugging and thought I'd share. In
the generated classes for the 'usual' objects (non lists it seems) there is a chunk
of code that looks fairly similar to this:
public packageDateTime getDateTime() {
package.DateTime toReturn = FreezablePagingLoadConfigAutoBean.this.getWrapped().getFreezeDateTime();
if (toReturn != null) {
if (FreezablePagingLoadConfigAutoBean.this.isWrapped(toReturn)) {
toReturn = FreezablePagingLoadConfigAutoBean.this.getFromWrapper(toReturn);
} else {
toReturn = new auto.bean.package.DateTimeAutoBean(getFactory(), toReturn).as();
}
}
return toReturn;
}
It seems like the generated code checks whether or not the AutoBean is registered and
if not, it creates it in the else clause.
When I take a look at my generated iterator implementation I find this:
public java.lang.Object next() {
java.lang.Object toReturn = IteratorAutoBean.this.getWrapped().next();
if (toReturn != null) {
if (IteratorAutoBean.this.isWrapped(toReturn)) {
toReturn = IteratorAutoBean.this.getFromWrapper(toReturn);
} else {
// THIS SEEMS TO BE WRONG
}
}
IteratorAutoBean.this.call("next", toReturn );
return toReturn;
}
As you can see the else clause is empty. Here is where the NPE originates from in our
code. It seems like the Iterator is generated wrong (?).
In our code we try to encode a LoadConfiguration (ExtGWT class) which contains a List
of SortInfoBean (ExtGWT class).
Hope this helps.
-- artur
Reported by artur.kronenberg
on 2012-08-22 08:14:49
To me this reads as a misuse of AutoBean rather than a bug.
You should use the Factory interface for creating instances of your AutoBean
This line:
>>IBeanList beanList = new BeanList();
should be:
>>IBeanList beanList = factory.createBeanList();
If you want to wrap an existing instance create a method for it on the factory interface
like this:
>> IBeanList beanList = factory.createBeanList(myBeanList);
Reported by kurka.daniel
on 2012-11-12 13:39:36
Invalid
No Daniel, per comment #4 and various other reports (e.g. http://stackoverflow.com/q/11530451/116472
) it also happens when the list comes from a wrapped bean.
Reported by t.broyer
on 2012-11-12 17:09:05
Accepted
Originally reported on Google Code with ID 6904
Reported by
ufoscout@yahoo.it
on 2011-10-18 09:14:45