Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-80064

Use GetterUtil.getX instead of the parseX method on primitive types when appropriate

    Details

      Description

      Use

      long l = GetterUtil.getLong(s)
      

      Instead of

      long l = Long.parseLong(s)
      

      Unless we want to validate that s is a proper long and catch the NumberFormatException that can be thrown by Long.parseLong:

      try {
          long l = Long.parseLong(s);
      }
      catch (NumberFormatException npe) {
         // do stuff when s is not a proper long
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                support-qa Support QA
                Reporter:
                hugo.huijser Hugo Huijser
                Recent user:
                Csaba Turcsan
                Participants of an Issue:
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Packages

                  Version Package
                  7.0.0 DXP FP46
                  7.0.6 CE GA7
                  7.0.0 DXP SP8
                  7.0.X
                  7.1.X
                  Master