Adding default interval type of minutes, in case W|D|H|M is not specified. This is to be consistent with the snapshot policy in the repository.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@191357 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-06-19 18:02:07 +00:00
parent 9863732555
commit 68e52f7f9c
1 changed files with 16 additions and 2 deletions

View File

@ -26,7 +26,7 @@
public final class IntervalUtils
{
private static final String PERIOD_PART_PATTERN = "[0-9]+[WwDdHhMm]";
private static final String PERIOD_PART_PATTERN = "[0-9]+[WwDdHhMm]?";
private static final Map PART_TYPE_CONTRIBUTIONS;
@ -98,7 +98,21 @@ private static long getPartPeriod( String part )
{
char type = part.charAt( part.length() - 1 );
int coefficient = Integer.parseInt( part.substring( 0, part.length() -1 ) );
String coefficientPart;
if( Character.isLetter(type))
{
coefficientPart = part.substring( 0, part.length() - 1);
}
else
{
// if the interval doesn't specify a resolution, assume minutes.
coefficientPart = part;
type = 'm';
}
int coefficient = Integer.parseInt( coefficientPart );
Long period = (Long) PART_TYPE_CONTRIBUTIONS.get( "" + Character.toLowerCase( type ) );