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

ASF GitHub Bot commented on SCM-744:
------------------------------------

jira-importer opened a new issue, #953:
URL: https://github.com/apache/maven-scm/issues/953

   **[Matías 
Albanesi](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=malbanesi)**
 opened 
**[SCM-744](https://issues.apache.org/jira/browse/SCM-744?redirect=false)** and 
commented
   
   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>
   
   
   
   ---
   
   **Affects:** 1.8.1
   




> 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