LANG-954 uncaught PatternSyntaxException in FastDateFormat on Android

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1561045 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2014-01-24 16:00:35 +00:00
parent 2d55e408ed
commit 8630180fff
2 changed files with 4 additions and 2 deletions

View File

@ -49,6 +49,7 @@
<release version="3.2" date="2014-01-01" description="Bug fixes and new features, at least requires Java 6.0">
<action issue="LANG-934" type="add" dev="mcucchiara">Add removeFinalModifier to FieldUtils</action>
<action issue="LANG-954" type="fix" due-to="Michael Keppler" dev="sebb">uncaught PatternSyntaxException in FastDateFormat on Android</action>
<action issue="LANG-863" type="add" due-to="Daneel S. Yaitskov" dev="sebb">Method returns number of inheritance hops between parent and subclass</action>
<action issue="LANG-932" type="fix" due-to="Ville Skyttä" dev="sebb">Spelling fixes</action>
<action issue="LANG-931" type="update" dev="britter" due-to="Christoph Schneegans">Misleading Javadoc comment in StrBuilderReader class</action>

View File

@ -648,11 +648,12 @@ public class FastDateParser implements DateParser, Serializable {
*/
@Override
boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
// See LANG-954: We use {Nd} rather than {IsNd} because Android does not support the Is prefix
if(parser.isNextNumber()) {
regex.append("(\\p{IsNd}{").append(parser.getFieldWidth()).append("}+)");
regex.append("(\\p{Nd}{").append(parser.getFieldWidth()).append("}+)");
}
else {
regex.append("(\\p{IsNd}++)");
regex.append("(\\p{Nd}++)");
}
return true;
}