castor
  1. castor
  2. CASTOR-1086

BigDecimal usage in Types.java can't run on jre1.4.2

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.4, 0.9.5, 0.9.6
    • Fix Version/s: 0.9.7 M1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows
    • Number of attachments :
      1

      Description

      in Types.java, the usage for BigDecimal is:

      new TypeInfo( "big-decimal", null,
      java.math.BigDecimal.class, true, new BigDecimal( 0 ) ),

      however, this will not work in jdk 1.4.2 environment, because in 1.4.2, the only types supported are BigInteger, double, String. If this code runs on 1.4.2, it will cause the exception which says the constructor for BigDecimal (passing int or long) does not exist. I think to be safe, cast 0 to double, like new BigDecimal( (double) 0 ).

      It runs on jdk 1.5.

      1. patch.txt
        5 kB
        Werner Guttmann

        Activity

        Hide
        Werner Guttmann added a comment -

        This patch fixes above problem by casting the 0 to a double. In addition, I've applied some more casts to several cases and added some Javadocs.

        Show
        Werner Guttmann added a comment - This patch fixes above problem by casting the 0 to a double. In addition, I've applied some more casts to several cases and added some Javadocs.
        Hide
        Werner Guttmann added a comment -

        Fwiw, I introduced the same casts for Double, Long and Float.

        Show
        Werner Guttmann added a comment - Fwiw, I introduced the same casts for Double, Long and Float.

          People

          • Assignee:
            Werner Guttmann
            Reporter:
            Bin Liu
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 15 minutes
              15m
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 10 minutes Time Not Required
              10m