castor

CLONE -BigDecimal usage in Types.java can't run on jre1.4.2 (Regression in >1.0)

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.1.2
  • Component/s: XML
  • Labels:
    None
  • Environment:
    Windows
  • Number of attachments :
    2

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. jdk-1.4.patch
    09/Jun/07 9:00 AM
    1 kB
    Petteri Räty
  2. patch-C2008-20070609.txt
    09/Jun/07 8:48 AM
    3 kB
    Ralf Joachim

Activity

Hide
Petteri Räty added a comment -

http://jira.codehaus.org/browse/CASTOR-1086
I cloned this because I am seeing this again in 1.0.5:

castor:
[java] Jun 9, 2007 2:55:14 PM org.exolab.castor.builder.SourceGenerator main
[java] INFO: org.exolab.castor.builder.SourceGenerator.main() is deprecated. Please use org.exolab.castor.builder.SourceGeneratorMain#main() instead.
[java] – Suppressing non fatal warnings.
[java] Exception in thread "main" java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V
[java] at org.exolab.castor.mapping.loader.Types.<clinit>(Types.java:485)
[java] at org.exolab.castor.mapping.loader.AbstractMappingLoader.resolveType(AbstractMappingLoader.java:156)
[java] at org.exolab.castor.mapping.loader.AbstractMappingLoader.createDescriptor(AbstractMappingLoader.java:238)
[java] at org.exolab.castor.xml.XMLMappingLoader.createDescriptor(XMLMappingLoader.java:226)
[java] at org.exolab.castor.mapping.loader.AbstractMappingLoader.loadMappingInternal(AbstractMappingLoader.java:174)
[java] at org.exolab.castor.mapping.loader.AbstractMappingLoader2.loadMapping(AbstractMappingLoader2.java:140)
[java] at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:132)
[java] at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:99)
[java] at org.exolab.castor.xml.Unmarshaller.setMapping(Unmarshaller.java:493)
[java] at org.exolab.castor.xml.schema.SimpleTypesFactory.loadTypesDefinitions(SimpleTypesFactory.java:424)
[java] at org.exolab.castor.xml.schema.SimpleTypesFactory.getType(SimpleTypesFactory.java:387)
[java] at org.exolab.castor.xml.schema.SimpleTypesFactory.getBuiltInType(SimpleTypesFactory.java:199)
[java] at org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:1284)
[java] at org.exolab.castor.xml.schema.Schema.getType(Schema.java:2120)
[java] at org.exolab.castor.xml.schema.reader.SimpleTypeRestrictionUnmarshaller.<init>(SimpleTypeRestrictionUnmarshaller.java:119)
[java] at org.exolab.castor.xml.schema.reader.SimpleTypeUnmarshaller.startElement(SimpleTypeUnmarshaller.java:231)
[java] at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(SchemaUnmarshaller.java:463)
[java] at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startElement(Sax2ComponentReader.java:255)
[java] at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
[java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
[java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
[java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
[java] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
[java] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
[java] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
[java] at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:564)
[java] at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:497)
[java] at org.exolab.castor.builder.SourceGeneratorMain.main(SourceGeneratorMain.java:245)
[java] at org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:1104)

The issue seems to be there in trunk:
betelgeuse@pena /mnt/checkouts/castor-trunk $ grep Decimal ./src/main/java/org/exolab/castor/mapping/loader/Types.java
import java.math.BigDecimal;

  • <li>BigDecimal
    java.math.BigDecimal.class, true, new BigDecimal( 0 ) ),
