From 68e52f7f9ce7118ce9b9c63a8849dc569b277f06 Mon Sep 17 00:00:00 2001 From: John Dennis Casey Date: Sun, 19 Jun 2005 18:02:07 +0000 Subject: [PATCH] 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 --- .../maven/plugin/version/IntervalUtils.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/version/IntervalUtils.java b/maven-core/src/main/java/org/apache/maven/plugin/version/IntervalUtils.java index dc91a1476c..66063c8e9d 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/version/IntervalUtils.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/version/IntervalUtils.java @@ -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 ) );