From 6683e8681f06c4609035bc61dcfc335746b2965b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 14 Jun 2014 00:08:07 +0200 Subject: [PATCH] code formatting --- .../versioning/DefaultArtifactVersion.java | 5 +++-- .../DefaultArtifactVersionTest.java | 2 +- .../repository/DefaultMirrorSelectorTest.java | 19 +++++++++++-------- .../model/profile/DefaultProfileSelector.java | 6 ++++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java index 6a6ab7439f..7a61128f89 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java @@ -205,14 +205,15 @@ public class DefaultArtifactVersion private static Integer getNextIntegerToken( StringTokenizer tok ) { - try { + try + { String s = tok.nextToken(); if ( ( s.length() > 1 ) && s.startsWith( "0" ) ) { throw new NumberFormatException( "Number part has a leading 0: '" + s + "'" ); } return Integer.valueOf( s ); - } + } catch( NoSuchElementException e ) { throw new NumberFormatException( "Number is invalid" ); diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/DefaultArtifactVersionTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/DefaultArtifactVersionTest.java index 4989e1551f..fc5a2742ed 100644 --- a/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/DefaultArtifactVersionTest.java +++ b/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/DefaultArtifactVersionTest.java @@ -201,7 +201,7 @@ public class DefaultArtifactVersionTest } catch ( Exception e ) { - assertTrue("We expect a NumberFormatException to be thrown.", e instanceof NumberFormatException); + assertTrue( "We expect a NumberFormatException to be thrown.", e instanceof NumberFormatException ); } } diff --git a/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java b/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java index 6db0aafdf7..ba6a4a66eb 100644 --- a/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java @@ -23,13 +23,16 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.codehaus.plexus.PlexusTestCase; -public class DefaultMirrorSelectorTest extends PlexusTestCase { +public class DefaultMirrorSelectorTest + extends PlexusTestCase +{ - public void testMirrorWithMirroOfPatternContainingANegationIsNotSelected() { - ArtifactRepository repository = new DefaultArtifactRepository("snapshots.repo", "http://whatever", null); - String pattern = "external:*, !snapshots.repo"; - boolean matches = DefaultMirrorSelector.matchPattern(repository, pattern); - System.out.println(matches); - assertFalse(matches); - } + public void testMirrorWithMirroOfPatternContainingANegationIsNotSelected() + { + ArtifactRepository repository = new DefaultArtifactRepository( "snapshots.repo", "http://whatever", null ); + String pattern = "external:*, !snapshots.repo"; + boolean matches = DefaultMirrorSelector.matchPattern( repository, pattern ); + System.out.println( matches ); + assertFalse( matches ); + } } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java index 0aeed9d1e9..80a051a83c 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java @@ -105,8 +105,10 @@ public class DefaultProfileSelector private boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems ) { boolean isActive = false; - for ( ProfileActivator activator : activators ) { - if ( activator.presentInConfig( profile, context, problems ) ) { + for ( ProfileActivator activator : activators ) + { + if ( activator.presentInConfig( profile, context, problems ) ) + { isActive = true; } }