Uploaded image for project: 'CloudStack'
  1. CloudStack
  2. CLOUDSTACK-7289

Bugs seen when declaring a class variable as native type (long) and have its getter method returning the corresponding object (Long) and vice versa

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 4.5.0
    • None
    • None
    • Security Level: Public (Anyone can view this level - this is the default.)
    • None

    Description

      Declare a variable as native type (long) and have its getter method
      returning the corresponding object (Long). This is what I fixed with CLOUDSTACK-7272.
      Example below. This should be fixed in the entire code base.
      Autoboxing causes NPE or defaults some values. The vice versa should be
      fixed as well meaning declaring hostId as Long and returning as native
      type (long).

      long hostId

      Long getHostId(){
      return hostId;
      }

      Right Implementation (hostId is declared as Long)
      Long hostId;

      Long getHostId(){
      return hostId;
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            nitinme Nitin Mehta
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: