mirror of https://github.com/apache/maven.git
[MNG-4518] Profile activation based on JRE version misbehaves if java.version has build number
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@896102 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9f217fd24c
commit
f5ebc72d12
|
@ -108,20 +108,10 @@ public class JdkVersionProfileActivator
|
|||
List<String> valueTokens = new ArrayList<String>( Arrays.asList( value.split( "[\\.\\-\\_]" ) ) );
|
||||
List<String> rangeValueTokens = new ArrayList<String>( Arrays.asList( rangeValue.value.split( "\\." ) ) );
|
||||
|
||||
int max = Math.max( valueTokens.size(), rangeValueTokens.size() );
|
||||
addZeroTokens( valueTokens, max );
|
||||
addZeroTokens( rangeValueTokens, max );
|
||||
addZeroTokens( valueTokens, 3 );
|
||||
addZeroTokens( rangeValueTokens, 3 );
|
||||
|
||||
if ( value.equals( rangeValue.getValue() ) )
|
||||
{
|
||||
if ( !rangeValue.isClosed() )
|
||||
{
|
||||
return isLeft ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < valueTokens.size() && i < rangeValueTokens.size(); i++ )
|
||||
for ( int i = 0; i < 3; i++ )
|
||||
{
|
||||
int x = Integer.parseInt( valueTokens.get( i ) );
|
||||
int y = Integer.parseInt( rangeValueTokens.get( i ) );
|
||||
|
@ -143,12 +133,9 @@ public class JdkVersionProfileActivator
|
|||
|
||||
private static void addZeroTokens( List<String> tokens, int max )
|
||||
{
|
||||
if ( tokens.size() < max )
|
||||
while ( tokens.size() < max )
|
||||
{
|
||||
for ( int i = 0; i < ( max - tokens.size() ); i++ )
|
||||
{
|
||||
tokens.add( "0" );
|
||||
}
|
||||
tokens.add( "0" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,9 +116,8 @@ public class JdkVersionProfileActivatorTest
|
|||
|
||||
assertActivation( true, profile, newContext( null, newProperties( "1.6" ) ) );
|
||||
assertActivation( true, profile, newContext( null, newProperties( "1.6.0" ) ) );
|
||||
// TODO: controversial, needs discussion
|
||||
// assertActivation( true, profile, newContext( null, newProperties( "1.6.0_09" ) ) );
|
||||
// assertActivation( true, profile, newContext( null, newProperties( "1.6.0_09-b03" ) ) );
|
||||
assertActivation( true, profile, newContext( null, newProperties( "1.6.0_09" ) ) );
|
||||
assertActivation( true, profile, newContext( null, newProperties( "1.6.0_09-b03" ) ) );
|
||||
}
|
||||
|
||||
public void testVersionRangeExclusiveBounds()
|
||||
|
@ -127,11 +126,13 @@ public class JdkVersionProfileActivatorTest
|
|||
Profile profile = newProfile( "(1.3,1.6)" );
|
||||
|
||||
assertActivation( false, profile, newContext( null, newProperties( "1.3" ) ) );
|
||||
assertActivation( false, profile, newContext( null, newProperties( "1.3.0" ) ) );
|
||||
assertActivation( false, profile, newContext( null, newProperties( "1.3.0_09" ) ) );
|
||||
assertActivation( false, profile, newContext( null, newProperties( "1.3.0_09-b03" ) ) );
|
||||
|
||||
// TODO: controversial, needs discussion
|
||||
// assertActivation( true, profile, newContext( null, newProperties( "1.3.1" ) ) );
|
||||
// assertActivation( true, profile, newContext( null, newProperties( "1.3.1_09" ) ) );
|
||||
// assertActivation( true, profile, newContext( null, newProperties( "1.3.1_09-b03" ) ) );
|
||||
assertActivation( true, profile, newContext( null, newProperties( "1.3.1" ) ) );
|
||||
assertActivation( true, profile, newContext( null, newProperties( "1.3.1_09" ) ) );
|
||||
assertActivation( true, profile, newContext( null, newProperties( "1.3.1_09-b03" ) ) );
|
||||
|
||||
assertActivation( true, profile, newContext( null, newProperties( "1.5" ) ) );
|
||||
assertActivation( true, profile, newContext( null, newProperties( "1.5.0" ) ) );
|
||||
|
|
Loading…
Reference in New Issue