aboutsummaryrefslogtreecommitdiffstats
path: root/gwtquery-core/src/main
diff options
context:
space:
mode:
authorAdolfo Panizo <adolfo.panizo@gmail.com>2014-03-04 13:38:26 +0100
committerAdolfo Panizo <adolfo.panizo@gmail.com>2014-03-05 07:40:59 +0100
commitfeb7f50a21f7f7b95ca067c6fcf4ec01524715f3 (patch)
tree1774348fa3df09920713650967d5e47ea7f7b872 /gwtquery-core/src/main
parent28b68df025e52a4c39a9e55b1e0196cdbb057045 (diff)
downloadgwtquery-feb7f50a21f7f7b95ca067c6fcf4ec01524715f3.tar.gz
gwtquery-feb7f50a21f7f7b95ca067c6fcf4ec01524715f3.zip
Exception when parsing empty response.getText(), and the dataType is
necessary for the request.
Diffstat (limited to 'gwtquery-core/src/main')
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java32
1 files changed, 17 insertions, 15 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java
index e11e5923..b0ee21ad 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java
@@ -145,22 +145,24 @@ public class Ajax extends GQuery {
Response response = arguments(0);
Request request = arguments(1);
Object retData = response.getText();
- try {
- if ("xml".equalsIgnoreCase(dataType)) {
- retData = JsUtils.parseXML(response.getText());
- } else if ("json".equalsIgnoreCase(dataType)) {
- retData = GQ.create(response.getText());
- } else {
- retData = response.getText();
- if ("script".equalsIgnoreCase(dataType)) {
- ScriptInjector.fromString((String)retData).setWindow(window).inject();
+ if (retData != null && !"".equals(retData)) {
+ try {
+ if ("xml".equalsIgnoreCase(dataType)) {
+ retData = JsUtils.parseXML(response.getText());
+ } else if ("json".equalsIgnoreCase(dataType)) {
+ retData = GQ.create(response.getText());
+ } else {
+ retData = response.getText();
+ if ("script".equalsIgnoreCase(dataType)) {
+ ScriptInjector.fromString((String)retData).setWindow(window).inject();
+ }
+ }
+ } catch (Exception e) {
+ if (GWT.isClient() && GWT.getUncaughtExceptionHandler() != null) {
+ GWT.getUncaughtExceptionHandler().onUncaughtException(e);
+ } else {
+ e.printStackTrace();
}
- }
- } catch (Exception e) {
- if (GWT.isClient() && GWT.getUncaughtExceptionHandler() != null) {
- GWT.getUncaughtExceptionHandler().onUncaughtException(e);
- } else {
- e.printStackTrace();
}
}
return new Object[]{retData, "success", request, response};