You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by cz...@apache.org on 2003/07/03 17:23:34 UTC

cvs commit: avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl URLSource.java

cziegeler    2003/07/03 08:23:34

  Modified:    sourceresolve/src/java/org/apache/excalibur/source/impl
                        URLSource.java
  Log:
  Removing dependency to jdk 1.2
  
  Revision  Changes    Path
  1.25      +4 -52     avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/URLSource.java
  
  Index: URLSource.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/URLSource.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- URLSource.java	4 Apr 2003 16:36:51 -0000	1.24
  +++ URLSource.java	3 Jul 2003 15:23:34 -0000	1.25
  @@ -56,7 +56,6 @@
   
   import java.io.IOException;
   import java.io.InputStream;
  -import java.lang.reflect.Method;
   import java.net.HttpURLConnection;
   import java.net.URL;
   import java.net.URLConnection;
  @@ -180,7 +179,7 @@
                   if (null == m_connection)
                   {
                       m_connection = m_url.openConnection();
  -                    String userInfo = getUserInfo();
  +                    String userInfo = m_url.getUserInfo();
                       if (m_url.getProtocol().startsWith("http") && userInfo != null)
                       {
                           m_connection.setRequestProperty("Authorization", "Basic " + SourceUtil.encodeBASE64(userInfo));
  @@ -226,8 +225,8 @@
           if (m_connection == null)
           {
               m_connection = m_url.openConnection();
  -            /* The following requires a jdk 1.3 */
  -            String userInfo = getUserInfo();
  +
  +            String userInfo = m_url.getUserInfo();
               if (m_url.getProtocol().startsWith("http") && userInfo != null)
               {
                   m_connection.setRequestProperty("Authorization", "Basic " + SourceUtil.encodeBASE64(userInfo));
  @@ -281,53 +280,6 @@
           input = m_connection.getInputStream();
           m_connection = null; // make sure a new m_connection is created next time
           return input;
  -    }
  -
  -    private static boolean checkedURLClass = false;
  -    private static boolean urlSupportsGetUserInfo = false;
  -    private static Method urlGetUserInfo = null;
  -    private static Object[] emptyParams = new Object[0];
  -
  -    /**
  -     * Check if the <code>URL</code> class supports the getUserInfo()
  -     * method which is introduced in jdk 1.3
  -     */
  -    protected String getUserInfo()
  -    {
  -        if (URLSource.checkedURLClass == true)
  -        {
  -            if (URLSource.urlSupportsGetUserInfo == true)
  -            {
  -                try
  -                {
  -                    return (String) URLSource.urlGetUserInfo.invoke(m_url, URLSource.emptyParams);
  -                }
  -                catch (Exception e)
  -                {
  -                    // ignore this anyway
  -                }
  -            }
  -            return null;
  -        }
  -        else
  -        {
  -            // test if the m_url class supports the getUserInfo method
  -            try
  -            {
  -                URLSource.urlGetUserInfo = URL.class.getMethod("getUserInfo", null);
  -                String ui = (String) URLSource.urlGetUserInfo.invoke(m_url, URLSource.emptyParams);
  -                URLSource.checkedURLClass = true;
  -                URLSource.urlSupportsGetUserInfo = true;
  -                return ui;
  -            }
  -            catch (Exception e)
  -            {
  -            }
  -            URLSource.checkedURLClass = true;
  -            URLSource.urlSupportsGetUserInfo = false;
  -            URLSource.urlGetUserInfo = null;
  -            return null;
  -        }
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org