You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ol...@apache.org on 2003/10/11 21:44:27 UTC

cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie CookiePolicy.java

olegk       2003/10/11 12:44:27

  Modified:    httpclient/src/java/org/apache/commons/httpclient Tag:
                        HTTPCLIENT_2_0_BRANCH HttpClient.java
                        HttpMethodBase.java HttpState.java URI.java
               httpclient/src/java/org/apache/commons/httpclient/cookie
                        Tag: HTTPCLIENT_2_0_BRANCH CookiePolicy.java
  Log:
  PR#: 23708 (HttpClient violates applet sandbox)
  
  Changelog:
  - SecurityException thrown when accessing system properties are ignored
  
  Contributed by Oleg Kalnichevski
  Reviewed by Michael Becke
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.76.2.2  +19 -17    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java
  
  Index: HttpClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
  retrieving revision 1.76.2.1
  retrieving revision 1.76.2.2
  diff -u -r1.76.2.1 -r1.76.2.2
  --- HttpClient.java	16 Sep 2003 21:30:35 -0000	1.76.2.1
  +++ HttpClient.java	11 Oct 2003 19:44:27 -0000	1.76.2.2
  @@ -102,20 +102,22 @@
   
       static {
           if (LOG.isDebugEnabled()) {
  -            LOG.debug("Java version: " + System.getProperty("java.version"));
  -            LOG.debug("Java vendor: " + System.getProperty("java.vendor"));
  -            LOG.debug("Java class path: " + System.getProperty("java.class.path"));
  -            LOG.debug("Operating system name: " + System.getProperty("os.name"));
  -            LOG.debug("Operating system architecture: " + System.getProperty("os.arch"));
  -            LOG.debug("Operating system version: " + System.getProperty("os.version"));
  +            try {
  +                LOG.debug("Java version: " + System.getProperty("java.version"));
  +                LOG.debug("Java vendor: " + System.getProperty("java.vendor"));
  +                LOG.debug("Java class path: " + System.getProperty("java.class.path"));
  +                LOG.debug("Operating system name: " + System.getProperty("os.name"));
  +                LOG.debug("Operating system architecture: " + System.getProperty("os.arch"));
  +                LOG.debug("Operating system version: " + System.getProperty("os.version"));
   
  -            Provider[] providers = Security.getProviders();
  -            for (int i = 0; i < providers.length; i++) {
  -                Provider provider = providers[i];
  -                LOG.debug(provider.getName() + " " + provider.getVersion()
  -                   + ": " + provider.getInfo());   
  +                Provider[] providers = Security.getProviders();
  +                for (int i = 0; i < providers.length; i++) {
  +                    Provider provider = providers[i];
  +                    LOG.debug(provider.getName() + " " + provider.getVersion()
  +                       + ": " + provider.getInfo());   
  +                }
  +            } catch(SecurityException ignore) {
               }
  -
           }
       }
       // ----------------------------------------------------------- Constructors
  
  
  
  1.159.2.12 +12 -7     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
  
  Index: HttpMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
  retrieving revision 1.159.2.11
  retrieving revision 1.159.2.12
  diff -u -r1.159.2.11 -r1.159.2.12
  --- HttpMethodBase.java	8 Oct 2003 23:29:55 -0000	1.159.2.11
  +++ HttpMethodBase.java	11 Oct 2003 19:44:27 -0000	1.159.2.12
  @@ -153,9 +153,14 @@
       protected static final Header USER_AGENT;
   
       static {
  -        String agent = System.getProperties()
  -                             .getProperty("httpclient.useragent",
  -                                          "Jakarta Commons-HttpClient/2.0rc1");
  +        String agent = null;
  +        try {
  +            agent = System.getProperty("httpclient.useragent");
  +        } catch (SecurityException ignore) {
  +        }
  +        if (agent == null) {
  +            agent = "Jakarta Commons-HttpClient/2.0rc1";
  +        }
           USER_AGENT = new Header("User-Agent", agent);
       }
   
  
  
  
  1.22.2.2  +12 -8     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpState.java
  
  Index: HttpState.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpState.java,v
  retrieving revision 1.22.2.1
  retrieving revision 1.22.2.2
  diff -u -r1.22.2.1 -r1.22.2.2
  --- HttpState.java	16 Sep 2003 21:30:35 -0000	1.22.2.1
  +++ HttpState.java	11 Oct 2003 19:44:27 -0000	1.22.2.2
  @@ -164,10 +164,14 @@
           this.cookiePolicy = CookiePolicy.getDefaultPolicy();
   
           // check the preemptive policy
  -        // TODO: this needs to be a service from some configuration class
  -        String preemptiveDefault =
  -            System.getProperties().getProperty(PREEMPTIVE_PROPERTY,
  -                    PREEMPTIVE_DEFAULT);
  +        String preemptiveDefault = null;
  +        try {
  +            preemptiveDefault = System.getProperty(PREEMPTIVE_PROPERTY); 
  +        } catch (SecurityException ignore) {
  +        }
  +        if (preemptiveDefault == null) {
  +            preemptiveDefault = PREEMPTIVE_DEFAULT; 
  +        }
           preemptiveDefault = preemptiveDefault.trim().toLowerCase();
   
           if (!(preemptiveDefault.equals("true")
  
  
  
  1.36.2.4  +8 -5      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URI.java
  
  Index: URI.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URI.java,v
  retrieving revision 1.36.2.3
  retrieving revision 1.36.2.4
  diff -u -r1.36.2.3 -r1.36.2.4
  --- URI.java	23 Sep 2003 13:04:14 -0000	1.36.2.3
  +++ URI.java	11 Oct 2003 19:44:27 -0000	1.36.2.4
  @@ -618,7 +618,10 @@
               defaultDocumentCharset = defaultDocumentCharsetByLocale;
           }
           // in order to support platform encoding
  -        defaultDocumentCharsetByPlatform = System.getProperty("file.encoding");
  +        try {
  +            defaultDocumentCharsetByPlatform = System.getProperty("file.encoding");
  +        } catch(SecurityException ignore) {
  +        }
           if (defaultDocumentCharset == null) {
               // set the default document charset
               defaultDocumentCharset = defaultDocumentCharsetByPlatform;
  
  
  
  No                   revision
  No                   revision
  1.7.2.1   +8 -5      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/CookiePolicy.java
  
  Index: CookiePolicy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/CookiePolicy.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- CookiePolicy.java	1 Feb 2003 23:35:43 -0000	1.7
  +++ CookiePolicy.java	11 Oct 2003 19:44:27 -0000	1.7.2.1
  @@ -112,8 +112,11 @@
       protected static final Log LOG = LogFactory.getLog(CookiePolicy.class);
   
       static {
  -        String s = System.getProperty(SYSTEM_PROPERTY);
  -
  +        String s = null;
  +        try {
  +            s = System.getProperty(SYSTEM_PROPERTY);
  +        } catch (SecurityException e) {
  +        }
           if ("COMPATIBILITY".equalsIgnoreCase(s)) {
               setDefaultPolicy(COMPATIBILITY);
           } else if ("NETSCAPE_DRAFT".equalsIgnoreCase(s)) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org