ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r981331 - in /ant/ivy/core/branches/2.2.x: ./ CHANGES.txt src/java/org/apache/ivy/util/url/BasicURLHandler.java src/java/org/apache/ivy/util/url/IvyAuthenticator.java
Date Sun, 01 Aug 2010 22:22:16 GMT
Author: maartenc
Date: Sun Aug  1 22:22:15 2010
New Revision: 981331

URL: http://svn.apache.org/viewvc?rev=981331&view=rev
Log:
Merged changes for IVY-1211 from trunk into 2.2.x branch.

Modified:
    ant/ivy/core/branches/2.2.x/   (props changed)
    ant/ivy/core/branches/2.2.x/CHANGES.txt
    ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/util/url/BasicURLHandler.java
    ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/util/url/IvyAuthenticator.java

Propchange: ant/ivy/core/branches/2.2.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Aug  1 22:22:15 2010
@@ -1,4 +1,4 @@
 /ant/ivy/core/branches/2.0.0:727187-727188,727520-732505
 /ant/ivy/core/branches/2.0.0-rc2:707459-708717
 /ant/ivy/core/branches/2.0.x:696803-698317
-/ant/ivy/core/trunk:695737,696014-696031,696442,958415-958693,961017-961020,962767-965284
+/ant/ivy/core/trunk:695737,696014-696031,696442,958415-958693,961017-961020,962767-981329

Modified: ant/ivy/core/branches/2.2.x/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.2.x/CHANGES.txt?rev=981331&r1=981330&r2=981331&view=diff
==============================================================================
--- ant/ivy/core/branches/2.2.x/CHANGES.txt (original)
+++ ant/ivy/core/branches/2.2.x/CHANGES.txt Sun Aug  1 22:22:15 2010
@@ -110,6 +110,7 @@ for detailed view of each issue, please 
 	
    2.2.0
 =====================================
+- IMPROVEMENT: Use IvyAuthenticator only when it is really necessary (IVY-1211)
 - IMPROVEMENT: ivy:makepom now accepts a list of configurations to include (IVY-1005) (thanks
to Jesper Pedersen)
 
 - FIX: XmlModuleDescriptorWriter does not write the transitive attribute (IVY-1207) (thanks
to Abel Muino)

Modified: ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/util/url/BasicURLHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/util/url/BasicURLHandler.java?rev=981331&r1=981330&r2=981331&view=diff
==============================================================================
--- ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/util/url/BasicURLHandler.java (original)
+++ ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/util/url/BasicURLHandler.java Sun
Aug  1 22:22:15 2010
@@ -56,8 +56,10 @@ public class BasicURLHandler extends Abs
 
     public URLInfo getURLInfo(URL url, int timeout) {
         // Install the IvyAuthenticator
-        IvyAuthenticator.install();
-
+        if ("http".equals(url.getProtocol()) || "https".equals(url.getProtocol())) {
+            IvyAuthenticator.install();
+        }
+        
         URLConnection con = null;
         try {
             url = normalizeToURL(url);
@@ -109,7 +111,9 @@ public class BasicURLHandler extends Abs
 
     public InputStream openStream(URL url) throws IOException {
         // Install the IvyAuthenticator
-        IvyAuthenticator.install();
+        if ("http".equals(url.getProtocol()) || "https".equals(url.getProtocol())) {
+            IvyAuthenticator.install();
+        }
 
         URLConnection conn = null;
         try {
@@ -142,7 +146,9 @@ public class BasicURLHandler extends Abs
     
     public void download(URL src, File dest, CopyProgressListener l) throws IOException {
         // Install the IvyAuthenticator
-        IvyAuthenticator.install();
+        if ("http".equals(src.getProtocol()) || "https".equals(src.getProtocol())) {
+            IvyAuthenticator.install();
+        }
 
         URLConnection srcConn = null;
         try {
@@ -186,14 +192,14 @@ public class BasicURLHandler extends Abs
     }
 
     public void upload(File source, URL dest, CopyProgressListener l) throws IOException
{
-        // Install the IvyAuthenticator
-        IvyAuthenticator.install();
-
         if (!"http".equals(dest.getProtocol()) && !"https".equals(dest.getProtocol()))
{
             throw new UnsupportedOperationException(
                     "URL repository only support HTTP PUT at the moment");
         }
 
+        // Install the IvyAuthenticator
+        IvyAuthenticator.install();
+
         HttpURLConnection conn = null;
         try {
             dest = normalizeToURL(dest);

Modified: ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/util/url/IvyAuthenticator.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/util/url/IvyAuthenticator.java?rev=981331&r1=981330&r2=981331&view=diff
==============================================================================
--- ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/util/url/IvyAuthenticator.java (original)
+++ ant/ivy/core/branches/2.2.x/src/java/org/apache/ivy/util/url/IvyAuthenticator.java Sun
Aug  1 22:22:15 2010
@@ -31,6 +31,8 @@ public final class IvyAuthenticator exte
 
     private Authenticator original;
     
+    private static boolean securityWarningLogged = false;
+    
     /**
      * Private c'tor to prevent instantiation.
      */
@@ -58,7 +60,15 @@ public final class IvyAuthenticator exte
         }
 
         if (!(original instanceof IvyAuthenticator)) {
-            Authenticator.setDefault(new IvyAuthenticator(original));
+            try {
+                Authenticator.setDefault(new IvyAuthenticator(original));
+            } catch (SecurityException e) {
+                if (!securityWarningLogged) {
+                    securityWarningLogged = true;
+                    Message.warn("Not enough permissions to set the IvyAuthenticator. " +
+                            "HTTP(S) authentication will be disabled!");            
+                }
+            }
         }
     }
 



Mime
View raw message