You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Zoltan Borsos (JIRA)" <de...@tuscany.apache.org> on 2008/08/29 08:30:46 UTC
[jira] Created: (TUSCANY-2571) xs:Date output not compliant with
spec
xs:Date output not compliant with spec
--------------------------------------
Key: TUSCANY-2571
URL: https://issues.apache.org/jira/browse/TUSCANY-2571
Project: Tuscany
Issue Type: Bug
Components: Java SDO Implementation
Affects Versions: Java-SDO-1.1
Reporter: Zoltan Borsos
Fix For: Java-SDO-1.1
Hello,
I have found some deviation from the XML spec. when I use XMLHelper.INSTANCE.save.
The problem occurs when I want to print Date (xs:Date).
It looks e.g.: 2008-07-11 UTC
Instead of: 2008-07-11Z.
Can anybody confirm if this is a bug?
I debugged the source code and found a pattern at line 453:
SDOSimpleDateFormat f = new SDOSimpleDateFormat("yyyy-MM-dd zz");
in the method:
public synchronized String toYearMonthDay(Date date)
I also found similar patterns in other methods too.
I have created a small demo for representing my problem.
The code:
--------------
public class DemoSdo {
public static void main(String[] args) throws IOException {
HelperContext ctx = HelperProvider.getDefaultContext();
FileInputStream is = new FileInputStream("src/sdo/DemoSDO.xsd");
XSDHelper xsdHelper = ctx.getXSDHelper();
xsdHelper.define(is, null);
DataFactory f = ctx.getDataFactory();
DataObject newDO = f.create("http://DemoSDO/src/sdo", "DemoSDO");
Date d = new Date();
newDO.setDate("timeStamp", d);
newDO.setDate("demoDate", d);
String uri = newDO.getType().getURI();
String name = newDO.getType().getName();
String serializedDO = XMLHelper.INSTANCE.save(newDO, uri, name);
System.out.println(serializedDO);
}
}
The XML schema:
--------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://DemoSDO/src/sdo">
<xsd:complexType name="DemoSDO">
<xsd:sequence>
<xsd:element name="timeStamp" type="xsd:dateTime">
</xsd:element>
<xsd:element name="demoDate" type="xsd:date">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
The output:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<sdo:DemoSDO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdo="http://DemoSDO/src/sdo" xsi:type="sdo:DemoSDO">
<timeStamp>2008-08-28T10:10:40.366Z</timeStamp>
<demoDate>2008-08-28 UTC</demoDate>
</sdo:DemoSDO>
According to the specification demoDate should be 2008-08-28Z.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.