[JIRA] (JENKINS-14683) TFS Plugin parses pt_BR dates incorrectly

2012-09-26 Thread reds...@java.net (JIRA)














































redsolo
 commented on  JENKINS-14683


TFS Plugin parses pt_BR dates incorrectly















How did you solve this problem?



























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira






[JIRA] (JENKINS-14683) TFS Plugin parses pt_BR dates incorrectly

2012-08-03 Thread gabsp...@gmail.com (JIRA)















































Gabriel Speckhahn
 resolved  JENKINS-14683 as Incomplete


TFS Plugin parses pt_BR dates incorrectly
















canceling





Change By:


Gabriel Speckhahn
(03/Aug/12 8:20 PM)




Status:


Open
Resolved





Resolution:


Incomplete



























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira






[JIRA] (JENKINS-14683) TFS Plugin parses pt_BR dates incorrectly

2012-08-03 Thread gabsp...@gmail.com (JIRA)














































Gabriel Speckhahn
 created  JENKINS-14683


TFS Plugin parses pt_BR dates incorrectly















Issue Type:


Bug



Affects Versions:


current



Assignee:


redsolo



Components:


tfs



Created:


03/Aug/12 8:06 PM



Description:


The TFS SCM plugin cannot parse the date output by the TFS detailed history command if the system locale is set to Brazilian Portuguese.

Therefore, SCM polling always fails to detect any changes, for the month and day of the last change get swapped.

For instance:

Started on Aug 3, 2012 4:30:38 PM
[foundation-v2.06b] $ C:\apps\TEE-CLC-10.1.0\tf.cmd history $/ -noprompt -version2012-08-02T19:17:11Z~D2012-08-03T19:30:39Z -recursive -format:detailed -server: 
Changeset: 107235
User: 
Date: 03/08/2012 10:13:46

This date is August 3rd, 2012, but the TFS plugins interprets it as March 8th because it attempts to parse the date string with Java's deprecated Date.parse method:

hudson.plugins.tfs.util.DateUtil:

@SuppressWarnings("deprecation")
public static Date parseDate(String dateString, Locale locale, TimeZone timezone) throws ParseException {
Date date = null;
dateString = dateString.replaceAll("(p|P)\\.(m|M).", "PM").replaceAll("(a|A)\\.(m|M).", "AM");
try {
// Use the deprecated Date.parse method as this is very good at detecting
// dates commonly output by the US and UK standard locales of dotnet that
// are output by the Microsoft command line client.
date = new Date(Date.parse(dateString));
} catch (IllegalArgumentException e) {
// ignore - parse failed.
}
if (date == null) {
// The old fashioned way did not work. Let's try it using a more
// complex alternative.
DateFormat[] formats = createDateFormatsForLocaleAndTimeZone(locale, timezone);
return parseWithFormats(dateString, formats);
}
return date;
}

I copied this class to a standalone project on Eclipse and printed the parsed date. The result with the original code for 03/08/2012 10:13:46 was:

Thu Mar 08 10:13:46 BRT 2012

After I changed the class to remove the call to the deprecated method, the date was parsed correctly:

Fri Aug 03 10:13:46 BRT 2012







Environment:


Windows 7 x86




Project:


Jenkins



Priority:


Major



Reporter:


Gabriel Speckhahn

























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira