[ http://jira.codehaus.org/browse/MPCHANGELOG-67?page=comments#action_41502 ]
Freddy Mallet commented on MPCHANGELOG-67: ------------------------------------------ Modifications in VssConnection:.java: Fix bug when vss project specified in the scm connection string ended with '/'. In that case we got an exception 'String out of range : -1' ========================================= BEFORE: vssProject = splitedConnection[4]; NOW: vssProject = splitedConnection[4]; if(vssProject.lastIndexOf("/") == vssProject.length() - 1){ vssProject = vssProject.substring(0, vssProject.length() - 1); } Modifications in VssChangeLogParser:.java: Patch submitted with issue 'MPCHANGELOG-65' to fix bug when vss history feed contained label items didn't pass junit tests. ========================================= BEFORE: private static final String START_FILE = "***** " NOW: private static final String START_FILE = "****"; ---- BEFORE: setCurrentFile(new ChangeLogFile(fileLine[2])); NOW: if (fileLine.length > 2) { setCurrentFile(new ChangeLogFile(fileLine[2])); } Modifications in VssChangeLogParser:.java: Solve regional setting issue (MPCHANGELOG-65) ========================================= BEFORE: entry.setDate(parseDate((String) vector.get(3) + " " + (String) vector.get(5))); NOW: String date = (String) vector.get(3); String time = (String) vector.get(5); time = time.replaceAll("a", "AM"); time = time.replaceAll("p", "PM"); entry.setDate(parseDate(date + " " + time)); ---- BEFORE: SimpleDateFormat format = new SimpleDateFormat("dd.MM.yy HH:mm"); NOW: SimpleDateFormat format = getLocalVssDateFormat(); ---- BEFORE: try { SimpleDateFormat format = new SimpleDateFormat("dd.MM.yy HH:mm"); Date date = format.parse(dateString); return date; } catch (ParseException e) { LOG.error("ParseException Caught", e); return null; } NOW: try { SimpleDateFormat format = getLocalVssDateFormat(); Date date = format.parse(dateString); return date; } catch (ParseException e) { throw new RuntimeException( "VSS date : '" + dateString + "' doesn't match following date format : '" + getLocalVssDateFormat().toPattern() + "'. Please specify appropriate date format with 'maven.changelog.vsslib.dateFormat' property.", e); } /** * Vss client format history feed is based on the regional settings of the * machine. There's no way to get the pattern that is set on the system's * settings (expect through JNI calls). The default format 'MM/dd/yy h:mma' * correspond to en_US regional settings. This format can be overwritten * with property 'maven.changelog.vsslib.dateFormat'. */ private SimpleDateFormat getLocalVssDateFormat() { String dateFormat = null; try { org.apache.maven.jelly.MavenJellyContext mavenJellyContext = org.apache.maven.MavenUtils .createContext(new java.io.File(".")); dateFormat = (String) mavenJellyContext .getVariable("maven.changelog.vsslib.dateFormat"); } catch (Exception e) { logger.debug("Unexpected error occurred when trying to read" + " 'maven.changelog.vsslib.dateFormat' property", e); } if (dateFormat == null) { dateFormat = "MM/dd/yy h:mma"; } return new SimpleDateFormat(dateFormat); } > Visual Source Safe factory improvements > --------------------------------------- > > Key: MPCHANGELOG-67 > URL: http://jira.codehaus.org/browse/MPCHANGELOG-67 > Project: maven-changelog-plugin > Type: Improvement > Versions: 1.8.1 > Environment: maven-changelog-plugin v.1.7.3 > VSS v. 6.0 > Windows XP pro > Reporter: Freddy Mallet > Attachments: maven-changelog-vssimpl.zip > > > The issue 'MPCHANGELOG-65' raises a real problem since vss feed is formatted > according to regional settings of the machine. Moreover there is no way in > java to get those regional settings (cf: > http://forum.java.sun.com/thread.jspa?threadID=24929&messageID=2636438). So, > by default we can expect to get the following VSS date format : 'MM/dd/yy > h:mma' which could be overwritten if necessary with property > 'maven.changelog.vsslib.dateFormat'. > For instance, in Geneva (fr_CH), the correct date format is 'dd/MM/yy HH:mm'. > The patch enclosed include this improvement with others minor changes: > > - Add jUnit tests with dummy VSS history feed > - Fix bug when vss project specified in the scm connection string ended with > '/'. In that case we got an exception 'String out of range : -1' > - Patch submitted with issue 'MPCHANGELOG-65' to fix bug when vss history > feed contained label items didn't pass junit tests. > thanks -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]