rootvector2 commented on code in PR #682:
URL: 
https://github.com/apache/commons-collections/pull/682#discussion_r3419448957


##########
src/main/java/org/apache/commons/collections4/map/PredicatedMap.java:
##########
@@ -155,6 +156,11 @@ public void putAll(final Map<? extends K, ? extends V> 
mapToCopy) {
     private void readObject(final ObjectInputStream in) throws IOException, 
ClassNotFoundException {
         in.defaultReadObject();
         map = (Map<K, V>) in.readObject(); // (1)
+        try {

Review Comment:
   added `Objects.requireNonNull` on the map read back from the stream, 
matching the `super(map)` guard in the constructor. the key/value predicates 
can be null by design so those stay unchecked.



##########
src/main/java/org/apache/commons/collections4/collection/PredicatedCollection.java:
##########
@@ -409,6 +412,22 @@ public boolean addAll(final Collection<? extends E> coll) {
         return decorated().addAll(coll);
     }
 
+    /**
+     * Deserializes the collection in using a custom routine.
+     *
+     * @param in  the input stream
+     * @throws IOException if an error occurs while reading from the stream
+     * @throws ClassNotFoundException if an object read from the stream cannot 
be loaded
+     */
+    private void readObject(final ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        in.defaultReadObject();

Review Comment:
   added `Objects.requireNonNull` on `decorated()` and `predicate` before the 
loop, same null guards the constructor enforces.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to