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

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

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

   **[Dennis 
Lundberg](https://issues.apache.org/jira/secure/[email protected])**
 opened 
**[SCM-124](https://issues.apache.org/jira/browse/SCM-124?redirect=false)** and 
commented
   
   The testcase StarteamChangeLogConsumerTest makes assumptions about the 
user's locale that are not always true.
   Lines 45-52 uses the default locale and if a suitable changelog for that 
locale is not found, it defaults to using the English changelog file. This 
works well for English and French which have changelog files. But it does not 
work for other locales that use a different dateformat than English, i.e most 
of Europe.
   
   The problem is that the class StarteamChangeLogConsumer has a private 
instance variable of SimpleDateFormat called localFormat. This variable can not 
be set from outside the class. On line 390 localFormat is used to parse dates. 
This will fail if the user has a different locale than the one being used in 
the logfile being parsed. I imagine that it is common (at least not uncommon) 
to have different locales on the server and the client.
   
   So the locale used in the StarteamChangeLogConsumer needs to be set to the 
locale used by the **server** and not the **client**. A simple getter/setter 
would do the trick. The locale would need to be configurable in some way so 
that the user can set the locale that is used by his/her server.
   
   The reason I stumbled upon this was when I tried to do "mvn test" for 
maven-scm. It produced this stacktrace:
   
   ...
   
   [INFO] 
----------------------------------------------------------------------------
   [INFO] Building Maven SCM Starteam Provider
   [INFO]    task-segment: [test]
   [INFO] 
----------------------------------------------------------------------------
   [INFO] [resources:resources]
   [INFO] Using default encoding to copy filtered resources.
   [INFO] [compiler:compile]
   Compiling 25 source files to 
G:\svn\maven-scm\maven-scm-providers\maven-scm-provider-starteam\target\classes
   [INFO] [resources:testResources]
   [INFO] Using default encoding to copy filtered resources.
   [INFO] [compiler:testCompile]
   Compiling 22 source files to 
G:\svn\maven-scm\maven-scm-providers\maven-scm-provider-starteam\target\test-classes
   [INFO] [surefire:test]
   [INFO] Setting reports dir: 
G:\svn\maven-scm\maven-scm-providers\maven-scm-provider-starteam\target/surefire-reports
   
   ---
   
   T E S T S
   
   ---
   
   [WARNING] Your scm URL use a deprecated format. The new format is 
:[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]
   [WARNING] Your scm URL use a deprecated format. The new format is 
:[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]
   [WARNING] Your scm URL use a deprecated format. The new format is 
:[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]
   [surefire] Running 
org.apache.maven.scm.provider.starteam.command.add.StarteamAddCommandTest
   [surefire] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0,02 sec
   Added: ./maven.xml
   Added: ./target/checkout/maven.xml
   Added: ./target/checkout/project.properties
   Added: ./target/checkout/project.xml
   Added: ./target/checkout/bootstrap/maven.xml
   Added: ./target/checkout/bootstrap/project.properties
   Added: ./target/checkout/bootstrap/project.xml
   [surefire] Running 
org.apache.maven.scm.provider.starteam.command.add.StarteamAddConsumerTest
   [surefire] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,03 sec
   [WARNING] Your scm URL use a deprecated format. The new format is 
:[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]
   [WARNING] Your scm URL use a deprecated format. The new format is 
:[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]
   [surefire] Running 
org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogCommandTest
   [surefire] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0,02 sec
   [ERROR] ParseException Caught
   java.text.ParseException: Unparseable date: "4/21/04 1:05:00 PM PDT"
   at java.text.DateFormat.parse(DateFormat.java:335)
   at 
org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogConsumer.parseDate(StarteamChangeLogConsumer.java:390)
   at 
org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogConsumer.processGetAuthor(StarteamChangeLogConsumer.java:281
   at 
org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogConsumer.consumeLine(StarteamChangeLogConsumer.java:174)
   at 
org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogConsumerTest.testParse(StarteamChangeLogConsumerTest.java:68
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at 
org.codehaus.surefire.battery.JUnitBattery.executeJUnit(JUnitBattery.java:246)
   at org.codehaus.surefire.battery.JUnitBattery.execute(JUnitBattery.java:220)
   at org.codehaus.surefire.Surefire.executeBattery(Surefire.java:204)
   at org.codehaus.surefire.Surefire.run(Surefire.java:153)
   at org.codehaus.surefire.Surefire.run(Surefire.java:77)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at org.codehaus.surefire.SurefireBooter.run(SurefireBooter.java:104)
   at org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:303)
   at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:432)
   at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:530)
   at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
   at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:451)
   at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
   at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
   at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
   at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
   at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
   at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
   at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
   at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
   [surefire] Running 
org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogConsumerTest
   [surefire] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0,03 sec 
<<<<<<<< FAILURE !!
   
   
   ---
   
   **Attachments:**
   - 
