Please make sure build works and tests don't break, thanks.
On Aug 6, 2007, at 15:08 , [EMAIL PROTECTED] wrote:
Revision10365AuthorfgiustDate2007-08-06 15:08:03 +0200 (Mon, 06 Aug
2007)Log Messagecleaner handling of development version (where $
{project.version} is not replaced)Modified Paths
magnolia/trunk/magnolia-core/src/main/java/info/magnolia/module/
model/Version.java
Diff
Modified: magnolia/trunk/magnolia-core/src/main/java/info/magnolia/
module/model/Version.java (10364 => 10365)--- magnolia/trunk/
magnolia-core/src/main/java/info/magnolia/module/model/Version.java
2007-08-06 12:38:21 UTC (rev 10364) +++ magnolia/trunk/magnolia-
core/src/main/java/info/magnolia/module/model/Version.java
2007-08-06 13:08:03 UTC (rev 10365)@@ -36,7 +36,7 @@ /** *
Convenience constructor that could be used to register Deltas or
update tasks. */- private Version(int major, int minor, int
patch) {+ protected Version(int major, int minor, int patch)
{ this.major = (short) major; this.minor = (short)
minor; this.patch = (short) patch;@@ -44,11 +44,6
@@ } private Version(String versionStr) {-
versionStr = versionStr.trim(); - if (StringUtils.equals("$
{project.version}", versionStr)) { - // development
mode. - versionStr = "0"; - } final int
classifierIdx = versionStr.indexOf('-'); if (classifierIdx
> 0) {@@ -79,7 +74,21 @@ } } + /** + * Factory
method that will parse a version string and return the correct
Version implementatio, + * @param versionStr version as string,
for example <code>1.2.3-test</code>. The String + * <code>$
{project.version}</code> is interpreted as an undefined version
during development ant it will always + * match version ranges
+ * @return a Version implementation, never null + */
public static Version parseVersion(String versionStr) {+ +
versionStr = versionStr.trim(); + if (StringUtils.equals("$
{project.version}", versionStr)) { + // development
mode. + return new UndefinedDevelopmentVersion();
+ } + return new Version(versionStr); } @@ -92,9
+101,7 @@ */ public boolean isEquivalent(final Version
other) { return (this.getMajor() == other.getMajor() &&
this.getMinor() == other.getMinor() && this.getPatch() ==
other- .getPatch()) - || // development
- (this.isUndefinedDevelopmentVersion() ||
other.isUndefinedDevelopmentVersion());+ .getPatch
()); } public boolean isStrictlyAfter(final Version other)
{@@ -110,10 +117,6 @@ return false; } - public
boolean isUndefinedDevelopmentVersion() { - return
this.getMajor() == 0 && this.getMinor() == 0 && this.getPatch() ==
0; - } - public boolean isBeforeOrEquivalent(final Version
other) { return !isStrictlyAfter(other); }@@ -166,6
+169,33 @@ } } + private static final class
UndefinedDevelopmentVersion extends Version { + + public
UndefinedDevelopmentVersion() { + super(0, 0, 0);
+ } + + /** + * [EMAIL PROTECTED] + */
+ @Override + public boolean isBeforeOrEquivalent
(Version other) { + return true; + } + + /
** + * [EMAIL PROTECTED] + */ + @Override
+ public boolean isEquivalent(Version other) { +
return true; + } + + public String toString()
{ + return "(dev)"; + } + } + // generated
methods: public boolean equals(Object o) { if (this ==
o) {
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------