Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in JsUtils.prop, when fetching an empty String it returns null #361

Open
oheavy opened this issue Sep 24, 2015 · 0 comments
Open

Bug in JsUtils.prop, when fetching an empty String it returns null #361

oheavy opened this issue Sep 24, 2015 · 0 comments

Comments

@oheavy
Copy link

oheavy commented Sep 24, 2015

Hi,

I'm using GWT 2.7.0 and gwtquery 1.4.3 and I've encountered the following bug:
When using public static <T> T prop(JavaScriptObject o, Object id) to retrieve a property that contains an empty String, it instead returns null.
The following snippet of code can be used to replicate the problem:

JavaScriptObject jso = JavaScriptObject.createObject();
JsUtils.prop(jso, "property", "");
Object property = JsUtils.prop(jso, "property");

Here, I expected property to be an empty String, but instead it was null.

In order to get the empty String I had to use Properties, as can be seen in the following snippet of code:

JavaScriptObject jso = JavaScriptObject.createObject();
JsUtils.prop(jso, "property", "");
Properties propsJso = jso.cast();
String property = propsJso.getStr("property");

However, I expected the first snippet to return the same value.

Thanks,
Luís

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant