[ 
https://issues.apache.org/jira/browse/SCM-744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17964919#comment-17964919
 ] 

Olivier Lamy commented on SCM-744:
----------------------------------

This project has moved from Jira to GitHub Issues. This issue was migrated to 
[apache/maven-scm#953|https://github.com/apache/maven-scm/issues/953]. 

> api's AbstractConsumer ignores Locale when using a custom dateFormatter
> -----------------------------------------------------------------------
>
>                 Key: SCM-744
>                 URL: https://issues.apache.org/jira/browse/SCM-744
>             Project: Maven SCM (Moved to GitHub Issues)
>          Issue Type: Bug
>          Components: maven-scm-api
>    Affects Versions: 1.8.1
>            Reporter: Matías Albanesi
>            Priority: Minor
>
> Class org.apache.maven.scm.util.AbstractConsumer contains a method:
> protected Date parseDate( String date, String userPattern, String 
> defaultPattern, Locale locale )
> Which ignores the specified locale if there is a userPattern specified. 
> Current implementation is:
>         if ( StringUtils.isNotEmpty( userPattern ) )
>         {
>             format = new SimpleDateFormat( userPattern );
>             patternUsed = userPattern;
>         }
> When the date parsing fails it misleadingly displays a message indicating 
> that it did make use of the Locale but clearly it did not:
> [ERROR] skip ParseException: Unparseable date: "Mon Oct 21 18:14:36 2013 
> -0300" during parsing date Mon Oct 21 18:14:36 2013 -0300 with pattern EEE 
> MMM dd HH:mm:ss yyyy Z with Locale en
> java.text.ParseException: Unparseable date: "Mon Oct 21 18:14:36 2013 -0300"
>       at java.text.DateFormat.parse(DateFormat.java:337)
>       at 
> org.apache.maven.scm.util.AbstractConsumer.parseDate(AbstractConsumer.java:112)
>       at 
> org.apache.maven.scm.provider.hg.command.changelog.HgChangeLogConsumer.doConsume(HgChangeLogConsumer.java:196)
>       at 
> org.apache.maven.scm.provider.hg.command.changelog.HgChangeLogConsumer.consumeLine(HgChangeLogConsumer.java:97)
>       at 
> org.codehaus.plexus.util.cli.StreamPumper.consumeLine(StreamPumper.java:195)
> The issue happens because my environment has user.language=es, 
> user.country=AR. Even passing these parameters in the command line does not 
> help:
> mvn clean changelog:changelog -Duser.language=en -Duser.country=US
> fails the same way.
> How this was tested:
> - Mercurial repository
> - using maven-changelog-plugin (specifying system parameters here does not 
> help either)
>   <plugin>
>     <groupId>org.apache.maven.plugins</groupId>
>     <artifactId>maven-changelog-plugin</artifactId>
>     <version>2.2</version>
>     <configuration>
>       <dateFormat>EEE MMM dd HH:mm:ss yyyy Z</dateFormat>
>       <systemProperties>
>        <property><name>user.language</name><value>en</value></property>
>        <property><name>user.country</name><value>US</value></property>
>       </systemProperties>
>     </configuration>
>   </plugin>



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to