I have installed JFreeChart War sample in my server (TomCat - j2sdkee1.3.1) and when I go to any page of chart I get the following error:
java.Text.ParseException: Unparseable date: "01-Aug-2002"
What it could be?
Thanks All
ParseException in JFreeChart
Re: ParseException in JFreeChart
A couple of people have reported problem with the WAR file when running in different locales. I cannot currently replicate the problem on my machine. Do you have a full stack trace? Alternatively could you try running the following code and see if it produces a stack trace.
import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.ParseException;
public class DateTest {
public static void main(java.lang.String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
Date dDate = null;
try {
dDate = sdf.parse("01-Aug-2002");
System.out.println("Date - " + dDate.toString());
} catch (ParseException e) {
e.printStackTrace();
}
}
}
Thanks and regards,
Richard...
import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.ParseException;
public class DateTest {
public static void main(java.lang.String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
Date dDate = null;
try {
dDate = sdf.parse("01-Aug-2002");
System.out.println("Date - " + dDate.toString());
} catch (ParseException e) {
e.printStackTrace();
}
}
}
Thanks and regards,
Richard...
Re: ParseException in JFreeChart
Richard,
This code really produced the same error! And it happens in class WedHitDataSet, line 26. Im running JDK 1.3.1 and my OS is Winnt english version.
I wil continue the tests here. If you could give me a tip, Thanks a lot!
Valfran
This code really produced the same error! And it happens in class WedHitDataSet, line 26. Im running JDK 1.3.1 and my OS is Winnt english version.
I wil continue the tests here. If you could give me a tip, Thanks a lot!
Valfran
Re: ParseException in JFreeChart
Valfran,
Could you try the following code for me. I think the exception is happening because different symbols are being used with your default locale.
Thanks and regards,
Richard...
import java.util.Date;
import java.util.Locale;
import java.text.SimpleDateFormat;
import java.text.ParseException;
public class DateTest {
public static void main(java.lang.String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy", Locale.US);
Date dDate = null;
try {
dDate = sdf.parse("01-Aug-2002");
System.out.println("Date - " + dDate.toString());
} catch (ParseException e) {
e.printStackTrace();
}
}
}
Could you try the following code for me. I think the exception is happening because different symbols are being used with your default locale.
Thanks and regards,
Richard...
import java.util.Date;
import java.util.Locale;
import java.text.SimpleDateFormat;
import java.text.ParseException;
public class DateTest {
public static void main(java.lang.String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy", Locale.US);
Date dDate = null;
try {
dDate = sdf.parse("01-Aug-2002");
System.out.println("Date - " + dDate.toString());
} catch (ParseException e) {
e.printStackTrace();
}
}
}
Re: ParseException in JFreeChart
Richard
Now it works! I was using Portuguese Brazilian regional configuration! But defining locale in the code it works fine!
I will add this code in the JFreeChart (WebHitDataSet) class too!
Thank you very much for the help!
Valfran
Now it works! I was using Portuguese Brazilian regional configuration! But defining locale in the code it works fine!
I will add this code in the JFreeChart (WebHitDataSet) class too!
Thank you very much for the help!
Valfran
Re: ParseException in JFreeChart
Valfran,
Great, glad it works for you. Thanks for your help in testing it out.
I'll update the WAR file on my web site this evening with the changes.
Regards,
Richard...
Great, glad it works for you. Thanks for your help in testing it out.
I'll update the WAR file on my web site this evening with the changes.
Regards,
Richard...
Re: ParseException in JFreeChart
I have updated the WAR file at http://homepage.ntlworld.com/richard_c_ ... freechart/.
The sample WAR should now work correctly for default Locates that have different DateFormat symbols to the UK/US.
Regards,
Richard...
The sample WAR should now work correctly for default Locates that have different DateFormat symbols to the UK/US.
Regards,
Richard...