Closed GoogleCodeExporter closed 9 years ago
I was able to reproduce this behavior. According to the documentation for the
getAttributes method of the SnippetsEntry object
(http://code.google.com/apis/gdata/jsdoc/1.10/index.html) the API returns a Map
from
attribute name to the Attribute object.
However when there are multiple instances of the attribute, as with
"image_link", the
Map value will be an Attribute array rather than an Attribute object, which
leads to
the ClassCastException.
If you need an immediate workaround you can pass the result of get() through the
following native function:
private native JsArray<Attribute> expand(JavaScriptObject jso) /*-{
if (jso.length) return jso;
else return [jso];
}-*/;
For example:
JsArray<Attribute> all = expand(entry.getAttributes().get("image_link"));
JsArray<Attribute> all = expand(entry.getAttributes().get("price"));
This would transform the output of get() into an Attribute array, even for
single-instance attributes, such as "price" here.
Original comment by bobbysoa...@gmail.com
on 21 Sep 2009 at 8:29
Original comment by bobbysoa...@gmail.com
on 21 Sep 2009 at 8:29
Fixed in version 2.0.1.
Original comment by bobbysoa...@gmail.com
on 1 Nov 2009 at 8:06
Original issue reported on code.google.com by
dean.mas...@gmail.com
on 16 Sep 2009 at 3:23