You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by asheikh <as...@gmail.com> on 2008/05/19 07:28:47 UTC
Unparseable date: Cannot receive DateTime field contain
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(*
ConverterUtil.java:620*)
at com.qnb.examples.axis2_13.Test.testXMLDateTime(*Test.java:32*)
at com.qnb.examples.axis2_13.Test.main(*Test.java:67*)
Re: Unparseable date: Cannot receive DateTime field contain
Posted by asheikh <as...@gmail.com>.
Hi,
Just in case it benefits for someone else, The cause of this problem was
that the machine's Regional and Languages was set to Arabic(Something that I
haven't dealt with before). I have changed to English and everything went
well.
Still wondering why Axis2-1.4 work fine with Arabic settings and and not
Axis2-1.3.
On Mon, May 19, 2008 at 10:55 AM, asheikh <as...@gmail.com> wrote:
> Hey Joern,
>
> Thanks for the response. The code below works fine for me as well. I don't
> understand why the mistake is because of my code. My code runs fine with
> Axis2-1.4 and Axis2-1.3 in another machine.
>
> The NumberFormat Exception is thrown by
> org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(*
> ConverterUtil.java:620*)
> and I am passing the right xml DateTime format that
>
> Please see this http://marc.info/?l=axis-dev&m=118409462818489&w=2
>
> Thanks again, and please let me know if I am missing something...
>
>
>
>
> On 5/19/08, joern.albinger@gmx.de <jo...@gmx.de> wrote:
>>
>>
>> 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(*
>> ConverterUtil.java:620*)
>>
>> at com.qnb.examples.axis2_13.Test.testXMLDateTime(*Test.java:32*)
>>
>> at com.qnb.examples.axis2_13.Test.main(*Test.java:67*)
>>
>>
>>
>
>
Re: Unparseable date: Cannot receive DateTime field contain
Posted by asheikh <as...@gmail.com>.
Hey Joern,
Thanks for the response. The code below works fine for me as well. I don't
understand why the mistake is because of my code. My code runs fine with
Axis2-1.4 and Axis2-1.3 in another machine.
The NumberFormat Exception is thrown by
org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(*
ConverterUtil.java:620*)
and I am passing the right xml DateTime format that
Please see this http://marc.info/?l=axis-dev&m=118409462818489&w=2
Thanks again, and please let me know if I am missing something...
On 5/19/08, joern.albinger@gmx.de <jo...@gmx.de> wrote:
>
>
> 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(*
> ConverterUtil.java:620*)
>
> at com.qnb.examples.axis2_13.Test.testXMLDateTime(*Test.java:32*)
>
> at com.qnb.examples.axis2_13.Test.main(*Test.java:67*)
>
>
>
AW: Unparseable date: Cannot receive DateTime field contain
Posted by jo...@gmx.de.
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)