[jira] Closed: (SCM-124) StarteamChangeLogConsumerTest does not work if locale is not en or fr
[ http://jira.codehaus.org/browse/SCM-124?page=all ] Emmanuel Venisse closed SCM-124: Assign To: Emmanuel Venisse Resolution: Fixed Fixed. I've tested with : MAVEN_OPTS=-Duser.language=de -Duser.country=DE StarteamChangeLogConsumerTest does not work if locale is not en or fr - Key: SCM-124 URL: http://jira.codehaus.org/browse/SCM-124 Project: Maven SCM 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 Fix For: 1.0-beta-3 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[:[EMAIL PROTECTED]:port:/projectName/[viewName/][folderHiearchy/] [WARNING] Your scm URL use a deprecated format. The new format is :[username[:[EMAIL PROTECTED]:port:/projectName/[viewName/][folderHiearchy/] [WARNING] Your scm URL use a deprecated format. The new format is :[username[:[EMAIL PROTECTED]: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[:[EMAIL PROTECTED]:port:/projectName/[viewName/][folderHiearchy/] [WARNING] Your scm URL use a deprecated format. The new format is :[username[:[EMAIL PROTECTED]: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
[jira] Closed: (SCM-124) StarteamChangeLogConsumerTest does not work if locale is not en or fr
[ http://jira.codehaus.org/browse/SCM-124?page=all ] Emmanuel Venisse closed SCM-124: Resolution: Fixed Applied. Thanks. StarteamChangeLogConsumerTest does not work if locale is not en or fr - Key: SCM-124 URL: http://jira.codehaus.org/browse/SCM-124 Project: Maven SCM 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 Fix For: 1.0-beta-3 Attachments: 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[:[EMAIL PROTECTED]:port:/projectName/[viewName/][folderHiearchy/] [WARNING] Your scm URL use a deprecated format. The new format is :[username[:[EMAIL PROTECTED]:port:/projectName/[viewName/][folderHiearchy/] [WARNING] Your scm URL use a deprecated format. The new format is :[username[:[EMAIL PROTECTED]: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[:[EMAIL PROTECTED]:port:/projectName/[viewName/][folderHiearchy/] [WARNING] Your scm URL use a deprecated format. The new format is :[username[:[EMAIL PROTECTED]: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