[SCM-124.patch](https://issues.apache.org/jira/secure/attachment/12718640/SCM-124.patch)
 (_1.24 kB_)
   - 
[SCM-124-2.patch](https://issues.apache.org/jira/secure/attachment/12718473/SCM-124-2.patch)
 (_899 bytes_)
   




> StarteamChangeLogConsumerTest does not work if locale is not en or fr
> ---------------------------------------------------------------------
>
>                 Key: SCM-124
>                 URL: https://issues.apache.org/jira/browse/SCM-124
>             Project: Maven SCM (Moved to GitHub Issues)
>          Issue Type: Bug
>          Components: maven-scm-provider-starteam
>         Environment: Maven 2.0.1, JDK 1.4.2_09, Win XP Pro, Swedish locale
>            Reporter: Dennis Lundberg
>            Assignee: Emmanuel Venisse
>            Priority: Major
>             Fix For: 1.0-beta-3
>
>         Attachments: SCM-124-2.patch, SCM-124.patch
>
>
> The testcase StarteamChangeLogConsumerTest makes assumptions about the user's 
> locale that are not always true.
> Lines 45-52 uses the default locale and if a suitable changelog for that 
> locale is not found, it defaults to using the English changelog file. This 
> works well for English and French which have changelog files. But it does not 
> work for other locales that use a different dateformat than English, i.e most 
> of Europe.
> The problem is that the class StarteamChangeLogConsumer has a private 
> instance variable of SimpleDateFormat called localFormat. This variable can 
> not be set from outside the class. On line 390 localFormat is used to parse 
> dates. This will fail if the user has a different locale than the one being 
> used in the logfile being parsed. I imagine that it is common (at least not 
> uncommon) to have different locales on the server and the client.
> So the locale used in the StarteamChangeLogConsumer needs to be set to the 
> locale used by the *server* and not the *client*. A simple getter/setter 
> would do the trick. The locale would need to be configurable in some way so 
> that the user can set the locale that is used by his/her server.
> The reason I stumbled upon this was when I tried to do "mvn test" for 
> maven-scm. It produced this stacktrace:
> ...
> [INFO] 
> ----------------------------------------------------------------------------
> [INFO] Building Maven SCM Starteam Provider
> [INFO]    task-segment: [test]
> [INFO] 
> ----------------------------------------------------------------------------
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:compile]
> Compiling 25 source files to 
> G:\svn\maven-scm\maven-scm-providers\maven-scm-provider-starteam\target\classes
> [INFO] [resources:testResources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:testCompile]
> Compiling 22 source files to 
> G:\svn\maven-scm\maven-scm-providers\maven-scm-provider-starteam\target\test-classes
> [INFO] [surefire:test]
> [INFO] Setting reports dir: 
> G:\svn\maven-scm\maven-scm-providers\maven-scm-provider-starteam\target/surefire-reports
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> [WARNING] Your scm URL use a deprecated format. The new format is 
> :[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]
> [WARNING] Your scm URL use a deprecated format. The new format is 
> :[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]
> [WARNING] Your scm URL use a deprecated format. The new format is 
> :[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]
> [surefire] Running 
> org.apache.maven.scm.provider.starteam.command.add.StarteamAddCommandTest
> [surefire] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0,02 sec
> Added: ./maven.xml
> Added: ./target/checkout/maven.xml
> Added: ./target/checkout/project.properties
> Added: ./target/checkout/project.xml
> Added: ./target/checkout/bootstrap/maven.xml
> Added: ./target/checkout/bootstrap/project.properties
> Added: ./target/checkout/bootstrap/project.xml
> [surefire] Running 
> org.apache.maven.scm.provider.starteam.command.add.StarteamAddConsumerTest
> [surefire] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,03 sec
> [WARNING] Your scm URL use a deprecated format. The new format is 
> :[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]
> [WARNING] Your scm URL use a deprecated format. The new format is 
> :[username[:password]@]hostname:port:/projectName/[viewName/][folderHiearchy/]
> [surefire] Running 
> org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogCommandTest
> [surefire] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0,02 sec
> [ERROR] ParseException Caught
> java.text.ParseException: Unparseable date: "4/21/04 1:05:00 PM PDT"
>         at java.text.DateFormat.parse(DateFormat.java:335)
>         at 
> org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogConsumer.parseDate(StarteamChangeLogConsumer.java:390)
>         at 
> org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogConsumer.processGetAuthor(StarteamChangeLogConsumer.java:281
>         at 
> org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogConsumer.consumeLine(StarteamChangeLogConsumer.java:174)
>         at 
> org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogConsumerTest.testParse(StarteamChangeLogConsumerTest.java:68
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at 
> org.codehaus.surefire.battery.JUnitBattery.executeJUnit(JUnitBattery.java:246)
>         at 
> org.codehaus.surefire.battery.JUnitBattery.execute(JUnitBattery.java:220)
>         at org.codehaus.surefire.Surefire.executeBattery(Surefire.java:204)
>         at org.codehaus.surefire.Surefire.run(Surefire.java:153)
>         at org.codehaus.surefire.Surefire.run(Surefire.java:77)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at org.codehaus.surefire.SurefireBooter.run(SurefireBooter.java:104)
>         at 
> org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:303)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:432)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:530)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:451)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at 
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> [surefire] Running 
> org.apache.maven.scm.provider.starteam.command.changelog.StarteamChangeLogConsumerTest
> [surefire] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0,03 sec 
> <<<<<<<< FAILURE !!



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

Reply via email to