maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason van Zyl (JIRA)" <j...@codehaus.org>
Subject [jira] (MNG-5794) Warn about Proxies with duplicate id, but different protocols
Date Fri, 03 Apr 2015 15:50:18 GMT

    [ https://jira.codehaus.org/browse/MNG-5794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=366056#comment-366056
] 

Jason van Zyl commented on MNG-5794:
------------------------------------

Please do not put validation logic in what is a configuration. If we are going to validate
this configuration we should do it elsewhere. Adding components like the logger to an object
that is for configuration is a sign the logic is in the wrong place.

> Warn about Proxies with duplicate id, but different protocols
> -------------------------------------------------------------
>
>                 Key: MNG-5794
>                 URL: https://jira.codehaus.org/browse/MNG-5794
>             Project: Maven
>          Issue Type: Improvement
>          Components: Settings
>    Affects Versions: 3.3.1
>            Reporter: Thomas Meyer
>            Assignee: Robert Scholte
>         Attachments: validate-proxies.patch
>
>
> I did copy the HTTPS proxy entry and modified it into a HTTP entry in
> the {{settings.xml}}.
> But I forgot to change the id of the second proxy entry.
> It took me a while to figure out why it isn't working...
> Untested patch, but I hope you get the idea!
> with kind regards
> thomas
> {code}
> diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
> --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
> +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
> @@ -162,7 +162,10 @@
>      private boolean useLegacyLocalRepositoryManager = false;
>  
>      private Map<String, Object> data;
> -    
> +
> +    @Inject
> +    private Logger logger;
> +
>      public DefaultMavenExecutionRequest()
>      {
>      }
> @@ -788,7 +791,14 @@ public MavenExecutionRequest addProxy( Proxy proxy )
>          {
>              if ( p.getId() != null && p.getId().equals( proxy.getId() ) )
>              {
> -                return this;
> +                if( !( p.getProtocol().equals( proxy.getProtocol() ) ) )
> +                {
> +                    logger.warn( "Duplicate proxy id found! But protocol differs!\n"
+
> +                                 "Please check your settings.xml file!" );
> +                } else
> +                {
> +                    return this;
> +                }
>              }
>          }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Mime
View raw message