mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-11 20:45:05 +00:00
LANG-981 DurationFormatUtils#lexx does not detect unmatched quote char
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1573770 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8d360ae707
commit
aadd8e172e
@ -22,6 +22,7 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<release version="3.4" date="TBA" description="TBA">
|
<release version="3.4" date="TBA" description="TBA">
|
||||||
|
<action issue="LANG-981" type="fix" dev="sebb">DurationFormatUtils#lexx does not detect unmatched quote char</action>
|
||||||
<action issue="LANG-984" type="fix" dev="sebb">DurationFormatUtils does not handle large durations correctly</action>
|
<action issue="LANG-984" type="fix" dev="sebb">DurationFormatUtils does not handle large durations correctly</action>
|
||||||
<action issue="LANG-982" type="fix" dev="sebb">DurationFormatUtils.formatDuration(61999, "s.SSSS") - ms field size should be 4 digits</action>
|
<action issue="LANG-982" type="fix" dev="sebb">DurationFormatUtils.formatDuration(61999, "s.SSSS") - ms field size should be 4 digits</action>
|
||||||
<action issue="LANG-978" type="fix" dev="sebb">Failing tests with Java 8 b128</action>
|
<action issue="LANG-978" type="fix" dev="sebb">Failing tests with Java 8 b128</action>
|
||||||
|
@ -542,6 +542,9 @@ static Token[] lexx(final String format) {
|
|||||||
buffer = null;
|
buffer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (inLiteral) { // i.e. we have not found the end of the literal
|
||||||
|
throw new IllegalArgumentException("Unmatched quote in format: " + format);
|
||||||
|
}
|
||||||
return list.toArray(new Token[list.size()]);
|
return list.toArray(new Token[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,7 +553,12 @@ public void testDurationsByBruteForce() {
|
|||||||
bruteForce(1969, 1, 28, "M", Calendar.MONTH); // tests for 48 years
|
bruteForce(1969, 1, 28, "M", Calendar.MONTH); // tests for 48 years
|
||||||
//bruteForce(1996, 1, 29, "M", Calendar.MONTH); // this will fail
|
//bruteForce(1996, 1, 29, "M", Calendar.MONTH); // this will fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected=IllegalArgumentException.class)
|
||||||
|
public void testLANG981() { // unmatched quote char in lexx
|
||||||
|
DurationFormatUtils.lexx("'yMdHms''S");
|
||||||
|
}
|
||||||
|
|
||||||
private static final int FOUR_YEARS = 365 * 3 + 366;
|
private static final int FOUR_YEARS = 365 * 3 + 366;
|
||||||
|
|
||||||
// Takes a minute to run, so generally turned off
|
// Takes a minute to run, so generally turned off
|
||||||
|
Loading…
x
Reference in New Issue
Block a user