Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

BUG: JSOHelper.convertToMap(JavaScriptObject)

$
0
0
I've been trying to make a CLIENTCUSTOM DataSource with a service layer that uses XMLs. Details of the specific bug I've encountered while doing this are in the code below.

Code:

import java.util.logging.Logger;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.smartgwt.client.data.XMLTools;

public class Bug implements EntryPoint {
        private final Logger log = Logger.getLogger("Bug");

        @Override
        public void onModuleLoad() {
        }

        public Bug() {
                try {
                        // Create a RequestBuilder and send a GET request for the XML
                        new RequestBuilder(RequestBuilder.GET, URL.encode("ds/simple.xml")).sendRequest(null, new RequestCallback() {

                                @Override
                                public void onResponseReceived(Request request, Response response) {

                                        Object xmlObj = XMLTools.selectNodes(response.getText(), "//property");
                                        // 2 nodes are found according to the xPath
                                        log.info(xmlObj.toString());
                                        if (xmlObj instanceof JavaScriptObject) {
                                                /*
                                                * This is where it fails a 'too much recursion'
                                                * exception is thrown (uncomment to see error)
                                                */
                                                // JSOHelper.convertToMap((JavaScriptObject) xmlObj);
                                        }
                                }

                                @Override
                                public void onError(Request request, Throwable exception) {

                                }
                        });
                } catch (RequestException e) {
                        e.printStackTrace();
                }
        }

}

Am I using the API's incorrectly or is this a actual bug? I tried using RPCManger to send the request and got the same error (if that makes a difference).

Attached is the respective xml.

PS: I am aware of SmartGWT automatic databinding unfortunately our service layer is too 'unique' for it too work out of the box :(.

SmartClient Version: v9.0_2014-01-15/EVAL Deployment

Attached Files
File Type: xml simple.xml (165 Bytes)

Viewing all articles
Browse latest Browse all 4756

Trending Articles