olegk 2003/10/11 12:46:51 Modified: httpclient/src/java/org/apache/commons/httpclient HttpClient.java URI.java httpclient/src/java/org/apache/commons/httpclient/cookie CookiePolicy.java httpclient/src/java/org/apache/commons/httpclient/params DefaultHttpParamsFactory.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 1.86 +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.85 retrieving revision 1.86 diff -u -r1.85 -r1.86 --- HttpClient.java 3 Oct 2003 20:57:35 -0000 1.85 +++ HttpClient.java 11 Oct 2003 19:46:51 -0000 1.86 @@ -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.42 +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.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- URI.java 23 Sep 2003 13:08:42 -0000 1.41 +++ URI.java 11 Oct 2003 19:46:51 -0000 1.42 @@ -666,7 +666,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; 1.8 +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.8 diff -u -r1.7 -r1.8 --- CookiePolicy.java 1 Feb 2003 23:35:43 -0000 1.7 +++ CookiePolicy.java 11 Oct 2003 19:46:51 -0000 1.8 @@ -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 ignore) { + } if ("COMPATIBILITY".equalsIgnoreCase(s)) { setDefaultPolicy(COMPATIBILITY); } else if ("NETSCAPE_DRAFT".equalsIgnoreCase(s)) { 1.3 +13 -6 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/DefaultHttpParamsFactory.java Index: DefaultHttpParamsFactory.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/DefaultHttpParamsFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DefaultHttpParamsFactory.java 17 Sep 2003 23:29:05 -0000 1.2 +++ DefaultHttpParamsFactory.java 11 Oct 2003 19:46:51 -0000 1.3 @@ -125,14 +125,21 @@ params.setParameter(DateParser.KEY_DATE_PATTERNS, datePatterns); // TODO: To be removed. Provided for backward compatibility - String agent = System.getProperties().getProperty("httpclient.useragent"); + String agent = null; + try { + agent = System.getProperty("httpclient.useragent"); + } catch (SecurityException ignore) { + } if (agent != null) { params.setParameter(HttpMethodParams.USER_AGENT, agent); } // TODO: To be removed. Provided for backward compatibility - String preemptiveDefault = System.getProperties() - .getProperty("httpclient.authentication.preemptive"); + String preemptiveDefault = null; + try { + preemptiveDefault = System.getProperty("httpclient.authentication.preemptive"); + } catch (SecurityException ignore) { + } if (preemptiveDefault != null) { preemptiveDefault = preemptiveDefault.trim().toLowerCase(); if (preemptiveDefault.equals("true")) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]