Skip to content

Commit

Permalink
Fixed a null walltime bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chirayukong committed Mar 17, 2017
1 parent 16f25b8 commit 27c06e7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/java/edu/pitt/dbmi/ccd/rest/client/util/JsonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Set;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import edu.pitt.dbmi.ccd.rest.client.dto.algo.AlgorithmInfo;
Expand All @@ -33,14 +34,16 @@ public static JsonWebToken parseJSONObjectToJsonWebToken(JSONObject jObj) {
long issuedTime = jObj.getLong("issuedTime");
long lifetime = jObj.getLong("lifetime");
long expireTime = jObj.getLong("expireTime");
JSONArray wallTimeArray = jObj.getJSONArray("wallTime");
String[] wallTime = null;

if(wallTimeArray.length() > 0){
wallTime = new String[wallTimeArray.length()];
for(int index=0;index<wallTimeArray.length();index++){
Object obj = wallTimeArray.get(index);
wallTime[index] = obj.toString();
if(!jObj.isNull("wallTime")){
JSONArray wallTimeArray = jObj.getJSONArray("wallTime");
if(wallTimeArray != null && wallTimeArray.length() > 0){
wallTime = new String[wallTimeArray.length()];
for(int index=0;index<wallTimeArray.length();index++){
Object obj = wallTimeArray.get(index);
wallTime[index] = obj.toString();
}
}
}

Expand Down

0 comments on commit 27c06e7

Please sign in to comment.