@@ -37,25 +37,26 @@ static SqlFedAuthToken getSqlFedAuthToken(SqlFedAuthInfo fedAuthInfo, String use
3737 ActiveDirectoryAuthentication .JDBC_FEDAUTH_CLIENT_ID , user , password , null );
3838
3939 AuthenticationResult authenticationResult = future .get ();
40- SqlFedAuthToken fedAuthToken = new SqlFedAuthToken (authenticationResult .getAccessToken (),
41- authenticationResult .getExpiresOnDate ());
4240
43- return fedAuthToken ;
41+ return new SqlFedAuthToken ( authenticationResult . getAccessToken (), authenticationResult . getExpiresOnDate ()) ;
4442 } catch (MalformedURLException | InterruptedException e ) {
4543 throw new SQLServerException (e .getMessage (), e );
4644 } catch (ExecutionException e ) {
4745 MessageFormat form = new MessageFormat (SQLServerException .getErrString ("R_ADALExecution" ));
4846 Object [] msgArgs = {user , authenticationString };
4947
50- // the cause error message uses \\n\\r which does not give correct format
51- // change it to \r\n to provide correct format
48+ /*
49+ * the cause error message uses \\n\\r which does not give correct format change it to \r\n to provide
50+ * correct format
51+ */
5252 String correctedErrorMessage = e .getCause ().getMessage ().replaceAll ("\\ \\ r\\ \\ n" , "\r \n " );
5353 AuthenticationException correctedAuthenticationException = new AuthenticationException (
5454 correctedErrorMessage );
5555
56- // SQLServerException is caused by ExecutionException, which is caused by
57- // AuthenticationException
58- // to match the exception tree before error message correction
56+ /*
57+ * SQLServerException is caused by ExecutionException, which is caused by AuthenticationException to match
58+ * the exception tree before error message correction
59+ */
5960 ExecutionException correctedExecutionException = new ExecutionException (correctedAuthenticationException );
6061
6162 throw new SQLServerException (form .format (msgArgs ), null , 0 , correctedExecutionException );
@@ -69,8 +70,10 @@ static SqlFedAuthToken getSqlFedAuthTokenIntegrated(SqlFedAuthInfo fedAuthInfo,
6970 ExecutorService executorService = Executors .newFixedThreadPool (1 );
7071
7172 try {
72- // principal name does not matter, what matters is the realm name
73- // it gets the username in principal_name@realm_name format
73+ /*
74+ * principal name does not matter, what matters is the realm name it gets the username in
75+ * principal_name@realm_name format
76+ */
7477 KerberosPrincipal kerberosPrincipal = new KerberosPrincipal ("username" );
7578 String username = kerberosPrincipal .getName ();
7679
@@ -83,10 +86,8 @@ static SqlFedAuthToken getSqlFedAuthTokenIntegrated(SqlFedAuthInfo fedAuthInfo,
8386 ActiveDirectoryAuthentication .JDBC_FEDAUTH_CLIENT_ID , username , null , null );
8487
8588 AuthenticationResult authenticationResult = future .get ();
86- SqlFedAuthToken fedAuthToken = new SqlFedAuthToken (authenticationResult .getAccessToken (),
87- authenticationResult .getExpiresOnDate ());
8889
89- return fedAuthToken ;
90+ return new SqlFedAuthToken ( authenticationResult . getAccessToken (), authenticationResult . getExpiresOnDate ()) ;
9091 } catch (InterruptedException | IOException e ) {
9192 throw new SQLServerException (e .getMessage (), e );
9293 } catch (ExecutionException e ) {
@@ -97,15 +98,18 @@ static SqlFedAuthToken getSqlFedAuthTokenIntegrated(SqlFedAuthInfo fedAuthInfo,
9798 // the case when Future's outcome has no AuthenticationResult but exception
9899 throw new SQLServerException (form .format (msgArgs ), null );
99100 } else {
100- // the cause error message uses \\n\\r which does not give correct format
101- // change it to \r\n to provide correct format
101+ /*
102+ * the cause error message uses \\n\\r which does not give correct format change it to \r\n to provide
103+ * correct format
104+ */
102105 String correctedErrorMessage = e .getCause ().getMessage ().replaceAll ("\\ \\ r\\ \\ n" , "\r \n " );
103106 AuthenticationException correctedAuthenticationException = new AuthenticationException (
104107 correctedErrorMessage );
105108
106- // SQLServerException is caused by ExecutionException, which is caused by
107- // AuthenticationException
108- // to match the exception tree before error message correction
109+ /*
110+ * SQLServerException is caused by ExecutionException, which is caused by AuthenticationException to
111+ * match the exception tree before error message correction
112+ */
109113 ExecutionException correctedExecutionException = new ExecutionException (
110114 correctedAuthenticationException );
111115
0 commit comments