Coverage Report - org.apache.maven.wagon.providers.http.LightweightHttpsWagon
 
Classes in this File Line Coverage Branch Coverage Complexity
LightweightHttpsWagon
100%
19/19
100%
2/2
1,333
 
 1  
 package org.apache.maven.wagon.providers.http;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.wagon.ConnectionException;
 23  
 import org.apache.maven.wagon.authentication.AuthenticationException;
 24  
 import org.apache.maven.wagon.proxy.ProxyInfo;
 25  
 
 26  
 /**
 27  
  * LIghtweightHttpsWagon 
 28  
  *
 29  
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
 30  
  * @version $Id: LightweightHttpsWagon.java 834247 2009-11-09 21:46:14Z bentmann $
 31  
  * 
 32  
  * @plexus.component role="org.apache.maven.wagon.Wagon" 
 33  
  *   role-hint="https"
 34  
  *   instantiation-strategy="per-lookup"
 35  
  */
 36  
 public class LightweightHttpsWagon
 37  
     extends LightweightHttpWagon
 38  
 {
 39  
     private String previousHttpsProxyHost;
 40  
     
 41  
     private String previousHttpsProxyPort;
 42  
 
 43  
     private String previousHttpsProxyExclusions;
 44  
 
 45  
     public LightweightHttpsWagon()
 46  
     {
 47  62
         super();
 48  62
     }
 49  
 
 50  
     public void openConnection()
 51  
         throws ConnectionException, AuthenticationException
 52  
     {
 53  58
         previousHttpsProxyHost = System.getProperty( "https.proxyHost" );
 54  58
         previousHttpsProxyPort = System.getProperty( "https.proxyPort" );
 55  58
         previousHttpsProxyExclusions = System.getProperty( "https.nonProxyHosts" );
 56  
         
 57  58
         final ProxyInfo proxyInfo = getProxyInfo( "https", getRepository().getHost() );
 58  58
         if ( proxyInfo != null )
 59  
         {
 60  2
             setSystemProperty( "https.proxyHost", proxyInfo.getHost() );
 61  2
             setSystemProperty( "https.proxyPort", String.valueOf( proxyInfo.getPort() ) );
 62  2
             setSystemProperty( "https.nonProxyHosts", proxyInfo.getNonProxyHosts() );
 63  
         }
 64  
         else
 65  
         {
 66  56
             setSystemProperty( "https.proxyHost", null );
 67  56
             setSystemProperty( "https.proxyPort", null );
 68  
         }
 69  
         
 70  58
         super.openConnection();
 71  58
     }
 72  
 
 73  
     public void closeConnection()
 74  
         throws ConnectionException
 75  
     {
 76  58
         super.closeConnection();
 77  
 
 78  58
         setSystemProperty( "https.proxyHost", previousHttpsProxyHost );
 79  58
         setSystemProperty( "https.proxyPort", previousHttpsProxyPort );
 80  58
         setSystemProperty( "https.nonProxyHosts", previousHttpsProxyExclusions );
 81  58
     }
 82  
 }