@@ -138,13 +138,12 @@ public Pair<User, Account> findUserAccountByApiKey(String apiKey) {
138138 PreparedStatement pstmt = null ;
139139 Pair <User , Account > userAcctPair = null ;
140140 try {
141- String sql = FIND_USER_ACCOUNT_BY_API_KEY ;
142- pstmt = txn .prepareAutoCloseStatement (sql );
141+ pstmt = txn .prepareAutoCloseStatement (FIND_USER_ACCOUNT_BY_API_KEY );
143142 pstmt .setString (1 , apiKey );
144143 ResultSet rs = pstmt .executeQuery ();
145144 // TODO: make sure we don't have more than 1 result? ApiKey had better be unique
146145 if (rs .next ()) {
147- User u = new UserVO (rs .getLong (1 ));
146+ UserVO u = new UserVO (rs .getLong (1 ));
148147 u .setUuid (rs .getString (2 ));
149148 u .setUsername (rs .getString (3 ));
150149 u .setAccountId (rs .getLong (4 ));
@@ -170,10 +169,10 @@ public Pair<User, Account> findUserAccountByApiKey(String apiKey) {
170169 a .setApiKeyAccess (apiKeyAccess );
171170 }
172171
173- userAcctPair = new Pair <User , Account >(u , a );
172+ userAcctPair = new Pair <>(u , a );
174173 }
175174 } catch (Exception e ) {
176- logger .warn ("Exception finding user/acct by api key: " + apiKey , e );
175+ logger .warn ("Exception finding user/acct by api key: {}" , apiKey , e );
177176 }
178177 return userAcctPair ;
179178 }
@@ -342,11 +341,9 @@ public long getDomainIdForGivenAccountId(long id) {
342341 domain_id = account_vo .getDomainId ();
343342 }
344343 catch (Exception e ) {
345- logger .warn ("getDomainIdForGivenAccountId: Exception :" + e .getMessage ());
346- }
347- finally {
348- return domain_id ;
344+ logger .warn ("Can not get DomainId for the given AccountId; exception message : {}" , e .getMessage ());
349345 }
346+ return domain_id ;
350347 }
351348
352349 @ Override
0 commit comments