[ http://issues.apache.org/jira/browse/TUSCANY-579?page=all ]
Frank Budinsky resolved TUSCANY-579.
------------------------------------
Resolution: Fixed
Fixed in revision 434519.
> getString on Date field results in IllegalArgumentException
> -----------------------------------------------------------
>
> Key: TUSCANY-579
> URL: http://issues.apache.org/jira/browse/TUSCANY-579
> Project: Tuscany
> Issue Type: Bug
> Components: Java SDO Implementation
> Reporter: Brian Murray
> Assigned To: Frank Budinsky
> Attachments: api_test.xsd, Tuscany579.patch, Tuscany579.patch,
> TypeConversionTestCase.java
>
>
> On page 146 of V2.01 of the spec, it is stated that conversion from Date to
> String is supported. However, getString on Date type results in an
> IllegalArgumentException. Here is a code segment:
> public void testShowErrorsInSimpleFormat() throws Exception
> {
> DataObject test_obj = DataFactory.INSTANCE.create(API_TEST_TYPE);
> Date current_date = new Date(System.currentTimeMillis());
> // getString does not work on Date type
> test_obj.setDate("dateVal", current_date);
> String returned_string = test_obj.getString("dateVal"); //Gives
> IllegalArgumentException
> }
> And here is the XSD:
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:sdo="commonj.sdo"
> xmlns:simple="http://www.example.com/api_test"
> targetNamespace="http://www.example.com/api_test">
> <xsd:import namespace="commonj.sdo" schemaLocation="sdoModel.xsd"/>
> <xsd:element name="apiTestElem" type="simple:APITest"/>
> <xsd:complexType mixed="true" name="APITest">
> <xsd:sequence>
> <xsd:element name="stringVal" type="sdo:String"/>
> <xsd:element name="booleanVal" type="sdo:Boolean"/>
> <xsd:element name="booleanVal2" type="sdo:Boolean"/>
> <xsd:element name="byteVal" type="sdo:Byte"/>
> <xsd:element name="stringVal2" type="sdo:String"/>
> <xsd:element name="decimalVal" type="sdo:Decimal"/>
> <xsd:element name="decimalVal2" type="sdo:Decimal"/>
> <xsd:element name="intVal" type="sdo:Int"/>
> <xsd:element name="floatVal" type="sdo:Float"/>
> <xsd:element name="doubleVal" type="sdo:Double"/>
> <xsd:element name="dateVal" type="sdo:Date"/>
> <xsd:element name="shortVal" type="sdo:Short"/>
> <xsd:element name="longVal" type="sdo:Long"/>
> <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="children" type="simple:APITest"/>
> <xsd:element name="bytesVal" type="sdo:Bytes"/>
> <xsd:element name="integerVal" type="sdo:Integer"/>
> <xsd:element name="charVal" type="sdo:Character"/>
> </xsd:sequence>
> </xsd:complexType>
> I originally thought that also getDate was not working on String, but this
> was an error in my test case. I had been setting the String value to be
> Date.toString(). Fuhwei correctly pointed out that the String format that
> would allow conversion is given on page 72 of the specification and is
> different than what is returned by Date.toString(). I have tested with the
> correct String format and found that getDate works, so clearly this is not an
> error. However, I wonder if it would be a good idea to aditionally support
> the String format that results from Date.toString().
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]