From 3335155cd8dfcab599cbf9e4984667a0c1167ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Sat, 9 Jan 2021 17:05:00 +0100 Subject: [PATCH] Proba naprawienia] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Woźniak --- .../plannaplan/services/UsosApiService.java | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/buisnesslogic/src/main/java/com/plannaplan/services/UsosApiService.java b/buisnesslogic/src/main/java/com/plannaplan/services/UsosApiService.java index 364211b..015c61d 100755 --- a/buisnesslogic/src/main/java/com/plannaplan/services/UsosApiService.java +++ b/buisnesslogic/src/main/java/com/plannaplan/services/UsosApiService.java @@ -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; } }