axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <joern.albin...@gmx.de>
Subject AW: Unparseable date: Cannot receive DateTime field contain
Date Mon, 19 May 2008 06:15:51 GMT
 
H ey ,
 
you have got a NumerFormat Exception. That is not a mistake of Axis, it is
because of your code:
 
Maybe you try this one:
 
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss.0");

Date now = new Date();

String dateString = now.toString();

String value = format.format(now);

System.out.println(" Value :"+ value); 

 

This works fine for me ....

 

Cheers

Jörn

 



Hi
 
Running the following code in two machines with latest release  axis2-1.3
(axis2-1.4 is fine) generates the exception below , while other machines are
fine.
org.apache.axis2.databinding.utils.ConverterUtil

.convertToDateTime
Please, can someone put some light on why the following code would generates
the exception in one machine and not the other.....
 
Thanks

public static void testXMLDateTime () {

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); 

}

}

 

Exception in thread "main" java.lang.NumberFormatException: Unparseable
date: "2007-12-20T18:36:29.6102028Z"

at
org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(Converter
Util.java:620)

at com.qnb.examples.axis2_13.Test.testXMLDateTime(Test.java:32)

at com.qnb.examples.axis2_13.Test.main(Test.java:67)

 


Mime
View raw message