Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#141 Object-Id class generator and Findbugs "Bx"

open
nobody
5
2009-11-03
2009-11-03
jfirechief
No

DO NOT EDIT OR ANSWER THIS ISSUE. SEE THE ORIGINAL ISSUE INSTEAD:
https://www.jfire.org/modules/bugs/view.php?id=1361
ORIGINAL REPORTER: Marc

Object Id classes should use Integer.valueOf(int) instead of new Integer(int) constructor.

Same applies to other primitive wrappers.

Discussion

  • jfirechief
    jfirechief
    2009-11-03

    • labels: --> NightLabs SDK
    • summary: Object-Id class generator and Findbugs "Bx" --> Object-Id class generator and Findbugs "Bx"
     
  • jfirechief
    jfirechief
    2009-11-03

    ORIGINAL COMMENT BY Marc, VIEW IT HERE:
    https://www.jfire.org/modules/bugs/view.php?id=1361

    It should use
    Integer.valueOf(valStr, RADIX);
    instead of
    new Integer(Integer.parseInt(valStr, RADIX));

     
  • jfirechief
    jfirechief
    2009-11-03

    ORIGINAL COMMENT BY marco, VIEW IT HERE:
    https://www.jfire.org/modules/bugs/view.php?id=1361

    I disagree for the following reasons:

    1) It is too late. Because we already use JFire productively and store String-representations of OIDs into the database, we cannot simply switch to a different radix (10 instead of 36). The existing data couldn't be read anymore.

    2) Even if we switched only for new classes (and don't touch existing auto-generated classes), it's problematic, because it's both inconsistent and even error-prone (if someone deletes an OID-class and regenerates it).

    3) The OID-strings are very long and sometimes touch the limits of the underlying DB. Thus, every character counts and there are persistent classes in JFire with 5 or even more PK-fields. If every long (we use nearly no integer-IDs) is encoded in base-10 instead of base-36, the difference in maximum length is 6 characters per field (Long.MAX_VALUE has 19 characters in base-10 and 13 characters in base-36).

    4) There's no reason to change it, because it's internal data (not visible to any user) and thus encoding doesn't matter as long as it's human-readable (printable characters).