Proba naprawienia]

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2021-01-09 17:05:00 +01:00
parent df90a57715
commit 3335155cd8
Signed by: y0rune
GPG Key ID: F204C385F57EB348

View File

@ -48,23 +48,22 @@ public class UsosApiService {
* @return UserApiResponse modle contatining desired values
*/
public UserApiResponse getUserData(String usosId) {
final UserApiResponse apiResponse = new UserApiResponse();
try {
final OAuth10aService service = new ServiceBuilder(apikey).apiSecret(apisecret)
.build(UsosOauth1Service.instance());
final UserApiResponse apiResponse = new UserApiResponse();
try {
final OAuth10aService service = new ServiceBuilder(apikey).apiSecret(apisecret)
.build(UsosOauth1Service.instance());
final OAuthRequest request = new OAuthRequest(Verb.GET, apiUrl + "/services/users/user?user_id=" + usosId);
service.signRequest(new OAuth1AccessToken("", ""), request);
System.out.println("PRZED TRY");
try (Response response = service.execute(request)) {
System.out.println("TRY");
final String json = response.getBody();
final OAuthRequest request = new OAuthRequest(Verb.GET, apiUrl + "/services/users/user?user_id=" + usosId);
service.signRequest(new OAuth1AccessToken("", ""), request);
System.out.println("PRZED TRY");
try (Response response = service.execute(request)) {
System.out.println("TRY");
final String json = response.getBody();
System.out.println(json == null);
System.out.println(json == "null");
System.out.println(json.equals("null"));
//System.out.println(json.equals(null));
System.out.println(json);
if (json != "null" && json != null){
if (!json.equals("null")){
System.out.println(json);
System.out.println(json.getClass());
System.out.println("Przed Object");
@ -78,13 +77,13 @@ public class UsosApiService {
System.out.println(map.get(NAME_FIELD));
apiResponse.setSurname(map.get(SURNAME_FIELD));
System.out.println(map.get(SURNAME_FIELD));
}
}
} catch (IOException | InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
}
} catch (IOException | InterruptedException | ExecutionException e) {
e.printStackTrace();
}
return apiResponse;
return apiResponse;
}
}