You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2018/04/01 22:13:05 UTC
[maven-scm] branch SCM-878 created (now c83eee6)
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a change to branch SCM-878
in repository https://gitbox.apache.org/repos/asf/maven-scm.git.
at c83eee6 [SCM-878] AbstractConsumer#parseDate() logs wrong locale in case of a ParseException
This branch includes the following new commits:
new c83eee6 [SCM-878] AbstractConsumer#parseDate() logs wrong locale in case of a ParseException
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
--
To stop receiving notification emails like this one, please contact
michaelo@apache.org.
[maven-scm] 01/01: [SCM-878] AbstractConsumer#parseDate() logs
wrong locale in case of a ParseException
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch SCM-878
in repository https://gitbox.apache.org/repos/asf/maven-scm.git
commit c83eee65903c6d1eafd9e51810a3c523037b499b
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Mon Apr 2 00:10:41 2018 +0200
[SCM-878] AbstractConsumer#parseDate() logs wrong locale in case of a ParseException
This commit applies several fixes to solve this issue:
* Apply locale if userPattern is set
* Cache the used locale
* Update log statement in case of a ParseException to print used pattern and locale
---
.../apache/maven/scm/util/AbstractConsumer.java | 26 ++++++++++++++++------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/util/AbstractConsumer.java b/maven-scm-api/src/main/java/org/apache/maven/scm/util/AbstractConsumer.java
index 530e602..b22a29b 100644
--- a/maven-scm-api/src/main/java/org/apache/maven/scm/util/AbstractConsumer.java
+++ b/maven-scm-api/src/main/java/org/apache/maven/scm/util/AbstractConsumer.java
@@ -78,10 +78,20 @@ public abstract class AbstractConsumer
DateFormat format;
String patternUsed = null;
-
+ Locale localeUsed = null;
+
if ( StringUtils.isNotEmpty( userPattern ) )
{
- format = new SimpleDateFormat( userPattern );
+ if (locale != null )
+ {
+ format = new SimpleDateFormat( userPattern, locale );
+ localeUsed = locale;
+ }
+ else
+ {
+ format = new SimpleDateFormat( userPattern );
+ localeUsed = Locale.getDefault();
+ }
patternUsed = userPattern;
}
else
@@ -91,10 +101,12 @@ public abstract class AbstractConsumer
if ( locale != null )
{
format = new SimpleDateFormat( defaultPattern, locale );
+ localeUsed = locale;
}
else
{
format = new SimpleDateFormat( defaultPattern );
+ localeUsed = Locale.getDefault();
}
patternUsed = defaultPattern;
}
@@ -102,8 +114,8 @@ public abstract class AbstractConsumer
{
// Use the English short date pattern if no pattern is specified
format = DateFormat.getDateInstance( DateFormat.SHORT, Locale.ENGLISH );
-
- patternUsed = " DateFormat.SHORT ";
+ patternUsed = "DateFormat.SHORT";
+ localeUsed = Locale.ENGLISH;
}
}
@@ -116,9 +128,9 @@ public abstract class AbstractConsumer
if ( getLogger() != null && getLogger().isWarnEnabled() )
{
getLogger().warn(
- "skip ParseException: " + e.getMessage() + " during parsing date " + date
- + " with pattern " + patternUsed + " with Locale "
- + ( locale == null ? Locale.ENGLISH : locale ), e );
+ "skip ParseException: " + e.getMessage() + " during parsing date '" + date
+ + "' with pattern '" + patternUsed + "' and locale '"
+ + localeUsed + "'", e );
}
return null;
--
To stop receiving notification emails like this one, please contact
michaelo@apache.org.