diff --git a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Codecs.java b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Codecs.java
index 150777663..f4a52a810 100644
--- a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Codecs.java
+++ b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Codecs.java
@@ -32,8 +32,6 @@
package org.exoplatform.common.http.client;
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
-
import java.io.BufferedReader;
import java.io.EOFException;
import java.io.File;
@@ -285,7 +283,7 @@ public final static char[] uuencode(byte[] data)
int line_len = 45; // line length, in octets
int sidx, didx;
- char nl[] = PrivilegedSystemHelper.getProperty("line.separator", "\n").toCharArray(), dest[] =
+ char nl[] = System.getProperty("line.separator", "\n").toCharArray(), dest[] =
new char[(data.length + 2) / 3 * 4 + ((data.length + line_len - 1) / line_len) * (nl.length + 1)];
// split into lines, adding line-length and line terminator
@@ -416,7 +414,7 @@ public final static String quotedPrintableEncode(String str)
return null;
char map[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}, nl[] =
- PrivilegedSystemHelper.getProperty("line.separator", "\n").toCharArray(), res[] =
+ System.getProperty("line.separator", "\n").toCharArray(), res[] =
new char[(int)(str.length() * 1.5)], src[] =
str.toCharArray();
char ch;
@@ -501,7 +499,7 @@ public final static String quotedPrintableDecode(String str) throws ParseExcepti
return null;
char res[] = new char[(int)(str.length() * 1.1)], src[] = str.toCharArray(), nl[] =
- PrivilegedSystemHelper.getProperty("line.separator", "\n").toCharArray();
+ System.getProperty("line.separator", "\n").toCharArray();
int last = 0, didx = 0, slen = str.length();
for (int sidx = 0; sidx < slen;)
diff --git a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java
index 05a220d35..85091471b 100644
--- a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java
+++ b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/CookieModule.java
@@ -32,7 +32,6 @@
package org.exoplatform.common.http.client;
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -213,7 +212,7 @@ private static String getCookieJarName()
try
{
- file = PrivilegedSystemHelper.getProperty("HTTPClient.cookies.jar");
+ file = System.getProperty("HTTPClient.cookies.jar");
}
catch (Exception e)
{
@@ -227,19 +226,19 @@ private static String getCookieJarName()
{
// default to something reasonable
- String os = PrivilegedSystemHelper.getProperty("os.name");
+ String os = System.getProperty("os.name");
if (os.equalsIgnoreCase("Windows 95") || os.equalsIgnoreCase("16-bit Windows")
|| os.equalsIgnoreCase("Windows"))
{
- file = PrivilegedSystemHelper.getProperty("java.home") + File.separator + ".httpclient_cookies";
+ file = System.getProperty("java.home") + File.separator + ".httpclient_cookies";
}
else if (os.equalsIgnoreCase("Windows NT"))
{
- file = PrivilegedSystemHelper.getProperty("user.home") + File.separator + ".httpclient_cookies";
+ file = System.getProperty("user.home") + File.separator + ".httpclient_cookies";
}
else if (os.equalsIgnoreCase("OS/2"))
{
- file = PrivilegedSystemHelper.getProperty("user.home") + File.separator + ".httpclient_cookies";
+ file = System.getProperty("user.home") + File.separator + ".httpclient_cookies";
}
else if (os.equalsIgnoreCase("Mac OS") || os.equalsIgnoreCase("MacOS"))
{
@@ -248,7 +247,7 @@ else if (os.equalsIgnoreCase("Mac OS") || os.equalsIgnoreCase("MacOS"))
else
// it's probably U*IX or VMS
{
- file = PrivilegedSystemHelper.getProperty("user.home") + File.separator + ".httpclient_cookies";
+ file = System.getProperty("user.home") + File.separator + ".httpclient_cookies";
}
}
@@ -671,7 +670,7 @@ class DefaultCookiePolicyHandler implements CookiePolicyHandler
try
{
- list = PrivilegedSystemHelper.getProperty("HTTPClient.cookies.hosts.accept");
+ list = System.getProperty("HTTPClient.cookies.hosts.accept");
}
catch (Exception e)
{
@@ -683,7 +682,7 @@ class DefaultCookiePolicyHandler implements CookiePolicyHandler
try
{
- list = PrivilegedSystemHelper.getProperty("HTTPClient.cookies.hosts.reject");
+ list = System.getProperty("HTTPClient.cookies.hosts.reject");
}
catch (Exception e)
{
diff --git a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
index 5a3c80a81..ea7236c30 100644
--- a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
+++ b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
@@ -32,7 +32,6 @@
package org.exoplatform.common.http.client;
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -1518,7 +1517,7 @@ synchronized NVPair getInput(String l1, String l2, String l3, String scheme)
// prefill the user field with the username
try
{
- user.setText(PrivilegedSystemHelper.getProperty("user.name", ""));
+ user.setText(System.getProperty("user.name", ""));
user_focus = false;
}
catch (SecurityException se)
@@ -1633,7 +1632,7 @@ public NVPair getUsernamePassword(AuthorizationInfo challenge, boolean forProxy)
*/
private static void echo(boolean on)
{
- String os = PrivilegedSystemHelper.getProperty("os.name");
+ String os = System.getProperty("os.name");
String[] cmd = null;
if (os.equalsIgnoreCase("Windows 95") || os.equalsIgnoreCase("Windows NT"))
@@ -1670,7 +1669,7 @@ else if (os.equalsIgnoreCase("OpenVMS") || os.equalsIgnoreCase("VMS"))
*/
static boolean canUseCLPrompt()
{
- String os = PrivilegedSystemHelper.getProperty("os.name");
+ String os = System.getProperty("os.name");
return (os.indexOf("Linux") >= 0 || os.indexOf("SunOS") >= 0 || os.indexOf("Solaris") >= 0
|| os.indexOf("BSD") >= 0 || os.indexOf("AIX") >= 0 || os.indexOf("HP-UX") >= 0 || os.indexOf("IRIX") >= 0
diff --git a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPConnection.java b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPConnection.java
index f0077c4a9..3fac4c0a3 100644
--- a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPConnection.java
+++ b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPConnection.java
@@ -33,11 +33,9 @@
package org.exoplatform.common.http.client;
import org.exoplatform.commons.utils.ClassLoading;
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import java.applet.Applet;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.FilterOutputStream;
@@ -317,7 +315,7 @@ public class HTTPConnection implements GlobalConstants, HTTPClientModuleConstant
try
// JDK 1.1 naming
{
- String host = PrivilegedSystemHelper.getProperty("http.proxyHost");
+ String host = System.getProperty("http.proxyHost");
if (host == null)
throw new Exception(); // try JDK 1.0.x naming
int port = Integer.getInteger("http.proxyPort", -1).intValue();
@@ -336,7 +334,7 @@ public class HTTPConnection implements GlobalConstants, HTTPClientModuleConstant
{
if (Boolean.getBoolean("proxySet"))
{
- String host = PrivilegedSystemHelper.getProperty("proxyHost");
+ String host = System.getProperty("proxyHost");
int port = Integer.getInteger("proxyPort", -1).intValue();
if (LOG.isDebugEnabled())
@@ -358,10 +356,10 @@ public class HTTPConnection implements GlobalConstants, HTTPClientModuleConstant
*/
try
{
- String hosts = PrivilegedSystemHelper.getProperty("HTTPClient.nonProxyHosts");
+ String hosts = System.getProperty("HTTPClient.nonProxyHosts");
if (hosts == null)
{
- hosts = PrivilegedSystemHelper.getProperty("http.nonProxyHosts");
+ hosts = System.getProperty("http.nonProxyHosts");
}
String[] list = Util.splitProperty(hosts);
@@ -383,7 +381,7 @@ public class HTTPConnection implements GlobalConstants, HTTPClientModuleConstant
*/
try
{
- String host = PrivilegedSystemHelper.getProperty("HTTPClient.socksHost");
+ String host = System.getProperty("HTTPClient.socksHost");
if (host != null && host.length() > 0)
{
int port = Integer.getInteger("HTTPClient.socksPort", -1).intValue();
@@ -432,7 +430,7 @@ public class HTTPConnection implements GlobalConstants, HTTPClientModuleConstant
boolean in_applet = false;
try
{
- modules = PrivilegedSystemHelper.getProperty("HTTPClient.Modules", modules);
+ modules = System.getProperty("HTTPClient.Modules", modules);
}
catch (SecurityException se)
{
@@ -562,8 +560,8 @@ public class HTTPConnection implements GlobalConstants, HTTPClientModuleConstant
*/
try
{
- if (PrivilegedSystemHelper.getProperty("os.name").indexOf("Windows") >= 0
- && PrivilegedSystemHelper.getProperty("java.version").startsWith("1.1"))
+ if (System.getProperty("os.name").indexOf("Windows") >= 0
+ && System.getProperty("java.version").startsWith("1.1"))
{
haveMSLargeWritesBug = true;
}
@@ -611,15 +609,6 @@ public class HTTPConnection implements GlobalConstants, HTTPClientModuleConstant
// Constructors
- /**
- * Constructs a connection to the host from where the applet was loaded. Note
- * that current security policies only let applets connect home.
- * @param applet the current applet
- */
- public HTTPConnection(Applet applet) throws ProtocolNotSuppException
- {
- this(applet.getCodeBase().getProtocol(), applet.getCodeBase().getHost(), applet.getCodeBase().getPort());
- }
/**
* Constructs a connection to the specified host on port 80
diff --git a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java
index a7d5a48ec..47f17d5b0 100644
--- a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java
+++ b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HTTPResponse.java
@@ -32,7 +32,6 @@
package org.exoplatform.common.http.client;
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -662,7 +661,7 @@ public String toString()
}
}
- String nl = PrivilegedSystemHelper.getProperty("line.separator", "\n");
+ String nl = System.getProperty("line.separator", "\n");
StringBuffer str = new StringBuffer(Version);
str.append(' ');
diff --git a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HttpURLConnection.java b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HttpURLConnection.java
index 6adf755a9..07850996d 100644
--- a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HttpURLConnection.java
+++ b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/HttpURLConnection.java
@@ -33,7 +33,6 @@
package org.exoplatform.common.http.client;
import org.exoplatform.commons.utils.ClassLoading;
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -179,7 +178,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection
// Set the User-Agent if the http.agent property is set
try
{
- String agent = PrivilegedSystemHelper.getProperty("http.agent");
+ String agent = System.getProperty("http.agent");
if (agent != null)
setDefaultRequestProperty("User-Agent", agent);
}
@@ -214,7 +213,7 @@ public HttpURLConnection(URL url) throws ProtocolNotSuppException, IOException
// first read proxy properties and set
try
{
- String hosts = PrivilegedSystemHelper.getProperty("http.nonProxyHosts", "");
+ String hosts = System.getProperty("http.nonProxyHosts", "");
if (!hosts.equalsIgnoreCase(non_proxy_hosts))
{
connections.clear();
@@ -238,7 +237,7 @@ public HttpURLConnection(URL url) throws ProtocolNotSuppException, IOException
try
{
- String host = PrivilegedSystemHelper.getProperty("http.proxyHost", "");
+ String host = System.getProperty("http.proxyHost", "");
int port = Integer.getInteger("http.proxyPort", -1).intValue();
if (!host.equalsIgnoreCase(proxy_host) || port != proxy_port)
{
diff --git a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java
index d9a0e9e2f..d02582e87 100644
--- a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java
+++ b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Log.java
@@ -32,7 +32,6 @@
package org.exoplatform.common.http.client;
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.log.ExoLogger;
import java.io.ByteArrayOutputStream;
@@ -106,7 +105,7 @@ public class Log
/** All the facilities - for use in setLogging
(-1) */
public static final int ALL = ~0;
- private static final String NL = PrivilegedSystemHelper.getProperty("line.separator");
+ private static final String NL = System.getProperty("line.separator");
private static final long TZ_OFF;
@@ -125,7 +124,7 @@ public class Log
try
{
- String file = PrivilegedSystemHelper.getProperty("HTTPClient.log.file");
+ String file = System.getProperty("HTTPClient.log.file");
if (file != null)
{
try
diff --git a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java
index 4003fc5f4..fd8dea09a 100644
--- a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java
+++ b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/SocksClient.java
@@ -31,8 +31,6 @@
*/
package org.exoplatform.common.http.client;
-
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -293,7 +291,7 @@ private void v4ProtExchg(InputStream inp, OutputStream out, String host, int por
String user_str;
try
{
- user_str = PrivilegedSystemHelper.getProperty("user.name", "");
+ user_str = System.getProperty("user.name", "");
}
catch (SecurityException se)
{
diff --git a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/URI.java b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/URI.java
index 81bf1142c..30d7e05a6 100644
--- a/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/URI.java
+++ b/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/URI.java
@@ -32,8 +32,6 @@
package org.exoplatform.common.http.client;
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
-
import java.net.MalformedURLException;
import java.net.URL;
import java.util.BitSet;
@@ -1783,7 +1781,7 @@ public static void main(String args[]) throws Exception
System.err.println("*** Tests finished successfuly"); //NOSONAR
}
- private static final String nl = PrivilegedSystemHelper.getProperty("line.separator");
+ private static final String nl = System.getProperty("line.separator");
private static void testParser(URI base, String relURI, String result) throws Exception
{
diff --git a/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonGeneratorImpl.java b/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonGeneratorImpl.java
index 92496e516..a0700c024 100644
--- a/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonGeneratorImpl.java
+++ b/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonGeneratorImpl.java
@@ -16,7 +16,6 @@
*/
package org.exoplatform.ws.frameworks.json.impl;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.ws.frameworks.json.JsonGenerator;
import org.exoplatform.ws.frameworks.json.impl.JsonUtils.Types;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
@@ -34,7 +33,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -386,13 +384,7 @@ private static Set getTransientFields(final Class> clazz)
{
Set set = new HashSet();
- Field[] fields = SecurityHelper.doPrivilegedAction(new PrivilegedAction()
- {
- public Field[] run()
- {
- return clazz.getDeclaredFields();
- }
- });
+ Field[] fields = clazz.getDeclaredFields();
for (Field f : fields)
{
diff --git a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/BaseObjectModel.java b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/BaseObjectModel.java
index 51592a480..fb1c3a90f 100644
--- a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/BaseObjectModel.java
+++ b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/BaseObjectModel.java
@@ -16,14 +16,12 @@
*/
package org.exoplatform.services.rest;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.rest.impl.ConstructorDescriptorImpl;
import org.exoplatform.services.rest.impl.FieldInjectorImpl;
import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -51,13 +49,7 @@ public BaseObjectModel(Class> clazz, ComponentLifecycleScope scope)
this.fields = new ArrayList();
if (scope == ComponentLifecycleScope.PER_REQUEST)
{
- Constructor>[] jConstructors =
- SecurityHelper.doPrivilegedAction(new PrivilegedAction[]>() {
- public Constructor>[] run()
- {
- return BaseObjectModel.this.clazz.getConstructors();
- }
- });
+ Constructor>[] jConstructors = BaseObjectModel.this.clazz.getConstructors();
for (Constructor> constructor : jConstructors)
{
constructors.add(new ConstructorDescriptorImpl(clazz, constructor));
@@ -73,13 +65,7 @@ public Constructor>[] run()
Collections.sort(constructors, ConstructorDescriptorImpl.CONSTRUCTOR_COMPARATOR);
}
// process field
- java.lang.reflect.Field[] jfields =
- SecurityHelper.doPrivilegedAction(new PrivilegedAction() {
- public java.lang.reflect.Field[] run()
- {
- return BaseObjectModel.this.clazz.getDeclaredFields();
- }
- });
+ java.lang.reflect.Field[] jfields = BaseObjectModel.this.clazz.getDeclaredFields();
for (java.lang.reflect.Field jfield : jfields)
{
fields.add(new FieldInjectorImpl(clazz, jfield));
diff --git a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/DependencySupplier.java b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/DependencySupplier.java
index c3d4ba2b6..484ef3091 100644
--- a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/DependencySupplier.java
+++ b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/DependencySupplier.java
@@ -17,7 +17,6 @@
package org.exoplatform.services.rest.impl;
import org.exoplatform.commons.utils.ClassLoading;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.xml.InitParams;
@@ -29,8 +28,6 @@
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.Iterator;
import java.util.List;
@@ -71,18 +68,12 @@ private static Class extends Annotation> findInjectAnnotationClass(InitParams
final ValueParam injectAnnotationParameter = params.getValueParam("inject.annotation.class");
try
{
- injectAnnotationClass = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction()
- {
- public Class run() throws ClassNotFoundException
- {
- return ClassLoading.loadClass(injectAnnotationParameter.getValue(), DependencySupplier.class);
- }
- });
+ injectAnnotationClass =
+ (Class extends Annotation>) ClassLoading.loadClass(injectAnnotationParameter.getValue(), DependencySupplier.class);
}
- catch (PrivilegedActionException pe)
+ catch (ClassNotFoundException e)
{
- ClassNotFoundException c = (ClassNotFoundException)pe.getCause();
- throw new RuntimeException(c.getMessage(), c);
+ throw new RuntimeException(e.getMessage(), e);
}
}
if (injectAnnotationClass == null)
@@ -180,19 +171,12 @@ private Type resolveInjectedType(final Class> providerClass)
Type injectedType = null;
try
{
- get = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction()
- {
- public Method run() throws NoSuchMethodException
- {
- return providerClass.getMethod("get");
- }
- });
+ get = providerClass.getMethod("get");
}
- catch (PrivilegedActionException pe)
+ catch (NoSuchMethodException e)
{
- NoSuchMethodException c = (NoSuchMethodException)pe.getCause();
// Should never happen since class implements javax.inject.Provider.
- throw new RuntimeException(c.getMessage(), c);
+ throw new RuntimeException(e.getMessage(), e);
}
if (get != null)
diff --git a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
index dcbc48594..2725eb57e 100644
--- a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
+++ b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
@@ -16,7 +16,6 @@
*/
package org.exoplatform.services.rest.impl;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.rest.ApplicationContext;
@@ -31,9 +30,6 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.List;
import javax.ws.rs.DefaultValue;
@@ -142,16 +138,11 @@ private static Method getSetter(final Class> clazz, final java.lang.reflect.Fi
Method setter = null;
try
{
- setter = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction() {
- public Method run() throws NoSuchMethodException
- {
- String name = jfield.getName();
- String setterName = "set" + Character.toUpperCase(name.charAt(0)) + name.substring(1);
- return clazz.getMethod(setterName, jfield.getType());
- }
- });
+ String name = jfield.getName();
+ String setterName = "set" + Character.toUpperCase(name.charAt(0)) + name.substring(1);
+ setter = clazz.getMethod(setterName, jfield.getType());
}
- catch (PrivilegedActionException e)
+ catch (NoSuchMethodException e)
{
if (LOG.isTraceEnabled())
{
@@ -235,13 +226,7 @@ public void inject(Object resource, ApplicationContext context)
{
if (!Modifier.isPublic(jfield.getModifiers()))
{
- SecurityHelper.doPrivilegedAction(new PrivilegedAction() {
- public Void run()
- {
- jfield.setAccessible(true);
- return null;
- }
- });
+ jfield.setAccessible(true);
}
jfield.set(resource, pr.resolve(this, context));
}
@@ -271,13 +256,7 @@ public Void run()
{
if (!Modifier.isPublic(jfield.getModifiers()))
{
- SecurityHelper.doPrivilegedAction(new PrivilegedAction() {
- public Void run()
- {
- jfield.setAccessible(true);
- return null;
- }
- });
+ jfield.setAccessible(true);
}
jfield.set(resource, tmp);
}
diff --git a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RequestHandlerImpl.java b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RequestHandlerImpl.java
index 3b12aaa11..5b7830f65 100644
--- a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RequestHandlerImpl.java
+++ b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RequestHandlerImpl.java
@@ -16,8 +16,6 @@
*/
package org.exoplatform.services.rest.impl;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.ValueParam;
@@ -199,7 +197,7 @@ public void handleRequest(GenericContainerRequest request, GenericContainerRespo
else
{
LOG.error("Internal error occurs.", cause);
- throw new UnhandledException(e.getCause());
+ throw new UnhandledException(cause.getCause());
}
}
@@ -282,16 +280,16 @@ public void stop()
{
String tmpDirName = properties.get(WS_RS_TMP_DIR);
File tmpDir = new File(tmpDirName);
- if (!PrivilegedFileHelper.exists(tmpDir))
+ if (!tmpDir.exists())
{
return;
}
- File[] files = PrivilegedFileHelper.listFiles(tmpDir);
+ File[] files = tmpDir.listFiles();
for (File file : files)
{
- if (PrivilegedFileHelper.exists(file))
+ if (file.exists())
{
- PrivilegedFileHelper.delete(file);
+ file.delete();
}
}
}
@@ -308,7 +306,7 @@ public void init()
String tmpDirName = properties.get(WS_RS_TMP_DIR);
if (tmpDirName == null)
{
- tmpDir = new File(PrivilegedSystemHelper.getProperty("java.io.tmpdir") + File.separator + "ws_jaxrs");
+ tmpDir = new File(System.getProperty("java.io.tmpdir") + File.separator + "ws_jaxrs");
properties.put(WS_RS_TMP_DIR, tmpDir.getPath());
}
else
@@ -316,9 +314,9 @@ public void init()
tmpDir = new File(tmpDirName);
}
- if (!PrivilegedFileHelper.exists(tmpDir))
+ if (!tmpDir.exists())
{
- PrivilegedFileHelper.mkdirs(tmpDir);
+ tmpDir.mkdirs();
}
}
diff --git a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ResourceBinder.java b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ResourceBinder.java
index 23b36cda3..18705c68a 100644
--- a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ResourceBinder.java
+++ b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ResourceBinder.java
@@ -16,7 +16,6 @@
*/
package org.exoplatform.services.rest.impl;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.services.log.ExoLogger;
@@ -35,7 +34,6 @@
import org.exoplatform.services.rest.uri.UriPattern;
import org.picocontainer.Startable;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -204,14 +202,7 @@ public ResourceBinder(ExoContainerContext containerContext, MethodInvokerFactory
this.invokerFactory = invokerFactory;
// Initialize RuntimeDelegate instance
// This is first component in life cycle what needs.
- SecurityHelper.doPrivilegedAction(new PrivilegedAction()
- {
- public Void run()
- {
- RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
- return null;
- }
- });
+ RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
rd = RuntimeDelegate.getInstance();
container = containerContext.getContainer();
diff --git a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/method/DefaultMethodInvoker.java b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/method/DefaultMethodInvoker.java
index cd067473b..e9fb85ff1 100644
--- a/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/method/DefaultMethodInvoker.java
+++ b/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/method/DefaultMethodInvoker.java
@@ -16,7 +16,6 @@
*/
package org.exoplatform.services.rest.impl.method;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.rest.ApplicationContext;
@@ -30,8 +29,6 @@
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.List;
import javax.ws.rs.MatrixParam;
@@ -185,17 +182,10 @@ protected Object invokeMethod(final Object resource, final GenericMethodResource
{
try
{
- return SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction