bmhm commented on a change in pull request #240:
URL: https://github.com/apache/shiro/pull/240#discussion_r439869149
##########
File path:
config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java
##########
@@ -290,7 +293,9 @@ private String parseBeanId(String lhs) {
}
//SHIRO-413: init method must be called for constructed objects that
are Initializable
- LifecycleUtils.init(objects.values());
+ //SHIRO-778: onInit method on AuthenticatingRealm is called twice
+ objects.keySet().stream().filter(key ->
!Optional.ofNullable(kvPairs).orElseGet(HashMap::new).keySet().contains(key))
+ .forEach(key -> LifecycleUtils.init(objects.get(key)));
Review comment:
Having worked with a lot of lambdas, two suggestions here:
* Line break after `.stream()` and each operation (after `.filter()` and
`.forEach()` in this case).
* refactor out the `.filter()` contents. It is much easier to read a method
name here than to grasp the contents of the whole filter operation and where
parentheses actually ends.
##########
File path:
config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java
##########
@@ -53,6 +43,19 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.beans.PropertyDescriptor;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
Review comment:
is the reordering necessary for such a small change? Or do we want to
change the ordering in general for v2.0.0?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]