@@ -469,7 +469,7 @@ private static boolean internalAuthenticateAsUser(
469
469
boolean pwdAdded = false ;
470
470
471
471
Iterator <AuthenticationStep > it = steps .stream ().sorted ().iterator ();
472
- for (; it .hasNext (); ) {
472
+ while ( it .hasNext ()) {
473
473
AuthenticationStep step = it .next ();
474
474
if (!step .isEnabled ()) {
475
475
continue ;
@@ -537,7 +537,7 @@ private static boolean internalAuthenticateAsUser(
537
537
sendReturn (diags , wd , pwdField );
538
538
}
539
539
540
- for (; it .hasNext (); ) {
540
+ while ( it .hasNext ()) {
541
541
AuthenticationStep step = it .next ();
542
542
if (!step .isEnabled ()) {
543
543
continue ;
@@ -555,18 +555,15 @@ private static boolean internalAuthenticateAsUser(
555
555
incStatsCounter (loginPageUrl , AUTH_BROWSER_PASSED_STATS );
556
556
AuthUtils .sleep (TimeUnit .SECONDS .toMillis (waitInSecs ));
557
557
558
- if (context != null ) {
559
- if (context .getAuthenticationMethod ().getPollUrl () == null ) {
560
- // We failed to identify a suitable URL for polling.
561
- // This can happen for more traditional apps - refresh the current one in case
562
- // its a good option.
563
- wd .get (wd .getCurrentUrl ());
564
- AuthUtils .sleep (TimeUnit .SECONDS .toMillis (1 ));
565
- diags .recordStep (
566
- wd ,
567
- Constant .messages .getString (
568
- "authhelper.auth.method.diags.steps.refresh" ));
569
- }
558
+ if (context != null && context .getAuthenticationMethod ().getPollUrl () == null ) {
559
+ // We failed to identify a suitable URL for polling.
560
+ // This can happen for more traditional apps - refresh the current one in case
561
+ // its a good option.
562
+ wd .get (wd .getCurrentUrl ());
563
+ AuthUtils .sleep (TimeUnit .SECONDS .toMillis (1 ));
564
+ diags .recordStep (
565
+ wd ,
566
+ Constant .messages .getString ("authhelper.auth.method.diags.steps.refresh" ));
570
567
}
571
568
return true ;
572
569
}
@@ -755,7 +752,7 @@ public static Map<String, SessionToken> getResponseSessionTokens(HttpMessage msg
755
752
} catch (JSONException e ) {
756
753
LOGGER .debug (
757
754
"Unable to parse authentication response body from {} as JSON: {} " ,
758
- msg .getRequestHeader ().getURI (). toString () ,
755
+ msg .getRequestHeader ().getURI (),
759
756
responseData ,
760
757
e );
761
758
}
@@ -784,7 +781,7 @@ public static List<Pair<String, String>> getHeaderTokens(
784
781
String hv =
785
782
header .getValue ()
786
783
.replace (token .getValue (), "{%" + token .getToken () + "%}" );
787
- list .add (new Pair <String , String >(header .getName (), hv ));
784
+ list .add (new Pair <>(header .getName (), hv ));
788
785
}
789
786
}
790
787
}
@@ -817,7 +814,7 @@ protected static Map<String, SessionToken> getAllTokens(
817
814
} catch (JSONException e ) {
818
815
LOGGER .debug (
819
816
"Unable to parse authentication response body from {} as JSON: {}" ,
820
- msg .getRequestHeader ().getURI (). toString () ,
817
+ msg .getRequestHeader ().getURI (),
821
818
responseData );
822
819
}
823
820
}
@@ -949,15 +946,15 @@ public static void extractJsonTokens(
949
946
950
947
private static void extractJsonTokens (
951
948
Object obj , String parent , Map <String , SessionToken > tokens ) {
952
- if (obj instanceof JSONObject ) {
953
- extractJsonTokens (( JSONObject ) obj , parent , tokens );
954
- } else if (obj instanceof JSONArray ) {
955
- Object [] oa = (( JSONArray ) obj ) .toArray ();
949
+ if (obj instanceof JSONObject jsonObj ) {
950
+ extractJsonTokens (jsonObj , parent , tokens );
951
+ } else if (obj instanceof JSONArray jsonArr ) {
952
+ Object [] oa = (jsonArr .toArray () );
956
953
for (int i = 0 ; i < oa .length ; i ++) {
957
954
extractJsonTokens (oa [i ], parent + "[" + i + "]" , tokens );
958
955
}
959
- } else if (obj instanceof String ) {
960
- addToMap (tokens , new SessionToken (SessionToken .JSON_SOURCE , parent , ( String ) obj ));
956
+ } else if (obj instanceof String str ) {
957
+ addToMap (tokens , new SessionToken (SessionToken .JSON_SOURCE , parent , str ));
961
958
}
962
959
}
963
960
0 commit comments