axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Decker (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AXIS2-3414) XML dateTime strings are not converted correctly
Date Thu, 20 Dec 2007 21:26:43 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-3414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rob Decker updated AXIS2-3414:
------------------------------

    Description: 
XML dateTime strings are not converted correctlly:

{code:title=Axis2DateTimeBug.java|borderStyle=solid}
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

import org.apache.axis2.databinding.utils.ConverterUtil;

public class Axis2DateTimeBug {

    public static void main(String[] args) {
		String tin = "2007-12-20T18:36:29.6102028Z";
		String tout = "2007-12-20T20:18:11.028Z";
		System.out.println("Axis2 converts "+tin+" to Java Date: "+ConverterUtil.convertToDateTime(tin).getTime());
		System.out.println("Axis2 converts "+tout+" to Java Date: "+ConverterUtil.convertToDateTime(tout).getTime());
		System.out.println("Axis2 converts "+tin+" to dateTime: "+ConverterUtil.convertToString(ConverterUtil.convertToDateTime(tin).getTime()));
		System.out.println("Axis2 converts "+tout+" to dateTime: "+ConverterUtil.convertToString(ConverterUtil.convertToDateTime(tout).getTime()));
		
		try {
			DatatypeFactory dtf = DatatypeFactory.newInstance();
			XMLGregorianCalendar calin = dtf.newXMLGregorianCalendar(tin);
			System.out.println("XMLGC converts "+tin+" to XML Format: "+calin.toXMLFormat()+" to Java
Date: "+calin.toGregorianCalendar().getTime());
			XMLGregorianCalendar calout = dtf.newXMLGregorianCalendar(tout);
			System.out.println("XMLGC converts "+tout+" to XML Format: "+calout.toXMLFormat()+" to
Java Date: "+calout.toGregorianCalendar().getTime());
		} catch (DatatypeConfigurationException e) {
			e.printStackTrace(System.err);
		}
}
{code}


Axis2 converts 2007-12-20T18:36:29.6102028Z to Java Date: Thu Dec 20 15:18:11 EST 2007
Axis2 converts 2007-12-20T20:18:11.028Z to Java Date: Thu Dec 20 15:18:11 EST 2007
Axis2 converts 2007-12-20T18:36:29.6102028Z to dateTime: 2007-12-20Z
Axis2 converts 2007-12-20T20:18:11.028Z to dateTime: 2007-12-20Z
XMLGC converts 2007-12-20T18:36:29.6102028Z to XML Format: 2007-12-20T18:36:29.6102028Z to
Java Date: Thu Dec 20 13:36:29 EST 2007
XMLGC converts 2007-12-20T20:18:11.028Z to XML Format: 2007-12-20T20:18:11.028Z to Java Date:
Thu Dec 20 15:18:11 EST 2007

  was:
XML dateTime strings are not converted correctlly:

<code>
		String tin = "2007-12-20T18:36:29.6102028Z";
		String tout = "2007-12-20T20:18:11.028Z";
		System.out.println("Axis2 converts "+tin+" to Java Date: "+ConverterUtil.convertToDateTime(tin).getTime());
		System.out.println("Axis2 converts "+tout+" to Java Date: "+ConverterUtil.convertToDateTime(tout).getTime());
		System.out.println("Axis2 converts "+tin+" to dateTime: "+ConverterUtil.convertToString(ConverterUtil.convertToDateTime(tin).getTime()));
		System.out.println("Axis2 converts "+tout+" to dateTime: "+ConverterUtil.convertToString(ConverterUtil.convertToDateTime(tout).getTime()));
		
		try {
			DatatypeFactory dtf = DatatypeFactory.newInstance();
			XMLGregorianCalendar calin = dtf.newXMLGregorianCalendar(tin);
			System.out.println("XMLGC converts "+tin+" to XML Format: "+calin.toXMLFormat()+" to Java
Date: "+calin.toGregorianCalendar().getTime());
			XMLGregorianCalendar calout = dtf.newXMLGregorianCalendar(tout);
			System.out.println("XMLGC converts "+tout+" to XML Format: "+calout.toXMLFormat()+" to
Java Date: "+calout.toGregorianCalendar().getTime());
		} catch (DatatypeConfigurationException e) {
			e.printStackTrace(System.err);
		}
</code>

Axis2 converts 2007-12-20T18:36:29.6102028Z to Java Date: Thu Dec 20 15:18:11 EST 2007
Axis2 converts 2007-12-20T20:18:11.028Z to Java Date: Thu Dec 20 15:18:11 EST 2007
Axis2 converts 2007-12-20T18:36:29.6102028Z to dateTime: 2007-12-20Z
Axis2 converts 2007-12-20T20:18:11.028Z to dateTime: 2007-12-20Z
XMLGC converts 2007-12-20T18:36:29.6102028Z to XML Format: 2007-12-20T18:36:29.6102028Z to
Java Date: Thu Dec 20 13:36:29 EST 2007
XMLGC converts 2007-12-20T20:18:11.028Z to XML Format: 2007-12-20T20:18:11.028Z to Java Date:
Thu Dec 20 15:18:11 EST 2007


> XML dateTime strings are not converted correctly
> ------------------------------------------------
>
>                 Key: AXIS2-3414
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3414
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.3
>         Environment: Java 1.5.0_11 Axis2 1.3
>            Reporter: Rob Decker
>
> XML dateTime strings are not converted correctlly:
> {code:title=Axis2DateTimeBug.java|borderStyle=solid}
> import javax.xml.datatype.DatatypeConfigurationException;
> import javax.xml.datatype.DatatypeFactory;
> import javax.xml.datatype.XMLGregorianCalendar;
> import org.apache.axis2.databinding.utils.ConverterUtil;
> public class Axis2DateTimeBug {
>     public static void main(String[] args) {
> 		String tin = "2007-12-20T18:36:29.6102028Z";
> 		String tout = "2007-12-20T20:18:11.028Z";
> 		System.out.println("Axis2 converts "+tin+" to Java Date: "+ConverterUtil.convertToDateTime(tin).getTime());
> 		System.out.println("Axis2 converts "+tout+" to Java Date: "+ConverterUtil.convertToDateTime(tout).getTime());
> 		System.out.println("Axis2 converts "+tin+" to dateTime: "+ConverterUtil.convertToString(ConverterUtil.convertToDateTime(tin).getTime()));
> 		System.out.println("Axis2 converts "+tout+" to dateTime: "+ConverterUtil.convertToString(ConverterUtil.convertToDateTime(tout).getTime()));
> 		
> 		try {
> 			DatatypeFactory dtf = DatatypeFactory.newInstance();
> 			XMLGregorianCalendar calin = dtf.newXMLGregorianCalendar(tin);
> 			System.out.println("XMLGC converts "+tin+" to XML Format: "+calin.toXMLFormat()+"
to Java Date: "+calin.toGregorianCalendar().getTime());
> 			XMLGregorianCalendar calout = dtf.newXMLGregorianCalendar(tout);
> 			System.out.println("XMLGC converts "+tout+" to XML Format: "+calout.toXMLFormat()+"
to Java Date: "+calout.toGregorianCalendar().getTime());
> 		} catch (DatatypeConfigurationException e) {
> 			e.printStackTrace(System.err);
> 		}
> }
> {code}
> Axis2 converts 2007-12-20T18:36:29.6102028Z to Java Date: Thu Dec 20 15:18:11 EST 2007
> Axis2 converts 2007-12-20T20:18:11.028Z to Java Date: Thu Dec 20 15:18:11 EST 2007
> Axis2 converts 2007-12-20T18:36:29.6102028Z to dateTime: 2007-12-20Z
> Axis2 converts 2007-12-20T20:18:11.028Z to dateTime: 2007-12-20Z
> XMLGC converts 2007-12-20T18:36:29.6102028Z to XML Format: 2007-12-20T18:36:29.6102028Z
to Java Date: Thu Dec 20 13:36:29 EST 2007
> XMLGC converts 2007-12-20T20:18:11.028Z to XML Format: 2007-12-20T20:18:11.028Z to Java
Date: Thu Dec 20 15:18:11 EST 2007

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message