You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by re...@apache.org on 2010/06/30 03:40:58 UTC
svn commit: r959160 -
/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLDecoder.java
Author: regisxu
Date: Wed Jun 30 01:40:57 2010
New Revision: 959160
URL: http://svn.apache.org/viewvc?rev=959160&view=rev
Log:
read system property code should be done in privileged block.
Modified:
harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLDecoder.java
Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLDecoder.java?rev=959160&r1=959159&r2=959160&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLDecoder.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLDecoder.java Wed Jun 30 01:40:57 2010
@@ -23,8 +23,10 @@ import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
+import java.security.AccessController;
import org.apache.harmony.luni.internal.nls.Messages;
+import org.apache.harmony.luni.util.PriviAction;
/**
* This class is used to decode a string which is encoded in the {@code
@@ -53,8 +55,11 @@ public class URLDecoder {
if (defaultCharset == null) {
try {
- defaultCharset = Charset.forName(
- System.getProperty("file.encoding")); //$NON-NLS-1$
+ String encoding = AccessController
+ .doPrivileged(new PriviAction<String>("file.encoding")); //$NON-NLS-1$
+ if (encoding != null) {
+ defaultCharset = Charset.forName(encoding);
+ }
} catch (IllegalCharsetNameException e) {
// Ignored
} catch (UnsupportedCharsetException e) {