Show
Petteri Räty added a comment - http://jira.codehaus.org/browse/CASTOR-1086 I cloned this because I am seeing this again in 1.0.5: castor: [java] Jun 9, 2007 2:55:14 PM org.exolab.castor.builder.SourceGenerator main [java] INFO: org.exolab.castor.builder.SourceGenerator.main() is deprecated. Please use org.exolab.castor.builder.SourceGeneratorMain#main() instead. [java] – Suppressing non fatal warnings. [java] Exception in thread "main" java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V [java] at org.exolab.castor.mapping.loader.Types.<clinit>(Types.java:485) [java] at org.exolab.castor.mapping.loader.AbstractMappingLoader.resolveType(AbstractMappingLoader.java:156) [java] at org.exolab.castor.mapping.loader.AbstractMappingLoader.createDescriptor(AbstractMappingLoader.java:238) [java] at org.exolab.castor.xml.XMLMappingLoader.createDescriptor(XMLMappingLoader.java:226) [java] at org.exolab.castor.mapping.loader.AbstractMappingLoader.loadMappingInternal(AbstractMappingLoader.java:174) [java] at org.exolab.castor.mapping.loader.AbstractMappingLoader2.loadMapping(AbstractMappingLoader2.java:140) [java] at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:132) [java] at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:99) [java] at org.exolab.castor.xml.Unmarshaller.setMapping(Unmarshaller.java:493) [java] at org.exolab.castor.xml.schema.SimpleTypesFactory.loadTypesDefinitions(SimpleTypesFactory.java:424) [java] at org.exolab.castor.xml.schema.SimpleTypesFactory.getType(SimpleTypesFactory.java:387) [java] at org.exolab.castor.xml.schema.SimpleTypesFactory.getBuiltInType(SimpleTypesFactory.java:199) [java] at org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:1284) [java] at org.exolab.castor.xml.schema.Schema.getType(Schema.java:2120) [java] at org.exolab.castor.xml.schema.reader.SimpleTypeRestrictionUnmarshaller.<init>(SimpleTypeRestrictionUnmarshaller.java:119) [java] at org.exolab.castor.xml.schema.reader.SimpleTypeUnmarshaller.startElement(SimpleTypeUnmarshaller.java:231) [java] at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(SchemaUnmarshaller.java:463) [java] at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startElement(Sax2ComponentReader.java:255) [java] at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) [java] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) [java] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) [java] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) [java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) [java] at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:564) [java] at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:497) [java] at org.exolab.castor.builder.SourceGeneratorMain.main(SourceGeneratorMain.java:245) [java] at org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:1104) The issue seems to be there in trunk: betelgeuse@pena /mnt/checkouts/castor-trunk $ grep Decimal ./src/main/java/org/exolab/castor/mapping/loader/Types.java import java.math.BigDecimal;
  • <li>BigDecimal java.math.BigDecimal.class, true, new BigDecimal( 0 ) ),
Hide
Petteri Räty added a comment -

It seems they were removed in http://jira.codehaus.org/browse/CASTOR-1393

Show
Petteri Räty added a comment - It seems they were removed in http://jira.codehaus.org/browse/CASTOR-1393
Hide
Ralf Joachim added a comment -

Patch for review.

Show
Ralf Joachim added a comment - Patch for review.
Hide
Petteri Räty added a comment -

Not sure but you might want to change some other stuff I spotted where there is not int constructor.

Show
Petteri Räty added a comment - Not sure but you might want to change some other stuff I spotted where there is not int constructor.
Hide
Petteri Räty added a comment -

Reopening for you to take a look at my patch.

Show
Petteri Räty added a comment - Reopening for you to take a look at my patch.
Hide
Ralf Joachim added a comment -

It seams I have been a bit to fast this time

Will also add the other changes you suggested.

Show
Ralf Joachim added a comment - It seams I have been a bit to fast this time Will also add the other changes you suggested.
Hide
Ralf Joachim added a comment -

After committing the additional changes to Types.java I'll again resolve as fixed.

Show
Ralf Joachim added a comment - After committing the additional changes to Types.java I'll again resolve as fixed.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
15m
Original Estimate - 15 minutes
Remaining:
15m
Remaining Estimate - 15 minutes
Logged:
Not Specified
Time Spent - Not Specified