[jira] Created: (OFBIZ-770) Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (OFBIZ-770) Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)

Nicolas Malin (Jira)
Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)
------------------------------------------------------------------------------------------

                 Key: OFBIZ-770
                 URL: https://issues.apache.org/jira/browse/OFBIZ-770
             Project: OFBiz (The Open for Business Project)
          Issue Type: Improvement
    Affects Versions: SVN trunk
            Reporter: Stefan Huehner
            Priority: Trivial
         Attachments: ofbiz_isEmpty1.diff

Hi,

this task is to keep track of the conversion of hardcoded isEmpty checks to the existing UtilValidate methods.


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-770) Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Huehner updated OFBIZ-770:
---------------------------------

    Attachment: ofbiz_isEmpty1.diff

Hi,

patch with converts the first bunch of files.

Please keep the issue open..

> Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)
> ------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-770
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-770
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>    Affects Versions: SVN trunk
>            Reporter: Stefan Huehner
>            Priority: Trivial
>         Attachments: ofbiz_isEmpty1.diff
>
>
> Hi,
> this task is to keep track of the conversion of hardcoded isEmpty checks to the existing UtilValidate methods.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-770) Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477745 ]

Jacopo Cappellato commented on OFBIZ-770:
-----------------------------------------

Stefan,

two issues in your patch:

1) the format of it doesn't look right; there should be the following sections:
Index: applications/content/src/org/ofbiz/content/content/ContentServices.java
===================================================================

before each file modified

2) in TruitionCoReg.java the following modifications change the behavior of the logic:

-                if (emCol == null || emCol.size() == 0) {
+                if (UtilValidate.isEmpty(emCol)) {
                     emCol = ContactHelper.getContactMech(party, null, "EMAIL_ADDRESS", false);
-                }
-                if (emCol != null && emCol.size() > 0) {
-                    GenericValue emVl = (GenericValue) emCol.iterator().next();
+                } else {
+                     GenericValue emVl = (GenericValue) emCol.iterator().next();
                     if (emVl != null) {
                         emailAddress = emVl.getString("infoString");
                     }

I've committed (rev. 514366) a modified version of your patch, thanks.

Jacopo


> Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)
> ------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-770
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-770
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>    Affects Versions: SVN trunk
>            Reporter: Stefan Huehner
>            Priority: Trivial
>         Attachments: ofbiz_isEmpty1.diff
>
>
> Hi,
> this task is to keep track of the conversion of hardcoded isEmpty checks to the existing UtilValidate methods.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-770) Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477785 ]

Stefan Huehner commented on OFBIZ-770:
--------------------------------------

Grr, haven't thought this one through. Thanks again for catching it.

> Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)
> ------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-770
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-770
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>    Affects Versions: SVN trunk
>            Reporter: Stefan Huehner
>            Priority: Trivial
>         Attachments: ofbiz_isEmpty1.diff
>
>
> Hi,
> this task is to keep track of the conversion of hardcoded isEmpty checks to the existing UtilValidate methods.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-770) Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Huehner updated OFBIZ-770:
---------------------------------

    Attachment: ofbiz_isEmpty2.diff

Hi,

this patch converts the rest of the framework to using the isEmpty method for (==null || .size() == 0).

Three changes used (== null && .size() == 0) which is impossible and the cases look like bugs where || should have been used. The patch converts these as well and fixes these bugs. Affected files are:
- EntityJoinOperator
- CatalinaContainer


> Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)
> ------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-770
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-770
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>    Affects Versions: SVN trunk
>            Reporter: Stefan Huehner
>            Priority: Trivial
>         Attachments: ofbiz_isEmpty1.diff, ofbiz_isEmpty2.diff
>
>
> Hi,
> this task is to keep track of the conversion of hardcoded isEmpty checks to the existing UtilValidate methods.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-770) Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marco Risaliti updated OFBIZ-770:
---------------------------------

      Component/s: framework
    Fix Version/s: SVN trunk

> Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)
> ------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-770
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-770
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Stefan Huehner
>            Priority: Trivial
>             Fix For: SVN trunk
>
>         Attachments: ofbiz_isEmpty1.diff, ofbiz_isEmpty2.diff
>
>
> Hi,
> this task is to keep track of the conversion of hardcoded isEmpty checks to the existing UtilValidate methods.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-770) Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wickersheimer Jeremy updated OFBIZ-770:
---------------------------------------

    Attachment: ofbiz-770-FindFacilityPhysicalInventory.bsh.patch

This patches applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh to use UtilValidate methods.

> Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)
> ------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-770
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-770
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Stefan Huehner
>            Priority: Trivial
>             Fix For: SVN trunk
>
>         Attachments: ofbiz-770-FindFacilityPhysicalInventory.bsh.patch, ofbiz_isEmpty1.diff, ofbiz_isEmpty2.diff
>
>
> Hi,
> this task is to keep track of the conversion of hardcoded isEmpty checks to the existing UtilValidate methods.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (OFBIZ-770) Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux closed OFBIZ-770.
---------------------------------

    Resolution: Fixed
      Assignee: Jacques Le Roux

Should be fixed at r883492

> Use UtilValidate.is(Not)Empty methods instead of repeated (obj == null) || (obj.size == 0)
> ------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-770
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-770
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Stefan Huehner
>            Assignee: Jacques Le Roux
>            Priority: Trivial
>             Fix For: SVN trunk
>
>         Attachments: ofbiz-770-FindFacilityPhysicalInventory.bsh.patch, ofbiz_isEmpty1.diff, ofbiz_isEmpty2.diff
>
>
> Hi,
> this task is to keep track of the conversion of hardcoded isEmpty checks to the existing UtilValidate methods.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.