You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by st...@apache.org on 2019/06/01 23:25:41 UTC
[maven] branch mng-6667 updated: [MNG-6667] Some people are
excessively fussy
This is an automated email from the ASF dual-hosted git repository.
stephenc pushed a commit to branch mng-6667
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/mng-6667 by this push:
new 08999a8 [MNG-6667] Some people are excessively fussy
08999a8 is described below
commit 08999a88146f05f72fdaf436847f322152898dfe
Author: Stephen Connolly <st...@apache.org>
AuthorDate: Sun Jun 2 00:25:32 2019 +0100
[MNG-6667] Some people are excessively fussy
---
.../model/validation/DefaultModelValidator.java | 24 +++++++++-------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
index 66cd0a2..6b5722f 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
@@ -1092,33 +1092,29 @@ public class DefaultModelValidator
/**
* Compares two model versions.
*
- * @param a the first version.
- * @param b the second version.
- * @return negative if the first version is newer than the secon version, zero if they are the same or positive if
+ * @param first the first version.
+ * @param second the second version.
+ * @return negative if the first version is newer than the second version, zero if they are the same or positive if
* the second version is the newer.
*/
- private int compareModelVersions( String a, String b )
+ private static int compareModelVersions( String first, String second )
{
// we use a dedicated comparator because we control our model version scheme.
- String[] aSegments = StringUtils.split( a, "." );
- String[] bSegments = StringUtils.split( b, "." );
- for ( int i = 0; i < Math.min( aSegments.length, bSegments.length ); i++ )
+ String[] firstSegments = StringUtils.split( first, "." );
+ String[] secondSegments = StringUtils.split( second, "." );
+ for ( int i = 0; i < Math.min( firstSegments.length, secondSegments.length ); i++ )
{
- int result = Long.valueOf( aSegments[i] ).compareTo( Long.valueOf( bSegments[i] ) );
+ int result = Long.valueOf( firstSegments[i] ).compareTo( Long.valueOf( secondSegments[i] ) );
if ( result != 0 )
{
return result;
}
}
- if ( aSegments.length == bSegments.length )
+ if ( firstSegments.length == secondSegments.length )
{
return 0;
}
- if ( aSegments.length > bSegments.length )
- {
- return -1;
- }
- return 1;
+ return firstSegments.length > secondSegments.length ? -1 : 1;
}
@SuppressWarnings( "checkstyle:parameternumber" )