You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by "woj-tek (via GitHub)" <gi...@apache.org> on 2023/06/29 22:44:09 UTC
[GitHub] [james-project] woj-tek opened a new pull request, #1619: JAMES-3922: Enforce non-null Property contract and add missing null-check in Prope
woj-tek opened a new pull request, #1619:
URL: https://github.com/apache/james-project/pull/1619
`org.apache.james.mailbox.store.mail.model.Property#Property()` already had contract (in it's javadoc) specifying that all parameters must be non-null - I added explicit check for it.
Moreover, checking possible call places, one of `PropertyBuilder#setProperty()` already had null-check, so I added same check to remaining to methods responsible for setting properties (one taking `List` and one taking `Map`).
@chibenwa suggested filtering properties with null value before persisting, but IMHO this approach is better and should prevent any other similar issues.
--
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: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] woj-tek commented on a diff in pull request #1619: JAMES-3922: Enforce non-null Property contract and add missing null-check in Prope
Posted by "woj-tek (via GitHub)" <gi...@apache.org>.
woj-tek commented on code in PR #1619:
URL: https://github.com/apache/james-project/pull/1619#discussion_r1247304468
##########
mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilderTest.java:
##########
@@ -26,12 +26,27 @@
import org.apache.james.mailbox.store.mail.model.Property;
import org.junit.jupiter.api.Test;
+import java.util.*;
Review Comment:
Is it preferred to have explicit imports?
--
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: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] woj-tek commented on a diff in pull request #1619: JAMES-3922: Enforce non-null Property contract and add missing null-check in Prope
Posted by "woj-tek (via GitHub)" <gi...@apache.org>.
woj-tek commented on code in PR #1619:
URL: https://github.com/apache/james-project/pull/1619#discussion_r1247304004
##########
mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Property.java:
##########
@@ -51,11 +53,11 @@ public class Property {
* @param localName not null
* @param value not null
*/
- public Property(String namespace, String localName, String value) {
+ public Property(@NonNull String namespace, @NonNull String localName, @NonNull String value) {
Review Comment:
Annotation is descriptive, but I also added explicit checks inside via `Objects.requireNonNull()`
--
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: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] vttranlina commented on a diff in pull request #1619: JAMES-3922: Enforce non-null Property contract and add missing null-check in Prope
Posted by "vttranlina (via GitHub)" <gi...@apache.org>.
vttranlina commented on code in PR #1619:
URL: https://github.com/apache/james-project/pull/1619#discussion_r1247300122
##########
mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Property.java:
##########
@@ -51,11 +53,11 @@ public class Property {
* @param localName not null
* @param value not null
*/
- public Property(String namespace, String localName, String value) {
+ public Property(@NonNull String namespace, @NonNull String localName, @NonNull String value) {
Review Comment:
just curious. this constructor will throw an Exception when input is null or is it just a "description Annotation"?
##########
mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilderTest.java:
##########
@@ -26,12 +26,27 @@
import org.apache.james.mailbox.store.mail.model.Property;
import org.junit.jupiter.api.Test;
+import java.util.*;
Review Comment:
```suggestion
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
```
--
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: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
[GitHub] [james-project] chibenwa merged pull request #1619: JAMES-3922: Enforce non-null Property contract and add missing null-check in Prope
Posted by "chibenwa (via GitHub)" <gi...@apache.org>.
chibenwa merged PR #1619:
URL: https://github.com/apache/james-project/pull/1619
--
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: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org