Simon, thank you so much. You resolved my problem.

On Apr 18, 7:16 pm, Simon Knott <knott.si...@gmail.com> wrote:
> Are you aware that SimpleDateFormat is not threadsafe, so you shouldn't
> have it as a static variable?
>
> You might be hitting this issue -  
> http://www.codefutures.com/weblog/andygrove/2007/10/simpledateformat-...
>
> Cheers,
> Simon
>
>
>
> On Wednesday, April 18, 2012 11:47:10 AM UTC+1, senderj wrote:
>
> > I know it doesn't sounds like a GAE problem, but it is a very simple
> > coding and I only encounter this problem in GAE, so I post here for
> > help.
>
> > My java servlet in GAE reads a web site and the problem happens when
> > extracting a date from html page and convert into Date object using
> > SimpleDateFormat.
>
> > In servlet static
> > static final SimpleDateFormat dff = new SimpleDateFormat("dd/MM/yyyy
> > HH:mm");
> > In servlet method
> > .... logic to extract date from html as text and stores to String
> > ss.....
> > try {
> >     result = dff.parse(ss);
> >     log.info("ss="+ss);
> >     log.info("result="+result);
> > } catch (ParseException pe) {
> >     log.warning("parse date exception");
> > }//end try
>
> > I've checked many times the pattern in dff is correct, and I never get
> > "parse date exception" in my log. Instead, here are some examples from
> > different runs in my log:
> > ss=18/04/2012 10:27
> > result=Fri Apr 27 10:27:00 UTC 2012
> > ss=18/04/2012 09:57
> > result=Sun May 27 09:57:00 UTC 2012
> > ss=18/04/2012 09:55
> > result=Fri May 25 09:55:00 UTC 2012
> > ss=18/04/2012 09:45
> > result=Fri Sep 18 09:45:00 UTC 2015
>
> > First of all, it is not always like that. It happens about 10% of my
> > runs. Secondly, I have another program reading another web page but
> > also parse the date with same logic in GAE, and also encountered the
> > same problem with about the same chances. If anybody can figure out
> > what's wrong with my code please help.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to