Merge pull request #1058 from xhh/str-response-offset

Fix bug with truncated lone string responses for Android/Scala clients
This commit is contained in:
wing328 2015-08-08 11:10:02 +08:00
commit f27eb7e0de
4 changed files with 4 additions and 4 deletions

View File

@ -216,7 +216,7 @@ public class ApiInvoker {
}
else if(String.class.equals(cls)) {
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
return json.substring(1, json.length() - 2);
return json.substring(1, json.length() - 1);
else
return json;
}

View File

@ -59,7 +59,7 @@ class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
if (cls == classOf[String]) {
json match {
case s: String => {
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 2)
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 1)
else s
}
case _ => null

View File

@ -216,7 +216,7 @@ public class ApiInvoker {
}
else if(String.class.equals(cls)) {
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
return json.substring(1, json.length() - 2);
return json.substring(1, json.length() - 1);
else
return json;
}

View File

@ -59,7 +59,7 @@ class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
if (cls == classOf[String]) {
json match {
case s: String => {
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 2)
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 1)
else s
}
case _ => null