Project

General

Profile

« Previous | Next » 

Revision 60282

[Users | Trunk]: Fix exception when a user is not yer registered to openaire

View differences:

modules/dnet-openaire-users/trunk/src/main/java/eu/dnetlib/openaire/usermanagement/utils/RegistryCalls.java
62 62
        params.put("coid", coid);
63 63
        params.put("mail", email);
64 64
        JsonElement response = httpUtils.get("co_people.json", params);
65
        return (response != null) ? response.getAsJsonObject().get("CoPeople").getAsJsonArray().get(0).getAsJsonObject().get("Id").getAsInt() : null;
65
        if(response != null) {
66
            JsonArray coPeople = response.getAsJsonObject().get("CoPeople").getAsJsonArray();
67
            if(coPeople.size() > 0) {
68
                return coPeople.get(0).getAsJsonObject().get("Id").getAsInt();
69
            }
70
        }
71
        return null;
66 72
    }
67 73

  
68 74
    /**

Also available in: Unified diff