History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: MPCHANGELOG-67
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Freddy Mallet
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Maven 1.x Changelog Plugin

Visual Source Safe factory improvements

Created: 15/Jun/05 02:08 AM   Updated: 17/Jun/05 10:38 AM
Component/s: None
Affects Version/s: 1.8.1
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive maven-changelog-vssimpl.zip (14 kb)

Environment:
maven-changelog-plugin v.1.7.3
VSS v. 6.0
Windows XP pro

Testcase included: yes


 Description  « Hide
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



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Brett Porter - 15/Jun/05 07:53 AM
can you please include this as a diff against the latest version from subversion?

Thanks.


Freddy Mallet - 17/Jun/05 08:53 AM
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()
    Unknown macro: { 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); }

Emmanuel Venisse - 17/Jun/05 10:38 AM
Can you send a diff file? it will be more easy to apply.