From b9fb76221525b459e6f0f4e9ecaef96f061b3a34 Mon Sep 17 00:00:00 2001 From: Arturo Bernal Date: Fri, 8 Oct 2021 18:39:39 +0200 Subject: [PATCH] [MNG-7292] Unnecessarily escaped character Closes #573 --- .../org/apache/maven/profiles/DefaultProfileManager.java | 6 +++--- .../repository/legacy/DefaultUpdateCheckManager.java | 2 +- .../repository/legacy/WagonConfigurationException.java | 4 ++-- .../project/inheritance/t12/ProjectInheritanceTest.java | 3 ++- .../repository/metadata/AbstractRepositoryMetadata.java | 2 +- .../java/org/apache/maven/execution/ReactorManager.java | 4 ++-- .../org/apache/maven/plugin/PluginParameterException.java | 8 ++++---- .../plugin/version/PluginVersionNotFoundException.java | 2 +- .../plugin/version/PluginVersionResolutionException.java | 6 +++--- .../maven/model/validation/DefaultModelValidatorTest.java | 8 ++++---- .../org/apache/maven/plugin/descriptor/Parameter.java | 2 +- 11 files changed, 24 insertions(+), 23 deletions(-) diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java b/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java index 375460aeed..11dc0a3322 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java @@ -109,7 +109,7 @@ public void addProfile( Profile profile ) Profile existing = profilesById.get( profileId ); if ( existing != null ) { - logger.warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() + logger.warn( "Overriding profile: '" + profileId + "' (source: " + existing.getSource() + ") with new instance from source: " + profile.getSource() ); } @@ -130,7 +130,7 @@ public void explicitlyActivate( String profileId ) { if ( !activatedIds.contains( profileId ) ) { - logger.debug( "Profile with id: \'" + profileId + "\' has been explicitly activated." ); + logger.debug( "Profile with id: '" + profileId + "' has been explicitly activated." ); activatedIds.add( profileId ); } @@ -154,7 +154,7 @@ public void explicitlyDeactivate( String profileId ) { if ( !deactivatedIds.contains( profileId ) ) { - logger.debug( "Profile with id: \'" + profileId + "\' has been explicitly deactivated." ); + logger.debug( "Profile with id: '" + profileId + "' has been explicitly deactivated." ); deactivatedIds.add( profileId ); } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java index cd01ec910f..b2a0ef05e4 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java @@ -323,7 +323,7 @@ Date readLastUpdated( File touchfile, String key ) } catch ( NumberFormatException e ) { - getLogger().debug( "Cannot parse lastUpdated date: \'" + rawVal + "\'. Ignoring.", e ); + getLogger().debug( "Cannot parse lastUpdated date: '" + rawVal + "'. Ignoring.", e ); } } } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java index 554212586a..67b9ec76d4 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java @@ -37,7 +37,7 @@ public WagonConfigurationException( String repositoryId, String message, Throwable cause ) { - super( "While configuring wagon for \'" + repositoryId + "\': " + message, cause ); + super( "While configuring wagon for '" + repositoryId + "': " + message, cause ); this.repositoryId = repositoryId; this.originalMessage = message; @@ -46,7 +46,7 @@ public WagonConfigurationException( String repositoryId, public WagonConfigurationException( String repositoryId, String message ) { - super( "While configuring wagon for \'" + repositoryId + "\': " + message ); + super( "While configuring wagon for '" + repositoryId + "': " + message ); this.repositoryId = repositoryId; this.originalMessage = message; diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java index 086d710eb2..50f5f08941 100644 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java +++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java @@ -65,6 +65,7 @@ public void testFalsePluginExecutionInheritValue() throws Exception assertNotNull( compilerPlugin ); Map executionMap = compilerPlugin.getExecutionsAsMap(); - assertNull( executionMap.get( "test" ), "Plugin execution: \'test\' should NOT exist in the compiler plugin specification for the child project!" ); + assertNull( executionMap.get( "test" ), + "Plugin execution: 'test' should NOT exist in the compiler plugin specification for the child project!" ); } } \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java index 30782944fa..ed02da8d0b 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java @@ -149,7 +149,7 @@ else if ( metadataFile.exists() ) public String toString() { - return "repository metadata for: \'" + getKey() + "\'"; + return "repository metadata for: '" + getKey() + "'"; } protected static Metadata createMetadata( Artifact artifact, Versioning versioning ) diff --git a/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java b/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java index 1a7f50059e..795ac349b2 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java +++ b/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java @@ -91,8 +91,8 @@ public void setFailureBehavior( String failureBehavior ) else { throw new IllegalArgumentException( - "Invalid failure behavior (must be one of: \'" + FAIL_FAST + "\', \'" + FAIL_AT_END + "\', \'" - + FAIL_NEVER + "\')." ); + "Invalid failure behavior (must be one of: '" + FAIL_FAST + "', '" + FAIL_AT_END + "', '" + + FAIL_NEVER + "')." ); } } diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java index d0a21edb21..d1fa98d0ed 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java @@ -105,9 +105,9 @@ private static void decomposeParameterIntoUserInstructions( MojoDescriptor mojo, } } - messageBuffer.append( "Inside the definition for plugin \'" ); + messageBuffer.append( "Inside the definition for plugin '" ); messageBuffer.append( mojo.getPluginDescriptor().getArtifactId() ); - messageBuffer.append( "\', specify the following:" ).append( LS ).append( LS ); + messageBuffer.append( "', specify the following:" ).append( LS ).append( LS ); messageBuffer.append( "" ).append( LS ).append( " ..." ).append( LS ); messageBuffer.append( " <" ).append( param.getName() ).append( '>' ); if ( isArray || isCollection ) @@ -179,9 +179,9 @@ public String buildDiagnosticMessage() List params = getParameters(); MojoDescriptor mojo = getMojoDescriptor(); - messageBuffer.append( "One or more required plugin parameters are invalid/missing for \'" ) + messageBuffer.append( "One or more required plugin parameters are invalid/missing for '" ) .append( mojo.getPluginDescriptor().getGoalPrefix() ).append( ':' ).append( mojo.getGoal() ) - .append( "\'" ).append( LS ); + .append( "'" ).append( LS ); int idx = 0; for ( Iterator it = params.iterator(); it.hasNext(); idx++ ) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java b/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java index 13b1fb9f69..b4864fc5d8 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java @@ -31,7 +31,7 @@ public class PluginVersionNotFoundException public PluginVersionNotFoundException( String groupId, String artifactId ) { - super( "The plugin \'" + groupId + ":" + artifactId + "\' does not exist or no valid version could be found" ); + super( "The plugin '" + groupId + ":" + artifactId + "' does not exist or no valid version could be found" ); this.groupId = groupId; this.artifactId = artifactId; diff --git a/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolutionException.java b/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolutionException.java index c1b5ccfd09..6bde3f22e4 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolutionException.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolutionException.java @@ -38,7 +38,7 @@ public class PluginVersionResolutionException public PluginVersionResolutionException( String groupId, String artifactId, String baseMessage, Throwable cause ) { - super( "Error resolving version for plugin \'" + groupId + ":" + artifactId + "\': " + baseMessage, cause ); + super( "Error resolving version for plugin '" + groupId + ":" + artifactId + "': " + baseMessage, cause ); this.groupId = groupId; this.artifactId = artifactId; @@ -47,7 +47,7 @@ public PluginVersionResolutionException( String groupId, String artifactId, Stri public PluginVersionResolutionException( String groupId, String artifactId, String baseMessage ) { - super( "Error resolving version for plugin \'" + groupId + ":" + artifactId + "\': " + baseMessage ); + super( "Error resolving version for plugin '" + groupId + ":" + artifactId + "': " + baseMessage ); this.groupId = groupId; this.artifactId = artifactId; @@ -57,7 +57,7 @@ public PluginVersionResolutionException( String groupId, String artifactId, Stri public PluginVersionResolutionException( String groupId, String artifactId, LocalRepository localRepository, List remoteRepositories, String baseMessage ) { - super( "Error resolving version for plugin \'" + groupId + ":" + artifactId + "\' from the repositories " + super( "Error resolving version for plugin '" + groupId + ":" + artifactId + "' from the repositories " + format( localRepository, remoteRepositories ) + ": " + baseMessage ); this.groupId = groupId; diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java index fd63809911..4517eb75f1 100644 --- a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java +++ b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java @@ -278,10 +278,10 @@ public void testMissingAll() List messages = result.getErrors(); - assertTrue( messages.contains( "\'modelVersion\' is missing." ) ); - assertTrue( messages.contains( "\'groupId\' is missing." ) ); - assertTrue( messages.contains( "\'artifactId\' is missing." ) ); - assertTrue( messages.contains( "\'version\' is missing." ) ); + assertTrue( messages.contains( "'modelVersion' is missing." ) ); + assertTrue( messages.contains( "'groupId' is missing." ) ); + assertTrue( messages.contains( "'artifactId' is missing." ) ); + assertTrue( messages.contains( "'version' is missing." ) ); // type is inherited from the super pom } diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java index 6c5036bc5a..14fd2f0ba9 100644 --- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java +++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java @@ -155,7 +155,7 @@ public String getDefaultValue() public String toString() { - return "Mojo parameter [name: \'" + getName() + "\'; alias: \'" + getAlias() + "\']"; + return "Mojo parameter [name: '" + getName() + "'; alias: '" + getAlias() + "']"; } public Requirement getRequirement()