Skip to content

Commit d521e5f

Browse files
committed
Merge pull request #16 from Liuchy1/master
modify ResponseWrapper fix jsonArrry bug
2 parents 8a04227 + 6a8ae96 commit d521e5f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/main/java/cn/jpush/api/common/resp/ResponseWrapper.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import org.slf4j.Logger;
1010
import org.slf4j.LoggerFactory;
1111

12+
import java.util.Scanner;
13+
1214
public class ResponseWrapper {
1315
private static final Logger LOG = LoggerFactory.getLogger(ResponseWrapper.class);
1416
private static final int RESPONSE_CODE_NONE = -1;
@@ -48,7 +50,7 @@ public void setErrorObject() {
4850
if( element instanceof JsonArray) {
4951
JsonArray array = (JsonArray) element;
5052
for(int i = 0; i < array.size(); i++) {
51-
if(array.get(i).getAsString().contains("error")) {
53+
if(array.get(i).getAsJsonObject().has("error")) {
5254
errorObj = array.get(i).getAsJsonObject();
5355
break;
5456
}
@@ -91,15 +93,15 @@ public String toString() {
9193
return _gson.toJson(this);
9294
}
9395

94-
public class ErrorObject {
96+
public static class ErrorObject {
9597
public long msg_id;
96-
public ErrorEntity error;
98+
public ErrorEntity error;
9799
}
98100

99-
public class ErrorEntity {
101+
public static class ErrorEntity {
100102
public int code;
101103
public String message;
102-
104+
103105
@Override
104106
public String toString() {
105107
return _gson.toJson(this);

0 commit comments

Comments
 (0)