You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Olivier Lamy (JIRA)" <ji...@codehaus.org> on 2010/06/08 23:06:13 UTC

[jira] Closed: (SCM-539) Unparseable date with Mercurial SCM provider

     [ http://jira.codehaus.org/browse/SCM-539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Lamy closed SCM-539.
----------------------------

    Resolution: Fixed

rev 952815
Thanks (please next time provide a patch using svn diff)

> Unparseable date with Mercurial SCM provider
> --------------------------------------------
>
>                 Key: SCM-539
>                 URL: http://jira.codehaus.org/browse/SCM-539
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-mercurial (hg)
>    Affects Versions: 1.4
>         Environment: OS: Ubuntu (probably all?)
> Mercurial version: 1.3.1
>            Reporter: Peter Liljenberg
>            Assignee: Olivier Lamy
>            Priority: Blocker
>             Fix For: 1.4
>
>
> [ERROR] skip ParseException: Unparseable date: "  0 Wed Oct 21 13:25:19 2009 +0200" during parsing date   0 Wed Oct 21 13:25:19 2009 +0200 with pattern EEE MMM dd HH:mm:ss yyyy Z with Locale en
> java.text.ParseException: Unparseable date: "  0 Wed Oct 21 13:25:19 2009 +0200"
> 	at java.text.DateFormat.parse(DateFormat.java:337)
> 	at org.apache.maven.scm.util.AbstractConsumer.parseDate(AbstractConsumer.java:112)
> 	at org.apache.maven.scm.util.AbstractConsumer.parseDate(AbstractConsumer.java:68)
> 	at org.apache.maven.scm.provider.hg.command.blame.HgBlameConsumer.doConsume(HgBlameConsumer.java:52)
> 	at org.apache.maven.scm.provider.hg.command.HgConsumer.consumeLine(HgConsumer.java:131)
> Problem seems to the extra spaces after the username.
> Output from HG is:
> Peter    0 Wed Oct 21 13:25:19 2009 +0200: package utils.jar;
> A working line from the same HG repo:
> Peter 1531 Wed Oct 21 13:25:19 2009 +0200: package utils.jar;
> The extra spaces between username and revision is messing up the following code:
> HgBlameConsumer:
> {code:title=Bar.java|borderStyle=solid}
>  public void doConsume(final String trimmedLine) {
>         /* godin 0 Sun Jan 31 03:04:54 2010 +0300 */
>         String annotation = trimmedLine.substring(0, trimmedLine.indexOf(": "));
>         final String author = annotation.substring(0, annotation.indexOf(' '));
>         annotation = annotation.substring(annotation.indexOf(' ') + 1);
>         final String revision = annotation.substring(0, annotation.indexOf(' '));
>         annotation = annotation.substring(annotation.indexOf(' ') + 1);
>         final String dateStr = annotation.trim();
>         final Date dateTime = parseDate(dateStr, null, HG_TIMESTAMP_PATTERN, null);
>     }
> {code}
> A simple fix for this would be to strip the **annotation** string (probably after each stubstring call) like this:
> {code:title=Bar.java|borderStyle=solid}
>   public void doConsume(final String trimmedLine) {
>         /* godin 0 Sun Jan 31 03:04:54 2010 +0300 */
>         String annotation = trimmedLine.substring(0, trimmedLine.indexOf(": ")).trim();
>         final String author = annotation.substring(0, annotation.indexOf(' '));
>         annotation = annotation.substring(annotation.indexOf(' ') + 1).trim();
>         final String revision = annotation.substring(0, annotation.indexOf(' '));
>         annotation = annotation.substring(annotation.indexOf(' ') + 1).trim();
>         final String dateStr = annotation;
>         final Date dateTime = parseDate(dateStr, null, HG_TIMESTAMP_PATTERN, null);
>     }
> {code}
> I patched the code and it worked on our HG repo at least. Please consider patching this....

-- 
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