mirror of https://github.com/apache/openjpa.git
Code cleanup: remove some unnescessary casts
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@707937 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f01e6bd0d4
commit
e1bd3c4dcb
|
@ -178,14 +178,14 @@ public class MappingToolTask
|
|||
if (MappingTool.ACTION_IMPORT.equals(flags.action))
|
||||
assertFiles(files);
|
||||
|
||||
ClassLoader toolLoader = (ClassLoader) AccessController
|
||||
ClassLoader toolLoader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper
|
||||
.getClassLoaderAction(MappingTool.class));
|
||||
ClassLoader loader = toolLoader;
|
||||
MultiLoaderClassResolver resolver = new MultiLoaderClassResolver();
|
||||
|
||||
if (tmpClassLoader) {
|
||||
loader = (ClassLoader) AccessController.doPrivileged(J2DoPrivHelper
|
||||
loader = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.newTemporaryClassLoaderAction(getClassLoader()));
|
||||
resolver.addClassLoader(loader);
|
||||
}
|
||||
|
|
|
@ -262,11 +262,11 @@ public class ReverseMappingToolTask
|
|||
// load customizer properties
|
||||
Properties customProps = new Properties();
|
||||
File propsFile = Files.getFile(customizerProperties, loader);
|
||||
if (propsFile != null && ((Boolean) AccessController.doPrivileged(
|
||||
if (propsFile != null && (AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(propsFile))).booleanValue()) {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
fis = (FileInputStream) AccessController.doPrivileged(
|
||||
fis = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newFileInputStreamAction(propsFile));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw (FileNotFoundException) pae.getException();
|
||||
|
@ -278,7 +278,7 @@ public class ReverseMappingToolTask
|
|||
JDBCConfiguration conf = (JDBCConfiguration) getConfiguration();
|
||||
flags.customizer = (ReverseCustomizer) Configurations.
|
||||
newInstance(customizerClass, conf, null,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(
|
||||
ReverseCustomizer.class)));
|
||||
if (flags.customizer != null)
|
||||
|
|
|
@ -48,7 +48,7 @@ public class MappingRepositoryValue
|
|||
// we need to manually perform the instantiation
|
||||
try {
|
||||
Class cls = Strings.toClass(clsName,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(type)));
|
||||
return cls.getConstructor(new Class[]{ JDBCConfiguration.class }).
|
||||
newInstance(new Object[]{ conf });
|
||||
|
|
|
@ -467,7 +467,7 @@ public class MappingRepository
|
|||
try {
|
||||
if (strat == null)
|
||||
strat = JavaTypes.classForName(name, cls,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(
|
||||
ClassStrategy.class)));
|
||||
ClassStrategy strategy =
|
||||
|
@ -501,7 +501,7 @@ public class MappingRepository
|
|||
name = Configurations.getClassName(name);
|
||||
try {
|
||||
Class c = JavaTypes.classForName(name, field,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(FieldStrategy.class)));
|
||||
if (FieldStrategy.class.isAssignableFrom(c)) {
|
||||
FieldStrategy strat = (FieldStrategy)
|
||||
|
@ -574,7 +574,7 @@ public class MappingRepository
|
|||
if (strat == null)
|
||||
strat = JavaTypes.classForName(name,
|
||||
discrim.getClassMapping(),
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(
|
||||
DiscriminatorStrategy.class)));
|
||||
DiscriminatorStrategy strategy = (DiscriminatorStrategy)
|
||||
|
@ -640,7 +640,7 @@ public class MappingRepository
|
|||
if (strat == null)
|
||||
strat = JavaTypes.classForName(name,
|
||||
version.getClassMapping(),
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(
|
||||
VersionStrategy.class)));
|
||||
} catch (Exception e) {
|
||||
|
@ -982,7 +982,7 @@ public class MappingRepository
|
|||
name = Configurations.getClassName(name);
|
||||
try {
|
||||
Class c = JavaTypes.classForName(name, val,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(FieldStrategy.class)));
|
||||
Object o = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newInstanceAction(c));
|
||||
|
@ -1009,7 +1009,7 @@ public class MappingRepository
|
|||
name = Configurations.getClassName(name);
|
||||
try {
|
||||
Class c = JavaTypes.classForName(name, val,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(ValueHandler.class)));
|
||||
if (ValueHandler.class.isAssignableFrom(c)) {
|
||||
ValueHandler vh = (ValueHandler) AccessController.doPrivileged(
|
||||
|
|
|
@ -179,7 +179,7 @@ public class ReverseMappingTool
|
|||
private final Log _log;
|
||||
private final Map _tables = new HashMap();
|
||||
private final Project _project = new Project();
|
||||
private final BCClassLoader _loader = (BCClassLoader) AccessController
|
||||
private final BCClassLoader _loader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(_project));
|
||||
private StrategyInstaller _strat = null;
|
||||
private String _package = null;
|
||||
|
@ -1899,11 +1899,11 @@ public class ReverseMappingTool
|
|||
File customFile = Files.getFile
|
||||
(opts.removeProperty("customizerProperties", "cp", null), null);
|
||||
Properties customProps = new Properties();
|
||||
if (customFile != null && ((Boolean) AccessController.doPrivileged(
|
||||
if (customFile != null && (AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(customFile))).booleanValue()) {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
fis = (FileInputStream) AccessController.doPrivileged(
|
||||
fis = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newFileInputStreamAction(customFile));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw (FileNotFoundException) pae.getException();
|
||||
|
|
|
@ -114,7 +114,7 @@ public class DataSourceFactory {
|
|||
// see if their driver name is actually a data source
|
||||
if (DataSource.class.isAssignableFrom(driverClass)) {
|
||||
return (DataSource) Configurations.newInstance(driver,
|
||||
conf, props, (ClassLoader) AccessController.doPrivileged(
|
||||
conf, props, AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(
|
||||
DataSource.class)));
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class FileSchemaFactory
|
|||
}
|
||||
|
||||
public SchemaGroup readSchema() {
|
||||
URL url = (URL) AccessController.doPrivileged(
|
||||
URL url = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourceAction(_loader, _fileName));
|
||||
if (url == null)
|
||||
return new SchemaGroup();
|
||||
|
|
|
@ -117,7 +117,7 @@ public class DBDictionaryFactory {
|
|||
DBDictionary dict = null;
|
||||
try {
|
||||
Class c = Class.forName(dclass, true,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(
|
||||
DBDictionary.class)));
|
||||
dict = (DBDictionary) AccessController.doPrivileged(
|
||||
|
|
|
@ -133,10 +133,10 @@ public class AbstractStoreBrokerFactory
|
|||
|
||||
private static AbstractStoreManager createStoreManager(String cls,
|
||||
String props) {
|
||||
AbstractStoreManager store = (AbstractStoreManager) Configurations.
|
||||
newInstance(cls, (ClassLoader) AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(
|
||||
AbstractStoreManager.class)));
|
||||
AbstractStoreManager store =
|
||||
(AbstractStoreManager) Configurations.newInstance(cls,
|
||||
AccessController.doPrivileged(J2DoPrivHelper
|
||||
.getClassLoaderAction(AbstractStoreManager.class)));
|
||||
Configurations.configureInstance(store, null, props,
|
||||
PROP_ABSTRACT_STORE);
|
||||
if (store == null)
|
||||
|
|
|
@ -111,10 +111,9 @@ public class OpenJPAVersion {
|
|||
appendProperty("java.vendor", buf).append("\n\n");
|
||||
|
||||
buf.append("java.class.path:\n");
|
||||
StringTokenizer tok = new StringTokenizer
|
||||
((String) AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getPropertyAction("java.class.path")),
|
||||
File.pathSeparator);
|
||||
StringTokenizer tok =
|
||||
new StringTokenizer(AccessController.doPrivileged(J2DoPrivHelper
|
||||
.getPropertyAction("java.class.path")), File.pathSeparator);
|
||||
while (tok.hasMoreTokens()) {
|
||||
buf.append("\t").append(tok.nextToken());
|
||||
buf.append("\n");
|
||||
|
@ -136,8 +135,8 @@ public class OpenJPAVersion {
|
|||
}
|
||||
|
||||
private StringBuffer appendProperty(String prop, StringBuffer buf) {
|
||||
return buf.append(prop).append(": ")
|
||||
.append((String) AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getPropertyAction(prop)));
|
||||
return buf.append(prop).append(": ").append(
|
||||
AccessController.doPrivileged(J2DoPrivHelper
|
||||
.getPropertyAction(prop)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,10 +78,11 @@ public abstract class AbstractQueryCache
|
|||
entityTimestampMap = new ConcurrentHashMap<String,Long>();
|
||||
|
||||
// Get all persistence types to pre-load the entityTimestamp Map
|
||||
Collection perTypes = conf.getMetaDataRepositoryInstance().
|
||||
getPersistentTypeNames(false,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction()));
|
||||
Collection perTypes =
|
||||
conf.getMetaDataRepositoryInstance().getPersistentTypeNames(
|
||||
false,
|
||||
AccessController.doPrivileged(J2DoPrivHelper
|
||||
.getContextClassLoaderAction()));
|
||||
|
||||
// Pre-load all the entity types into the HashMap to handle
|
||||
// synchronization on the map efficiently
|
||||
|
|
|
@ -99,9 +99,10 @@ public class DataCacheScheduler
|
|||
_caches.put(cache, schedule);
|
||||
_stop = false;
|
||||
if (_thread == null) {
|
||||
_thread = (Thread) AccessController.doPrivileged(J2DoPrivHelper
|
||||
.newDaemonThreadAction(this, _loc.get("scheduler-name")
|
||||
.getMessage()));
|
||||
_thread =
|
||||
AccessController.doPrivileged(J2DoPrivHelper
|
||||
.newDaemonThreadAction(this, _loc.get("scheduler-name")
|
||||
.getMessage()));
|
||||
_thread.start();
|
||||
if (_log.isTraceEnabled())
|
||||
_log.trace(_loc.get("scheduler-start", _thread.getName()));
|
||||
|
|
|
@ -1370,7 +1370,7 @@ public class ApplicationIdTool {
|
|||
ApplicationIdTool tool;
|
||||
Class cls;
|
||||
ClassMetaData meta;
|
||||
BCClassLoader bc = (BCClassLoader) AccessController
|
||||
BCClassLoader bc = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(new Project()));
|
||||
for (Iterator itr = classes.iterator(); itr.hasNext();) {
|
||||
cls = (Class) itr.next();
|
||||
|
@ -1424,10 +1424,10 @@ public class ApplicationIdTool {
|
|||
name = Strings.getPackageName(context) + "." + name;
|
||||
|
||||
// first try with regular class loader
|
||||
ClassLoader loader = (ClassLoader) AccessController.doPrivileged(
|
||||
ClassLoader loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(context));
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
try {
|
||||
return Class.forName(name, false, loader);
|
||||
|
|
|
@ -96,9 +96,9 @@ public class DynamicStorageGenerator {
|
|||
|
||||
// the project/classloader for the classes.
|
||||
private final Project _project = new Project();
|
||||
private final BCClassLoader _loader = (BCClassLoader) AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(_project,
|
||||
(ClassLoader) AccessController.doPrivileged(J2DoPrivHelper
|
||||
private final BCClassLoader _loader =
|
||||
AccessController.doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(
|
||||
_project, AccessController.doPrivileged(J2DoPrivHelper
|
||||
.getClassLoaderAction(DynamicStorage.class))));
|
||||
|
||||
/**
|
||||
|
|
|
@ -144,7 +144,7 @@ public class PCEnhancer {
|
|||
static {
|
||||
Class[] classes = Services.getImplementorClasses(
|
||||
AuxiliaryEnhancer.class,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(AuxiliaryEnhancer.class)));
|
||||
List auxEnhancers = new ArrayList(classes.length);
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
|
@ -185,7 +185,7 @@ public class PCEnhancer {
|
|||
* repository.
|
||||
*/
|
||||
public PCEnhancer(OpenJPAConfiguration conf, Class type) {
|
||||
this(conf, (BCClass) AccessController.doPrivileged(J2DoPrivHelper
|
||||
this(conf, AccessController.doPrivileged(J2DoPrivHelper
|
||||
.loadProjectClassAction(new Project(), type)),
|
||||
(MetaDataRepository) null);
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ public class PCEnhancer {
|
|||
* and then loading from <code>conf</code>'s repository.
|
||||
*/
|
||||
public PCEnhancer(OpenJPAConfiguration conf, ClassMetaData meta) {
|
||||
this(conf, (BCClass) AccessController.doPrivileged(J2DoPrivHelper
|
||||
this(conf, AccessController.doPrivileged(J2DoPrivHelper
|
||||
.loadProjectClassAction(new Project(), meta.getDescribedType())),
|
||||
meta.getRepository());
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ public class PCEnhancer {
|
|||
* Package-protected and static for testing.
|
||||
*/
|
||||
static BCField getReturnedField(BCMethod meth) {
|
||||
return findField(meth, ((Code) AccessController.doPrivileged(
|
||||
return findField(meth, (AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newCodeAction())).xreturn()
|
||||
.setType(meth.getReturnType()), false);
|
||||
}
|
||||
|
@ -740,7 +740,7 @@ public class PCEnhancer {
|
|||
* Package-protected and static for testing.
|
||||
*/
|
||||
static BCField getAssignedField(BCMethod meth) {
|
||||
return findField(meth, ((Code) AccessController.doPrivileged(
|
||||
return findField(meth, (AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newCodeAction())).putfield(), true);
|
||||
}
|
||||
|
||||
|
@ -791,7 +791,7 @@ public class PCEnhancer {
|
|||
// field that's being accessed
|
||||
if (!findAccessed && prevIns instanceof GetFieldInstruction) {
|
||||
final FieldInstruction fPrevIns = (FieldInstruction) prevIns;
|
||||
cur = (BCField) AccessController.doPrivileged(
|
||||
cur = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getFieldInstructionFieldAction(fPrevIns));
|
||||
// if the middle instruction was an xload_1, then the
|
||||
// matched instruction is the field that's being set.
|
||||
|
@ -799,7 +799,7 @@ public class PCEnhancer {
|
|||
&& ((LoadInstruction) prevIns).getParam() == 0) {
|
||||
final FieldInstruction fTemplateIns =
|
||||
(FieldInstruction) templateIns;
|
||||
cur = (BCField) AccessController.doPrivileged(J2DoPrivHelper
|
||||
cur = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.getFieldInstructionFieldAction(fTemplateIns));
|
||||
} else
|
||||
return null;
|
||||
|
@ -856,7 +856,7 @@ public class PCEnhancer {
|
|||
*/
|
||||
private void replaceAndValidateFieldAccess() throws NoSuchMethodException {
|
||||
// create template putfield/getfield instructions to search for
|
||||
Code template = (Code) AccessController.doPrivileged(
|
||||
Code template = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newCodeAction());
|
||||
Instruction put = template.putfield();
|
||||
Instruction get = template.getfield();
|
||||
|
@ -958,7 +958,7 @@ public class PCEnhancer {
|
|||
loadManagedInstance(code, false);
|
||||
final FieldInstruction fFi = fi;
|
||||
code.getfield().setField(
|
||||
(BCField) AccessController.doPrivileged(J2DoPrivHelper
|
||||
AccessController.doPrivileged(J2DoPrivHelper
|
||||
.getFieldInstructionFieldAction(fFi)));
|
||||
int val = code.getNextLocalsIndex();
|
||||
code.xstore().setLocal(val).setType(fi.getFieldType());
|
||||
|
@ -1569,55 +1569,55 @@ public class PCEnhancer {
|
|||
try {
|
||||
// pcGetGenericContext
|
||||
translateFromStateManagerMethod(
|
||||
(Method) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
SMTYPE, "get" + CONTEXTNAME, (Class[]) null)), false);
|
||||
|
||||
// pcFetchObjectId
|
||||
translateFromStateManagerMethod(
|
||||
(Method) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
SMTYPE, "fetchObjectId", (Class[]) null)), false);
|
||||
|
||||
// pcIsDeleted
|
||||
translateFromStateManagerMethod(
|
||||
(Method) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
SMTYPE, "isDeleted", (Class[]) null)), false);
|
||||
|
||||
// pcIsDirty
|
||||
translateFromStateManagerMethod(
|
||||
(Method) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
SMTYPE, "isDirty", (Class[]) null)), true);
|
||||
|
||||
// pcIsNew
|
||||
translateFromStateManagerMethod(
|
||||
(Method) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
SMTYPE, "isNew", (Class[]) null)), false);
|
||||
|
||||
// pcIsPersistent
|
||||
translateFromStateManagerMethod(
|
||||
(Method) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
SMTYPE, "isPersistent", (Class[]) null)), false);
|
||||
|
||||
// pcIsTransactional
|
||||
translateFromStateManagerMethod(
|
||||
(Method) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
SMTYPE, "isTransactional", (Class[]) null)), false);
|
||||
|
||||
// pcSerializing
|
||||
translateFromStateManagerMethod(
|
||||
(Method) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
SMTYPE, "serializing", (Class[]) null)), false);
|
||||
|
||||
// pcDirty
|
||||
translateFromStateManagerMethod(
|
||||
(Method) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
SMTYPE, "dirty", new Class[]{ String.class })), false);
|
||||
|
||||
|
@ -2595,7 +2595,7 @@ public class PCEnhancer {
|
|||
Class[] params = (Class[]) plist.toArray(new Class[plist.size()]);
|
||||
|
||||
try {
|
||||
return (Method) AccessController.doPrivileged(
|
||||
return AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(owner, name, params));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw (NoSuchMethodException) pae.getException();
|
||||
|
@ -2956,7 +2956,7 @@ public class PCEnhancer {
|
|||
code.vreturn();
|
||||
}
|
||||
|
||||
Instruction tmplate = ((Code) AccessController.doPrivileged(
|
||||
Instruction tmplate = (AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newCodeAction())).vreturn();
|
||||
JumpInstruction toret;
|
||||
Instruction ret;
|
||||
|
@ -3267,7 +3267,7 @@ public class PCEnhancer {
|
|||
if (clinit != null) {
|
||||
code = clinit.getCode(true);
|
||||
if (replaceLast) {
|
||||
Code template = (Code) AccessController.doPrivileged(
|
||||
Code template = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newCodeAction());
|
||||
code.searchForward(template.vreturn());
|
||||
code.previous();
|
||||
|
@ -3346,7 +3346,7 @@ public class PCEnhancer {
|
|||
}
|
||||
|
||||
// create template super.clone () instruction to match against
|
||||
Instruction template = ((Code) AccessController.doPrivileged(
|
||||
Instruction template = (AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newCodeAction())).invokespecial()
|
||||
.setMethod(superName, "clone", Object.class.getName(), null);
|
||||
|
||||
|
@ -3720,7 +3720,7 @@ public class PCEnhancer {
|
|||
// next, find the field in the managed type hierarchy
|
||||
BCField field = null;
|
||||
outer: for (BCClass bc = _pc; bc != null; bc = bc.getSuperclassBC()) {
|
||||
BCField[] fields = (BCField[]) AccessController
|
||||
BCField[] fields = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.getBCClassFieldsAction(bc,
|
||||
fieldName));
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
|
@ -4451,7 +4451,7 @@ public class PCEnhancer {
|
|||
loader = conf.getClassResolverInstance().
|
||||
getClassLoader(PCEnhancer.class, null);
|
||||
if (flags.tmpClassLoader)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(J2DoPrivHelper
|
||||
loader = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.newTemporaryClassLoaderAction(loader));
|
||||
|
||||
if (repos == null) {
|
||||
|
|
|
@ -106,9 +106,9 @@ public class PCEnhancerAgent {
|
|||
conf.setConnectionDriverName(null);
|
||||
conf.setConnectionFactoryName(null);
|
||||
// set single class resolver
|
||||
final ClassLoader tmpLoader = (ClassLoader) AccessController
|
||||
final ClassLoader tmpLoader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper
|
||||
.newTemporaryClassLoaderAction((ClassLoader) AccessController
|
||||
.newTemporaryClassLoaderAction(AccessController
|
||||
.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction())
|
||||
));
|
||||
conf.setClassResolver(new ClassResolver() {
|
||||
|
|
|
@ -198,7 +198,7 @@ public class Reflection {
|
|||
* @since 0.9.8
|
||||
*/
|
||||
private static Field getDeclaredField(Class cls, String name) {
|
||||
Field[] fields = (Field[]) AccessController.doPrivileged(
|
||||
Field[] fields = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredFieldsAction(cls));
|
||||
for (int i = 0 ; i < fields.length; i++) {
|
||||
if (name.equals(fields[i].getName()))
|
||||
|
|
|
@ -238,7 +238,7 @@ public class TCPRemoteCommitProvider
|
|||
hostname = host;
|
||||
tmpPort = DEFAULT_PORT;
|
||||
}
|
||||
InetAddress tmpAddress = (InetAddress) AccessController
|
||||
InetAddress tmpAddress = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.getByNameAction(hostname));
|
||||
|
||||
// bleair: For each address we would rather make use of
|
||||
|
@ -505,7 +505,7 @@ public class TCPRemoteCommitProvider
|
|||
_port = port;
|
||||
_log = log;
|
||||
try {
|
||||
_receiveSocket = (ServerSocket) AccessController
|
||||
_receiveSocket = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newServerSocketAction(_port));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw (IOException) pae.getException();
|
||||
|
@ -576,7 +576,7 @@ public class TCPRemoteCommitProvider
|
|||
try {
|
||||
s = null;
|
||||
// Block, waiting to accept new connection from a peer
|
||||
s = (Socket) AccessController.doPrivileged(J2DoPrivHelper
|
||||
s = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.acceptAction(_receiveSocket));
|
||||
if (_log.isTraceEnabled()) {
|
||||
_log.trace(s_loc.get("tcp-received-connection",
|
||||
|
@ -770,12 +770,12 @@ public class TCPRemoteCommitProvider
|
|||
int colon = host.indexOf(':');
|
||||
try {
|
||||
if (colon != -1) {
|
||||
_address = (InetAddress) AccessController
|
||||
_address = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.getByNameAction(host
|
||||
.substring(0, colon)));
|
||||
_port = Integer.parseInt(host.substring(colon + 1));
|
||||
} else {
|
||||
_address = (InetAddress) AccessController
|
||||
_address = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.getByNameAction(host));
|
||||
_port = DEFAULT_PORT;
|
||||
}
|
||||
|
@ -905,7 +905,7 @@ public class TCPRemoteCommitProvider
|
|||
public Object makeObject()
|
||||
throws IOException {
|
||||
try {
|
||||
Socket s = (Socket) AccessController
|
||||
Socket s = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newSocketAction(_address,
|
||||
_port));
|
||||
if (log.isTraceEnabled()) {
|
||||
|
|
|
@ -116,7 +116,7 @@ public class Bootstrap {
|
|||
// handle cases where there is a mismatch between loaders by falling
|
||||
// back to the configuration's class loader for broker resolution
|
||||
cls = getFactoryClass(conf,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(conf.getClass())));
|
||||
meth = cls.getMethod(methodName, FACTORY_ARGS);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class Bootstrap {
|
|||
private static Class getFactoryClass(ConfigurationProvider conf,
|
||||
ClassLoader loader) {
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
Object cls = BrokerFactoryValue.get(conf);
|
||||
|
|
|
@ -269,7 +269,7 @@ public class BrokerImpl
|
|||
DelegatingStoreManager sm, boolean managed, int connMode,
|
||||
boolean fromDeserialization) {
|
||||
_initializeWasInvoked = true;
|
||||
_loader = (ClassLoader) AccessController.doPrivileged(
|
||||
_loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
if (!fromDeserialization)
|
||||
_conf = factory.getConfiguration();
|
||||
|
@ -4183,7 +4183,7 @@ public class BrokerImpl
|
|||
if (!PCRegistry.isRegistered(cls)) {
|
||||
try {
|
||||
Class.forName(cls.getName(), true,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(cls)));
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
|
@ -4341,10 +4341,10 @@ public class BrokerImpl
|
|||
if (intfs[i].getName().equals(PersistenceCapable.class.getName())) {
|
||||
throw new UserException(_loc.get("pc-loader-different",
|
||||
Exceptions.toString(obj),
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(
|
||||
PersistenceCapable.class)),
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(intfs[i]))))
|
||||
.setFailedObject(obj);
|
||||
}
|
||||
|
|
|
@ -1569,7 +1569,7 @@ public class QueryImpl
|
|||
|
||||
// first check the aliases map in the MetaDataRepository
|
||||
ClassLoader loader = (_class == null) ? _loader
|
||||
: (ClassLoader) AccessController.doPrivileged(
|
||||
: AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(_class));
|
||||
ClassMetaData meta = _broker.getConfiguration().
|
||||
getMetaDataRepositoryInstance().getMetaData(name, loader, false);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class QueryLanguages {
|
|||
// Load and cache all the query languages available in the system.
|
||||
Class[] classes = Services.getImplementorClasses(
|
||||
ExpressionParser.class,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(ExpressionParser.class)));
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
ExpressionParser ep;
|
||||
|
|
|
@ -98,7 +98,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
File file;
|
||||
for (int i = 0; i < strs.length; i++) {
|
||||
file = new File(strs[i]);
|
||||
if (((Boolean) AccessController.doPrivileged(
|
||||
if ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(file))).booleanValue())
|
||||
this.files.add(file);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
for (int i = 0; i < metas.length; i++) {
|
||||
if (getSourceFile(metas[i]) == null)
|
||||
setSourceFile(metas[i], defaultSourceFile(metas[i]));
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPrivHelper
|
||||
if ((AccessController.doPrivileged(J2DoPrivHelper
|
||||
.existsAction(getSourceFile(metas[i])))).booleanValue()) {
|
||||
if (files == null)
|
||||
files = new HashSet();
|
||||
|
@ -379,7 +379,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
queries[i].setSource(defaultSourceFile(queries[i],
|
||||
clsNames), queries[i].getSourceScope(),
|
||||
queries[i].getSourceType());
|
||||
if (((Boolean) AccessController.doPrivileged(
|
||||
if ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(queries[i].getSourceFile())))
|
||||
.booleanValue()) {
|
||||
if (files == null)
|
||||
|
@ -392,7 +392,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
if (getSourceFile(seqs[i]) == null)
|
||||
setSourceFile(seqs[i], defaultSourceFile(seqs[i],
|
||||
clsNames));
|
||||
if (((Boolean) AccessController.doPrivileged(
|
||||
if ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(getSourceFile(seqs[i]))))
|
||||
.booleanValue()) {
|
||||
if (files == null)
|
||||
|
@ -420,7 +420,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
if (queries[i].getSourceFile() == null)
|
||||
queries[i].setSource(defaultSourceFile(queries[i], clsNames),
|
||||
queries[i].getSourceScope(), queries[i].getSourceType());
|
||||
if (((Boolean) AccessController.doPrivileged(
|
||||
if ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(queries[i].getSourceFile())))
|
||||
.booleanValue()) {
|
||||
if (files == null)
|
||||
|
@ -631,7 +631,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
File file;
|
||||
for (Iterator itr = files.iterator(); itr.hasNext();) {
|
||||
file = (File) itr.next();
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPrivHelper
|
||||
if ((AccessController.doPrivileged(J2DoPrivHelper
|
||||
.isDirectoryAction(file))).booleanValue()) {
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scanning-directory", file));
|
||||
|
@ -641,7 +641,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scanning-jar", file));
|
||||
try {
|
||||
ZipFile zFile = (ZipFile) AccessController
|
||||
ZipFile zFile = AccessController
|
||||
.doPrivileged(J2DoPrivHelper
|
||||
.newZipFileAction(file));
|
||||
scan(new ZipFileMetaDataIterator(zFile,
|
||||
|
@ -657,7 +657,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scan-found-names", clss, file));
|
||||
names.addAll(Arrays.asList(clss));
|
||||
File f = (File) AccessController
|
||||
File f = AccessController
|
||||
.doPrivileged(J2DoPrivHelper
|
||||
.getAbsoluteFileAction(file));
|
||||
try {
|
||||
|
@ -674,12 +674,12 @@ public abstract class AbstractCFMetaDataFactory
|
|||
for (Iterator itr = urls.iterator(); itr.hasNext();) {
|
||||
url = (URL) itr.next();
|
||||
if ("file".equals(url.getProtocol())) {
|
||||
File file = (File) AccessController
|
||||
File file = AccessController
|
||||
.doPrivileged(J2DoPrivHelper
|
||||
.getAbsoluteFileAction(new File(url.getFile())));
|
||||
if (files != null && files.contains(file)) {
|
||||
continue;
|
||||
} else if (((Boolean) AccessController
|
||||
} else if ((AccessController
|
||||
.doPrivileged(J2DoPrivHelper.isDirectoryAction(file)))
|
||||
.booleanValue()) {
|
||||
if (log.isTraceEnabled())
|
||||
|
@ -726,7 +726,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
for (Iterator itr = rsrcs.iterator(); itr.hasNext();) {
|
||||
rsrc = (String) itr.next();
|
||||
if (rsrc.endsWith(".jar")) {
|
||||
url = (URL) AccessController.doPrivileged(
|
||||
url = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourceAction(loader, rsrc));
|
||||
if (url != null) {
|
||||
if (log.isTraceEnabled())
|
||||
|
|
|
@ -198,7 +198,7 @@ public abstract class AbstractMetaDataDefaults
|
|||
FieldMetaData fmd;
|
||||
for (int i = 0; i < fieldNames.length; i ++) {
|
||||
if (meta.getAccessType() == ClassMetaData.ACCESS_FIELD)
|
||||
member = (Field) AccessController.doPrivileged(
|
||||
member = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredFieldAction(
|
||||
cls,fieldNames[i]));
|
||||
else
|
||||
|
@ -362,7 +362,7 @@ public abstract class AbstractMetaDataDefaults
|
|||
//### where the superclass uses a different access type
|
||||
if (fmd.getDefiningMetaData().getAccessType() ==
|
||||
ClassMetaData.ACCESS_FIELD)
|
||||
return (Field) AccessController.doPrivileged(
|
||||
return AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredFieldAction(
|
||||
fmd.getDeclaringType(), fmd.getName()));
|
||||
return Reflection.findGetter(fmd.getDeclaringType(), fmd.getName(),
|
||||
|
|
|
@ -2087,12 +2087,12 @@ public class FieldMetaData
|
|||
String memberName = (String) in.readObject();
|
||||
try {
|
||||
if (isField)
|
||||
_member = (Field) AccessController.doPrivileged(
|
||||
_member = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredFieldAction(
|
||||
cls, memberName));
|
||||
else {
|
||||
Class[] parameterTypes = (Class[]) in.readObject();
|
||||
_member = (Method) AccessController.doPrivileged(
|
||||
_member = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
cls, memberName, parameterTypes));
|
||||
}
|
||||
|
|
|
@ -77,12 +77,12 @@ class InterfaceImplGenerator {
|
|||
if (impl != null)
|
||||
return impl;
|
||||
|
||||
ClassLoader parentLoader = (ClassLoader) AccessController.doPrivileged(
|
||||
ClassLoader parentLoader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(iface));
|
||||
BCClassLoader loader = (BCClassLoader) AccessController
|
||||
BCClassLoader loader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(_project,
|
||||
parentLoader));
|
||||
BCClassLoader enhLoader = (BCClassLoader) AccessController
|
||||
BCClassLoader enhLoader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(_enhProject,
|
||||
parentLoader));
|
||||
BCClass bc = _project.loadClass(getClassName(meta));
|
||||
|
@ -90,9 +90,9 @@ class InterfaceImplGenerator {
|
|||
ClassMetaData sup = meta.getPCSuperclassMetaData();
|
||||
if (sup != null) {
|
||||
bc.setSuperclass(sup.getInterfaceImpl());
|
||||
enhLoader = (BCClassLoader) AccessController
|
||||
enhLoader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(
|
||||
_enhProject, (ClassLoader) AccessController
|
||||
_enhProject, AccessController
|
||||
.doPrivileged(J2DoPrivHelper.getClassLoaderAction(sup
|
||||
.getInterfaceImpl()))));
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ class InterfaceImplGenerator {
|
|||
*/
|
||||
private static Method getMethodSafe(Class iface, String name, Class arg) {
|
||||
try {
|
||||
return (Method) AccessController.doPrivileged(
|
||||
return AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
iface, name, arg == null ? null : new Class[]{arg}));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
|
@ -221,7 +221,7 @@ class InterfaceImplGenerator {
|
|||
if (fmd.getType() != boolean.class && fmd.getType() != Boolean.class)
|
||||
return true;
|
||||
try {
|
||||
Method meth = (Method) AccessController.doPrivileged(
|
||||
Method meth = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(iface, "is" +
|
||||
StringUtils.capitalize(fmd.getName()), (Class[]) null));
|
||||
return meth == null;
|
||||
|
|
|
@ -454,7 +454,7 @@ public class MetaDataRepository
|
|||
if ((_validate & VALIDATE_RUNTIME) != 0) {
|
||||
try {
|
||||
Class.forName(cls.getName(), true,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(cls)));
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
|
@ -1038,7 +1038,7 @@ public class MetaDataRepository
|
|||
if (_log.isTraceEnabled())
|
||||
_log.trace(_loc.get("resolve-identity", oidClass));
|
||||
|
||||
ClassLoader cl = (ClassLoader) AccessController.doPrivileged(
|
||||
ClassLoader cl = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(oidClass));
|
||||
String className;
|
||||
while (oidClass != null && oidClass != Object.class) {
|
||||
|
|
|
@ -255,7 +255,7 @@ public class SequenceMetaData
|
|||
String clsName = plugin.getClassName();
|
||||
|
||||
Class cls = Class.forName(clsName, true,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(Seq.class)));
|
||||
StringBuffer props = new StringBuffer();
|
||||
if (plugin.getProperties() != null)
|
||||
|
|
|
@ -40,15 +40,15 @@ public class ClassResolverImpl
|
|||
// class (the bootstrap loader is the parent of the system loader)
|
||||
ClassLoader contextLoader = null;
|
||||
if (contextClass != null) {
|
||||
contextLoader = (ClassLoader) AccessController.doPrivileged(
|
||||
contextLoader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(contextClass));
|
||||
if (contextLoader == null)
|
||||
contextLoader = (ClassLoader) AccessController.doPrivileged(
|
||||
contextLoader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getSystemClassLoaderAction());
|
||||
}
|
||||
|
||||
// if there is only one unique loader, just return it
|
||||
ClassLoader threadLoader = (ClassLoader) AccessController.doPrivileged(
|
||||
ClassLoader threadLoader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
if ((contextLoader == null || contextLoader == threadLoader)
|
||||
&& (envLoader == null || envLoader == threadLoader))
|
||||
|
@ -56,7 +56,7 @@ public class ClassResolverImpl
|
|||
|
||||
// construct a multi class loader that will delegate in the order
|
||||
// described in section 12.5 of the spec
|
||||
MultiClassLoader loader = (MultiClassLoader) AccessController
|
||||
MultiClassLoader loader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
|
||||
if (contextLoader != null)
|
||||
loader.addClassLoader(contextLoader);
|
||||
|
|
|
@ -39,9 +39,9 @@ public class GeneratedClasses {
|
|||
* classes.
|
||||
*/
|
||||
public static ClassLoader getMostDerivedLoader(Class c1, Class c2) {
|
||||
ClassLoader l1 = (ClassLoader) AccessController.doPrivileged(
|
||||
ClassLoader l1 = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(c1));
|
||||
ClassLoader l2 = (ClassLoader) AccessController.doPrivileged(
|
||||
ClassLoader l2 = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(c2));
|
||||
if (l1 == l2)
|
||||
return l1;
|
||||
|
@ -60,7 +60,7 @@ public class GeneratedClasses {
|
|||
* Load the class represented by the given bytecode.
|
||||
*/
|
||||
public static Class loadBCClass(BCClass bc, ClassLoader loader) {
|
||||
BCClassLoader bcloader = (BCClassLoader) AccessController
|
||||
BCClassLoader bcloader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(bc
|
||||
.getProject(), loader));
|
||||
try {
|
||||
|
|
|
@ -78,7 +78,7 @@ public final class Id
|
|||
*/
|
||||
public Id(String str, ClassLoader loader) {
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
if (str == null)
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.openjpa.lib.util.MultiClassLoader;
|
|||
*/
|
||||
public class MultiLoaderClassResolver implements ClassResolver {
|
||||
|
||||
final private MultiClassLoader _loader = (MultiClassLoader) AccessController
|
||||
final private MultiClassLoader _loader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
|
||||
|
||||
public MultiLoaderClassResolver() {
|
||||
|
|
|
@ -48,10 +48,10 @@ public class Proxies {
|
|||
public static void assertAllowedType(Object value, Class allowed) {
|
||||
if (value != null && allowed != null && !allowed.isInstance(value)) {
|
||||
throw new UserException(_loc.get("bad-elem-type", new Object[]{
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(allowed)),
|
||||
allowed,
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(value.getClass())),
|
||||
value.getClass()
|
||||
}));
|
||||
|
|
|
@ -440,9 +440,10 @@ public class ProxyManagerImpl
|
|||
ProxyBean.class);
|
||||
Class pcls = loadBuildTimeProxy(type, l);
|
||||
if (pcls == null) {
|
||||
BCClass bc = (BCClass) AccessController
|
||||
.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
// TODO Move this to J2DOPrivHelper?
|
||||
BCClass bc = AccessController
|
||||
.doPrivileged(new PrivilegedAction<BCClass>() {
|
||||
public BCClass run() {
|
||||
return generateProxyBeanBytecode(type, true);
|
||||
}
|
||||
});
|
||||
|
@ -513,7 +514,7 @@ public class ProxyManagerImpl
|
|||
boolean runtime) {
|
||||
assertNotFinal(type);
|
||||
Project project = new Project();
|
||||
BCClass bc = (BCClass) AccessController.doPrivileged(J2DoPrivHelper
|
||||
BCClass bc = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.loadProjectClassAction(project, getProxyClassName(type, runtime)));
|
||||
bc.setSuperclass(type);
|
||||
bc.declareInterface(ProxyCollection.class);
|
||||
|
@ -551,7 +552,7 @@ public class ProxyManagerImpl
|
|||
protected BCClass generateProxyMapBytecode(Class type, boolean runtime) {
|
||||
assertNotFinal(type);
|
||||
Project project = new Project();
|
||||
BCClass bc = (BCClass) AccessController.doPrivileged(J2DoPrivHelper
|
||||
BCClass bc = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.loadProjectClassAction(project, getProxyClassName(type, runtime)));
|
||||
bc.setSuperclass(type);
|
||||
bc.declareInterface(ProxyMap.class);
|
||||
|
@ -571,7 +572,7 @@ public class ProxyManagerImpl
|
|||
protected BCClass generateProxyDateBytecode(Class type, boolean runtime) {
|
||||
assertNotFinal(type);
|
||||
Project project = new Project();
|
||||
BCClass bc = (BCClass) AccessController.doPrivileged(J2DoPrivHelper
|
||||
BCClass bc = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.loadProjectClassAction(project, getProxyClassName(type, runtime)));
|
||||
bc.setSuperclass(type);
|
||||
bc.declareInterface(ProxyDate.class);
|
||||
|
@ -591,7 +592,7 @@ public class ProxyManagerImpl
|
|||
boolean runtime) {
|
||||
assertNotFinal(type);
|
||||
Project project = new Project();
|
||||
BCClass bc = (BCClass) AccessController.doPrivileged(J2DoPrivHelper
|
||||
BCClass bc = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.loadProjectClassAction(project, getProxyClassName(type, runtime)));
|
||||
bc.setSuperclass(type);
|
||||
bc.declareInterface(ProxyCalendar.class);
|
||||
|
@ -626,7 +627,7 @@ public class ProxyManagerImpl
|
|||
}
|
||||
|
||||
Project project = new Project();
|
||||
BCClass bc = (BCClass) AccessController.doPrivileged(J2DoPrivHelper
|
||||
BCClass bc = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.loadProjectClassAction(project, getProxyClassName(type, runtime)));
|
||||
bc.setSuperclass(type);
|
||||
bc.declareInterface(ProxyBean.class);
|
||||
|
@ -1585,7 +1586,7 @@ public class ProxyManagerImpl
|
|||
public static void main(String[] args)
|
||||
throws ClassNotFoundException, IOException {
|
||||
File dir = Files.getClassFile(ProxyManagerImpl.class);
|
||||
dir = (dir == null) ? new File((String) AccessController.doPrivileged(
|
||||
dir = (dir == null) ? new File(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getPropertyAction("user.dir")))
|
||||
: dir.getParentFile();
|
||||
|
||||
|
@ -1647,9 +1648,10 @@ public class ProxyManagerImpl
|
|||
bc = mgr.generateProxyCalendarBytecode(cls, false);
|
||||
else {
|
||||
final Class fCls = cls;
|
||||
bc = (BCClass) AccessController
|
||||
.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
// TODO Move this to J2DOPrivHelper
|
||||
bc = AccessController
|
||||
.doPrivileged(new PrivilegedAction<BCClass>() {
|
||||
public BCClass run() {
|
||||
return mgr.generateProxyBeanBytecode(fCls, false);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -129,7 +129,7 @@ public class Serialization {
|
|||
|
||||
protected Class resolveClass(ObjectStreamClass desc)
|
||||
throws IOException, ClassNotFoundException {
|
||||
MultiClassLoader loader = (MultiClassLoader) AccessController
|
||||
MultiClassLoader loader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
|
||||
addContextClassLoaders(loader);
|
||||
loader.addClassLoader(getClass().getClassLoader());
|
||||
|
@ -138,7 +138,7 @@ public class Serialization {
|
|||
}
|
||||
|
||||
protected void addContextClassLoaders(MultiClassLoader loader) {
|
||||
loader.addClassLoader((ClassLoader) AccessController.doPrivileged(
|
||||
loader.addClassLoader(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public abstract class AbstractTask extends MatchingTask {
|
|||
private static final Localizer _loc = Localizer.forPackage
|
||||
(AbstractTask.class);
|
||||
|
||||
protected final List fileSets = new ArrayList();
|
||||
protected final List<FileSet> fileSets = new ArrayList<FileSet>();
|
||||
protected boolean haltOnError = true;
|
||||
protected Path classpath = null;
|
||||
protected boolean useParent = false;
|
||||
|
@ -117,10 +117,10 @@ public abstract class AbstractTask extends MatchingTask {
|
|||
return _cl;
|
||||
|
||||
if (classpath != null)
|
||||
_cl = new AntClassLoader(project, classpath, useParent);
|
||||
_cl = new AntClassLoader(getProject(), classpath, useParent);
|
||||
else
|
||||
_cl = new AntClassLoader(project.getCoreLoader(), project,
|
||||
new Path(project), useParent);
|
||||
_cl = new AntClassLoader(getProject().getCoreLoader(), getProject(),
|
||||
new Path(getProject()), useParent);
|
||||
_cl.setIsolated(isolate);
|
||||
|
||||
return _cl;
|
||||
|
@ -143,7 +143,7 @@ public abstract class AbstractTask extends MatchingTask {
|
|||
|
||||
public Path createClasspath() {
|
||||
if (classpath == null)
|
||||
classpath = new Path(project);
|
||||
classpath = new Path(getProject());
|
||||
return classpath.createPath();
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ public abstract class AbstractTask extends MatchingTask {
|
|||
_conf = newConfiguration();
|
||||
if (_conf.getPropertiesResource() == null) {
|
||||
ConfigurationProvider cp = ProductDerivations.loadDefaults
|
||||
((ClassLoader) AccessController.doPrivileged(
|
||||
(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(_conf.getClass())));
|
||||
if (cp != null)
|
||||
cp.setInto(_conf);
|
||||
|
@ -181,18 +181,17 @@ public abstract class AbstractTask extends MatchingTask {
|
|||
}
|
||||
|
||||
private String[] getFiles() {
|
||||
List files = new ArrayList();
|
||||
for (Iterator i = fileSets.iterator(); i.hasNext();) {
|
||||
FileSet fs = (FileSet) i.next();
|
||||
DirectoryScanner ds = fs.getDirectoryScanner(project);
|
||||
List<String> files = new ArrayList<String>();
|
||||
for(FileSet fs : fileSets) {
|
||||
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
||||
|
||||
String[] dsFiles = ds.getIncludedFiles();
|
||||
for (int j = 0; j < dsFiles.length; j++) {
|
||||
File f = new File(dsFiles[j]);
|
||||
if (!((Boolean) AccessController.doPrivileged(J2DoPrivHelper
|
||||
if (!( AccessController.doPrivileged(J2DoPrivHelper
|
||||
.isFileAction(f))).booleanValue())
|
||||
f = new File(ds.getBasedir(), dsFiles[j]);
|
||||
files.add((String) AccessController.doPrivileged(
|
||||
files.add(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getAbsolutePathAction(f)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,9 +165,9 @@ public class ConfigurationImpl
|
|||
* {@link ProductDerivation}s, and from System properties.
|
||||
*/
|
||||
public boolean loadGlobals() {
|
||||
MultiClassLoader loader = (MultiClassLoader) AccessController
|
||||
MultiClassLoader loader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
|
||||
loader.addClassLoader((ClassLoader) AccessController.doPrivileged(
|
||||
loader.addClassLoader(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction()));
|
||||
loader.addClassLoader(getClass().getClassLoader());
|
||||
ConfigurationProvider provider = ProductDerivations.loadGlobals(loader);
|
||||
|
@ -177,7 +177,7 @@ public class ConfigurationImpl
|
|||
// let system properties override other globals
|
||||
try {
|
||||
fromProperties(new HashMap(
|
||||
(Properties) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getPropertiesAction())));
|
||||
} catch (SecurityException se) {
|
||||
// security manager might disallow
|
||||
|
|
|
@ -245,19 +245,19 @@ public class Configurations {
|
|||
// we always prefer the thread loader, because it's the only thing we
|
||||
// can access that isn't bound to the OpenJPA classloader, unless
|
||||
// the conf object is of a custom class
|
||||
ClassLoader ctxLoader = (ClassLoader) AccessController.doPrivileged(
|
||||
ClassLoader ctxLoader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
if (loader == null) {
|
||||
if (ctxLoader != null)
|
||||
return ctxLoader;
|
||||
if (conf != null)
|
||||
return (ClassLoader) AccessController.doPrivileged(
|
||||
return AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(conf.getClass()));
|
||||
return Configurations.class.getClassLoader();
|
||||
}
|
||||
|
||||
for (ClassLoader parent = ctxLoader; parent != null;
|
||||
parent = (ClassLoader) AccessController.doPrivileged(
|
||||
parent = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getParentAction(parent))) {
|
||||
if (parent == loader)
|
||||
return ctxLoader;
|
||||
|
@ -267,10 +267,10 @@ public class Configurations {
|
|||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(conf.getClass()));
|
||||
parent != null;
|
||||
parent = (ClassLoader) AccessController.doPrivileged(
|
||||
parent = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getParentAction(parent))) {
|
||||
if (parent == loader)
|
||||
return (ClassLoader) AccessController.doPrivileged(
|
||||
return AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(conf.getClass()));
|
||||
}
|
||||
}
|
||||
|
@ -332,12 +332,12 @@ public class Configurations {
|
|||
}
|
||||
|
||||
File file = new File(path);
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPrivHelper
|
||||
if ((AccessController.doPrivileged(J2DoPrivHelper
|
||||
.isFileAction(file))).booleanValue())
|
||||
provider = ProductDerivations.load(file, anchor, null);
|
||||
else {
|
||||
file = new File("META-INF" + File.separatorChar + path);
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPrivHelper
|
||||
if ((AccessController.doPrivileged(J2DoPrivHelper
|
||||
.isFileAction(file))).booleanValue())
|
||||
provider = ProductDerivations.load(file, anchor, null);
|
||||
else
|
||||
|
|
|
@ -60,7 +60,7 @@ public class FileValue extends Value {
|
|||
}
|
||||
|
||||
protected String getInternalString() {
|
||||
return (value == null) ? null : (String) AccessController.doPrivileged(
|
||||
return (value == null) ? null : AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getAbsolutePathAction(value));
|
||||
}
|
||||
|
||||
|
|
|
@ -98,10 +98,10 @@ public class ObjectValue extends Value {
|
|||
boolean fatal) {
|
||||
ClassLoader cl = (ClassLoader) _classloaderCache.get(type);
|
||||
if (cl == null) {
|
||||
cl = (ClassLoader) AccessController.doPrivileged(
|
||||
cl = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(type));
|
||||
if (cl == null) { // System classloader is returned as null
|
||||
cl = (ClassLoader) AccessController.doPrivileged(
|
||||
cl = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getSystemClassLoaderAction());
|
||||
}
|
||||
_classloaderCache.put(type, cl);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ProductDerivations {
|
|||
private static final Throwable[] _derivationErrors;
|
||||
private static String[] _prefixes;
|
||||
static {
|
||||
ClassLoader l = (ClassLoader) AccessController.doPrivileged(
|
||||
ClassLoader l = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(ProductDerivation.class));
|
||||
_derivationNames = Services.getImplementors(ProductDerivation.class, l);
|
||||
_derivationErrors = new Throwable[_derivationNames.length];
|
||||
|
@ -250,7 +250,7 @@ public class ProductDerivations {
|
|||
if (StringUtils.isEmpty(resource))
|
||||
return null;
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
ConfigurationProvider provider = null;
|
||||
StringBuffer errs = null;
|
||||
|
@ -285,7 +285,7 @@ public class ProductDerivations {
|
|||
if (file == null)
|
||||
return null;
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
ConfigurationProvider provider = null;
|
||||
StringBuffer errs = null;
|
||||
|
@ -302,7 +302,7 @@ public class ProductDerivations {
|
|||
errs.append(_derivations[i].getClass().getName() + ":" + t);
|
||||
}
|
||||
}
|
||||
String aPath = (String) AccessController.doPrivileged(
|
||||
String aPath = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getAbsolutePathAction(file));
|
||||
reportErrors(errs, aPath, err);
|
||||
String rsrc = aPath + "#" + anchor;
|
||||
|
@ -331,7 +331,7 @@ public class ProductDerivations {
|
|||
private static ConfigurationProvider load(ClassLoader loader,
|
||||
boolean globals) {
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
ConfigurationProvider provider = null;
|
||||
|
|
|
@ -188,7 +188,7 @@ public class LogFactoryImpl
|
|||
_out = new PrintStream((FileOutputStream)
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newFileOutputStreamAction(
|
||||
(String) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getCanonicalPathAction(f)),
|
||||
true)));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
|
|
|
@ -298,7 +298,7 @@ public class CFMetaDataParser extends XMLMetaDataParser {
|
|||
return null;
|
||||
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
boolean fullName = name.indexOf('.') != -1;
|
||||
boolean noPackage = StringUtils.isEmpty(pkg);
|
||||
|
|
|
@ -214,7 +214,7 @@ public class ClassArgParser {
|
|||
return new String[]{ getFromClassFile(file) };
|
||||
if (arg.endsWith(".java"))
|
||||
return new String[]{ getFromJavaFile(file) };
|
||||
if (((Boolean) AccessController.doPrivileged(
|
||||
if ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(file))).booleanValue()) {
|
||||
Collection col = getFromMetaDataFile(file);
|
||||
return (String[]) col.toArray(new String[col.size()]);
|
||||
|
@ -300,7 +300,7 @@ public class ClassArgParser {
|
|||
private String getFromClassFile(File file) throws IOException {
|
||||
FileInputStream fin = null;
|
||||
try {
|
||||
fin = (FileInputStream) AccessController.doPrivileged(
|
||||
fin = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newFileInputStreamAction(file));
|
||||
return getFromClass(fin);
|
||||
} catch (PrivilegedActionException pae) {
|
||||
|
|
|
@ -75,7 +75,7 @@ public class ClassMetaDataIterator implements MetaDataIterator {
|
|||
}
|
||||
|
||||
if (loader == null) {
|
||||
MultiClassLoader multi = (MultiClassLoader) AccessController
|
||||
MultiClassLoader multi = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
|
||||
multi.addClassLoader(multi.SYSTEM_LOADER);
|
||||
multi.addClassLoader(multi.THREAD_LOADER);
|
||||
|
@ -156,7 +156,7 @@ public class ClassMetaDataIterator implements MetaDataIterator {
|
|||
_url = -1;
|
||||
_urls.clear();
|
||||
try {
|
||||
e = (Enumeration) AccessController.doPrivileged(
|
||||
e = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourcesAction(
|
||||
_loader, (String) _locs.get(_loc)));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
|
@ -178,7 +178,7 @@ public class ClassMetaDataIterator implements MetaDataIterator {
|
|||
if (_url == -1 || _url >= _urls.size())
|
||||
throw new IllegalStateException();
|
||||
try {
|
||||
return (InputStream) AccessController.doPrivileged(
|
||||
return AccessController.doPrivileged(
|
||||
J2DoPrivHelper.openStreamAction((URL) _urls.get(_url)));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw (IOException) pae.getException();
|
||||
|
@ -190,7 +190,7 @@ public class ClassMetaDataIterator implements MetaDataIterator {
|
|||
throw new IllegalStateException();
|
||||
File file = new File(URLDecoder.decode(((URL) _urls.get(_url)).
|
||||
getFile()));
|
||||
return (((Boolean) AccessController.doPrivileged(
|
||||
return ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(file))).booleanValue()) ? file:null;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ClasspathMetaDataIterator extends MetaDataIteratorChain {
|
|||
*/
|
||||
public ClasspathMetaDataIterator(String[] dirs, MetaDataFilter filter)
|
||||
throws IOException {
|
||||
Properties props = (Properties) AccessController.doPrivileged(
|
||||
Properties props = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getPropertiesAction());
|
||||
String path = props.getProperty("java.class.path");
|
||||
String[] tokens = Strings.split(path,
|
||||
|
@ -62,15 +62,15 @@ public class ClasspathMetaDataIterator extends MetaDataIteratorChain {
|
|||
continue;
|
||||
|
||||
File file = new File(tokens[i]);
|
||||
if (!((Boolean) AccessController.doPrivileged(
|
||||
if (!(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(file))).booleanValue())
|
||||
continue;
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPrivHelper
|
||||
if ((AccessController.doPrivileged(J2DoPrivHelper
|
||||
.isDirectoryAction(file))).booleanValue())
|
||||
addIterator(new FileMetaDataIterator(file, filter));
|
||||
else if (tokens[i].endsWith(".jar")) {
|
||||
try {
|
||||
ZipFile zFile = (ZipFile) AccessController
|
||||
ZipFile zFile = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newZipFileAction(file));
|
||||
addIterator(new ZipFileMetaDataIterator(zFile, filter));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
|
|
|
@ -113,7 +113,7 @@ public class FileMetaDataIterator implements MetaDataIterator {
|
|||
|
||||
_file = (File) _itr.next();
|
||||
try {
|
||||
File f = (File) AccessController.doPrivileged(J2DoPrivHelper
|
||||
File f = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.getAbsoluteFileAction(_file));
|
||||
return AccessController.doPrivileged(
|
||||
J2DoPrivHelper.toURLAction(f));
|
||||
|
@ -127,7 +127,7 @@ public class FileMetaDataIterator implements MetaDataIterator {
|
|||
throw new IllegalStateException();
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
fis = (FileInputStream) AccessController.doPrivileged(
|
||||
fis = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newFileInputStreamAction(_file));
|
||||
return fis;
|
||||
} catch (PrivilegedActionException pae) {
|
||||
|
@ -157,11 +157,11 @@ public class FileMetaDataIterator implements MetaDataIterator {
|
|||
}
|
||||
|
||||
public byte[] getContent() throws IOException {
|
||||
long len = ((Long) AccessController.doPrivileged(
|
||||
long len = (AccessController.doPrivileged(
|
||||
J2DoPrivHelper.lengthAction(_file))).longValue();
|
||||
FileInputStream fin = null;
|
||||
try {
|
||||
fin = (FileInputStream) AccessController.doPrivileged(
|
||||
fin = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newFileInputStreamAction(_file));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw (FileNotFoundException) pae.getException();
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ResourceMetaDataIterator implements MetaDataIterator {
|
|||
public ResourceMetaDataIterator(String rsrc, ClassLoader loader)
|
||||
throws IOException {
|
||||
if (loader == null) {
|
||||
MultiClassLoader multi = (MultiClassLoader) AccessController
|
||||
MultiClassLoader multi = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
|
||||
multi.addClassLoader(multi.SYSTEM_LOADER);
|
||||
multi.addClassLoader(multi.THREAD_LOADER);
|
||||
|
@ -66,7 +66,7 @@ public class ResourceMetaDataIterator implements MetaDataIterator {
|
|||
}
|
||||
|
||||
try {
|
||||
Enumeration e = (Enumeration) AccessController.doPrivileged(
|
||||
Enumeration e = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourcesAction(loader, rsrc));
|
||||
while (e.hasMoreElements()) {
|
||||
if (_urls == null)
|
||||
|
@ -92,7 +92,7 @@ public class ResourceMetaDataIterator implements MetaDataIterator {
|
|||
if (_url == -1 || _url >= _urls.size())
|
||||
throw new IllegalStateException();
|
||||
try {
|
||||
return (InputStream) AccessController.doPrivileged(
|
||||
return AccessController.doPrivileged(
|
||||
J2DoPrivHelper.openStreamAction((URL) _urls.get(_url)));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw (IOException) pae.getException();
|
||||
|
@ -104,7 +104,7 @@ public class ResourceMetaDataIterator implements MetaDataIterator {
|
|||
throw new IllegalStateException();
|
||||
File file = new File(URLDecoder.decode(((URL) _urls.get(_url)).
|
||||
getFile()));
|
||||
return (((Boolean) AccessController.doPrivileged(
|
||||
return ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(file))).booleanValue()) ? file :null;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class SourceTrackers {
|
|||
for (int i = 0; i < trackers.length; i++) {
|
||||
sourceFilePath = (trackers[i].getSourceFile() == null ?
|
||||
_loc.get("source-tracker-file-unknown").getMessage() :
|
||||
(String) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getAbsolutePathAction(
|
||||
trackers[i].getSourceFile())));
|
||||
buf.append(" ").append(_loc.get(
|
||||
|
|
|
@ -64,7 +64,7 @@ public class URLMetaDataIterator implements MetaDataIterator {
|
|||
if (_url == null)
|
||||
return null;
|
||||
try {
|
||||
return (InputStream) AccessController.doPrivileged(
|
||||
return AccessController.doPrivileged(
|
||||
J2DoPrivHelper.openStreamAction(_url));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw (IOException) pae.getException();
|
||||
|
@ -77,7 +77,7 @@ public class URLMetaDataIterator implements MetaDataIterator {
|
|||
if (_url == null)
|
||||
return null;
|
||||
File file = new File(URLDecoder.decode(_url.getPath()));
|
||||
return (((Boolean) AccessController.doPrivileged(
|
||||
return ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(file))).booleanValue()) ? file:null;
|
||||
}
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ public abstract class XMLMetaDataParser extends DefaultHandler
|
|||
public void parse(File file) throws IOException {
|
||||
if (file == null)
|
||||
return;
|
||||
if (!((Boolean) AccessController.doPrivileged(J2DoPrivHelper
|
||||
if (!(AccessController.doPrivileged(J2DoPrivHelper
|
||||
.isDirectoryAction(file))).booleanValue())
|
||||
parse(new FileMetaDataIterator(file));
|
||||
else {
|
||||
|
@ -632,7 +632,7 @@ public abstract class XMLMetaDataParser extends DefaultHandler
|
|||
if (_loader != null)
|
||||
return _loader;
|
||||
if (_curLoader == null)
|
||||
_curLoader = (ClassLoader) AccessController.doPrivileged(
|
||||
_curLoader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
return _curLoader;
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ public abstract class XMLMetaDataSerializer implements MetaDataSerializer {
|
|||
File backup = Files.backup(file, false);
|
||||
if (backup == null) {
|
||||
File parent = file.getParentFile();
|
||||
if (parent != null && !((Boolean) AccessController.doPrivileged(
|
||||
if (parent != null && !(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(parent))).booleanValue())
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.mkdirsAction(parent));
|
||||
|
@ -198,7 +198,7 @@ public abstract class XMLMetaDataSerializer implements MetaDataSerializer {
|
|||
_backup = prepareWrite(file);
|
||||
try {
|
||||
FileWriter out = new FileWriter(
|
||||
(String) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getCanonicalPathAction(file)),
|
||||
(flags & APPEND) > 0);
|
||||
serialize(out, flags);
|
||||
|
|
|
@ -51,16 +51,16 @@ public class Files {
|
|||
* the file does not exist or a backup could not be created, returns null.
|
||||
*/
|
||||
public static File backup(File file, boolean copy) {
|
||||
if (file == null || !((Boolean) AccessController.doPrivileged(
|
||||
if (file == null || !(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(file))).booleanValue())
|
||||
return null;
|
||||
|
||||
// create new file object copy so we don't modify the original
|
||||
String aPath = (String) AccessController.doPrivileged(
|
||||
String aPath = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getAbsolutePathAction(file));
|
||||
File clone = new File(aPath);
|
||||
File bk = new File(aPath + "~");
|
||||
if (!((Boolean) AccessController.doPrivileged(
|
||||
if (!(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.renameToAction(clone, bk))).booleanValue())
|
||||
return null;
|
||||
if (copy) {
|
||||
|
@ -83,16 +83,16 @@ public class Files {
|
|||
return null;
|
||||
if (!backup.getName().endsWith("~"))
|
||||
backup = new File(backup.getPath() + "~");
|
||||
if (!((Boolean) AccessController.doPrivileged(
|
||||
if (!(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(backup))).booleanValue())
|
||||
return null;
|
||||
|
||||
// create new file object copy so we don't modify the original
|
||||
String path = (String) AccessController.doPrivileged(
|
||||
String path = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getAbsolutePathAction(backup));
|
||||
File clone = new File(path);
|
||||
File orig = new File(path.substring(0, path.length() - 1));
|
||||
if (!((Boolean) AccessController.doPrivileged(
|
||||
if (!(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.renameToAction(clone, orig))).booleanValue())
|
||||
return null;
|
||||
if (copy) {
|
||||
|
@ -132,7 +132,7 @@ public class Files {
|
|||
if (innerIdx != -1)
|
||||
name = name.substring(0, innerIdx);
|
||||
|
||||
URL rsrc = (URL) AccessController.doPrivileged(
|
||||
URL rsrc = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourceAction(cls, name + ext));
|
||||
if (rsrc != null && rsrc.getProtocol().equals("file"))
|
||||
return new File(URLDecoder.decode(rsrc.getFile()));
|
||||
|
@ -148,10 +148,10 @@ public class Files {
|
|||
*/
|
||||
public static File getPackageFile(File base, String pkg, boolean mkdirs) {
|
||||
if (base == null)
|
||||
base = new File((String) AccessController.doPrivileged(
|
||||
base = new File(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getPropertyAction("user.dir")));
|
||||
if (StringUtils.isEmpty(pkg)) {
|
||||
if (mkdirs && !((Boolean) AccessController.doPrivileged(
|
||||
if (mkdirs && !(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(base))).booleanValue())
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.mkdirsAction(base));
|
||||
|
@ -161,7 +161,7 @@ public class Files {
|
|||
pkg = pkg.replace('.', File.separatorChar);
|
||||
File file = null;
|
||||
try {
|
||||
if (((String) AccessController.doPrivileged(
|
||||
if ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getCanonicalPathAction(base))).endsWith(pkg))
|
||||
file = base;
|
||||
else
|
||||
|
@ -173,7 +173,7 @@ public class Files {
|
|||
throw new NestableRuntimeException(ioe);
|
||||
}
|
||||
|
||||
if (mkdirs && !((Boolean) AccessController.doPrivileged(
|
||||
if (mkdirs && !(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(file))).booleanValue())
|
||||
AccessController.doPrivileged(J2DoPrivHelper.mkdirsAction(file));
|
||||
return file;
|
||||
|
@ -195,20 +195,20 @@ public class Files {
|
|||
return null;
|
||||
|
||||
File file = new File(name);
|
||||
if (((Boolean) AccessController.doPrivileged(
|
||||
if ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(file))).booleanValue())
|
||||
return file;
|
||||
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
URL url = (URL) AccessController.doPrivileged(
|
||||
URL url = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourceAction(loader, name));
|
||||
if (url != null) {
|
||||
String urlFile = url.getFile();
|
||||
if (urlFile != null) {
|
||||
File rsrc = new File(URLDecoder.decode(urlFile));
|
||||
if (((Boolean) AccessController.doPrivileged(
|
||||
if ((AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(rsrc))).booleanValue())
|
||||
return rsrc;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ public class Files {
|
|||
if ("stderr".equals(file))
|
||||
return System.err;
|
||||
try {
|
||||
return (FileOutputStream) AccessController.doPrivileged(
|
||||
return AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newFileOutputStreamAction(
|
||||
getFile(file, loader)));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
|
@ -269,17 +269,17 @@ public class Files {
|
|||
*/
|
||||
public static boolean copy(File from, File to) throws IOException {
|
||||
if (from == null || to == null ||
|
||||
!((Boolean) AccessController.doPrivileged(
|
||||
!(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(from))).booleanValue())
|
||||
return false;
|
||||
|
||||
FileInputStream in = null;
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
in = (FileInputStream) AccessController.doPrivileged(
|
||||
in = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newFileInputStreamAction(from));
|
||||
BufferedInputStream inbuf = new BufferedInputStream(in);
|
||||
out = (FileOutputStream) AccessController.doPrivileged(
|
||||
out = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.newFileOutputStreamAction(to));
|
||||
BufferedOutputStream outbuf = new BufferedOutputStream(out);
|
||||
for (int b; (b = inbuf.read()) != -1; outbuf.write(b)) ;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.apache.openjpa.lib.util;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.AnnotatedElement;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
|
@ -44,10 +45,10 @@ public abstract class J2DoPriv5Helper extends J2DoPrivHelper {
|
|||
*
|
||||
* @return Annotation[]
|
||||
*/
|
||||
public static final PrivilegedAction getAnnotationsAction(
|
||||
public static final PrivilegedAction<Annotation []> getAnnotationsAction(
|
||||
final AnnotatedElement element) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<Annotation []>() {
|
||||
public Annotation [] run() {
|
||||
return element.getAnnotations();
|
||||
}
|
||||
};
|
||||
|
@ -62,10 +63,11 @@ public abstract class J2DoPriv5Helper extends J2DoPrivHelper {
|
|||
*
|
||||
* @return Annotation[]
|
||||
*/
|
||||
public static final PrivilegedAction getDeclaredAnnotationsAction(
|
||||
public static final PrivilegedAction<Annotation []>
|
||||
getDeclaredAnnotationsAction(
|
||||
final AnnotatedElement element) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<Annotation[]>() {
|
||||
public Annotation [] run() {
|
||||
return element.getDeclaredAnnotations();
|
||||
}
|
||||
};
|
||||
|
@ -80,10 +82,11 @@ public abstract class J2DoPriv5Helper extends J2DoPrivHelper {
|
|||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public static final PrivilegedAction isAnnotationPresentAction(
|
||||
final AnnotatedElement element, final Class annotationClazz) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Boolean> isAnnotationPresentAction(
|
||||
final AnnotatedElement element,
|
||||
final Class<? extends Annotation> annotationClazz) {
|
||||
return new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
return element.isAnnotationPresent(annotationClazz)
|
||||
? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,10 @@ import java.io.FileInputStream;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.AccessibleObject;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.InetAddress;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.ServerSocket;
|
||||
|
@ -34,10 +37,13 @@ import java.net.UnknownHostException;
|
|||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Properties;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import serp.bytecode.BCClass;
|
||||
import serp.bytecode.BCClassLoader;
|
||||
import serp.bytecode.BCField;
|
||||
import serp.bytecode.Code;
|
||||
import serp.bytecode.FieldInstruction;
|
||||
import serp.bytecode.Project;
|
||||
|
@ -104,7 +110,7 @@ import serp.bytecode.Project;
|
|||
* 2) Methods with no exception thrown. PrivilegedAction is returned from
|
||||
* J2DoPrivHelper.*Action(). E.g.
|
||||
*
|
||||
* ClassLoader loader = (ClassLoader) AccessController.doPrivileged(
|
||||
* ClassLoader loader = AccessController.doPrivileged(
|
||||
* J2DoPrivHelper.getClassLoaderAction(clazz));
|
||||
*
|
||||
* ClassLoader loader = (ClassLoader) (System.getSecurityManager() == null)
|
||||
|
@ -115,7 +121,7 @@ import serp.bytecode.Project;
|
|||
* from J2DoPrivHelper.*Action(). E.g.
|
||||
*
|
||||
* try {
|
||||
* method = (Method) AccessController.doPrivileged(
|
||||
* method = AccessController.doPrivileged(
|
||||
* J2DoPrivHelper.getDeclaredMethodAction(clazz, name, parameterType));
|
||||
* } catch (PrivilegedActionException pae) {
|
||||
* throw (NoSuchMethodException) pae.getException();
|
||||
|
@ -124,7 +130,7 @@ import serp.bytecode.Project;
|
|||
* try {
|
||||
* method = (System.getSecurityManager() == null)
|
||||
* ? clazz.getDeclaredMethod(name,parameterType)
|
||||
* : (Method) AccessController.doPrivileged(
|
||||
* : AccessController.doPrivileged(
|
||||
* J2DoPrivHelper.getDeclaredMethodAction(
|
||||
* clazz, name, parameterType));
|
||||
* } catch (PrivilegedActionException pae) {
|
||||
|
@ -146,12 +152,12 @@ public abstract class J2DoPrivHelper {
|
|||
*/
|
||||
public static final String getLineSeparator() {
|
||||
if (lineSeparator == null) {
|
||||
lineSeparator = (String) AccessController
|
||||
.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return System.getProperty("line.separator");
|
||||
}
|
||||
});
|
||||
lineSeparator =
|
||||
AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
public String run() {
|
||||
return System.getProperty("line.separator");
|
||||
}
|
||||
});
|
||||
}
|
||||
return lineSeparator;
|
||||
}
|
||||
|
@ -164,12 +170,12 @@ public abstract class J2DoPrivHelper {
|
|||
*/
|
||||
public static final String getPathSeparator() {
|
||||
if (pathSeparator == null) {
|
||||
pathSeparator = (String) AccessController
|
||||
.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return System.getProperty("path.separator");
|
||||
}
|
||||
});
|
||||
pathSeparator =
|
||||
AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
public String run() {
|
||||
return System.getProperty("path.separator");
|
||||
}
|
||||
});
|
||||
}
|
||||
return pathSeparator;
|
||||
}
|
||||
|
@ -180,9 +186,9 @@ public abstract class J2DoPrivHelper {
|
|||
* Requires security policy: 'permission java.lang.reflect.ReflectPermission
|
||||
* "suppressAccessChecks";'
|
||||
*/
|
||||
public static final PrivilegedAction setAccessibleAction(
|
||||
public static final PrivilegedAction<Object> setAccessibleAction(
|
||||
final AccessibleObject aObj, final boolean flag) {
|
||||
return new PrivilegedAction() {
|
||||
return new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
aObj.setAccessible(flag);
|
||||
return (Object) null;
|
||||
|
@ -229,7 +235,7 @@ public abstract class J2DoPrivHelper {
|
|||
* @return Classloader
|
||||
*/
|
||||
public static final PrivilegedAction<ClassLoader> getClassLoaderAction(
|
||||
final Class clazz) {
|
||||
final Class<?> clazz) {
|
||||
return new PrivilegedAction<ClassLoader>() {
|
||||
public ClassLoader run() {
|
||||
return clazz.getClassLoader();
|
||||
|
@ -246,10 +252,10 @@ public abstract class J2DoPrivHelper {
|
|||
* @return Field
|
||||
* @exception NoSuchFieldException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction getDeclaredFieldAction(
|
||||
final Class clazz, final String name) {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws NoSuchFieldException {
|
||||
public static final PrivilegedExceptionAction<Field> getDeclaredFieldAction(
|
||||
final Class<?> clazz, final String name) {
|
||||
return new PrivilegedExceptionAction<Field>() {
|
||||
public Field run() throws NoSuchFieldException {
|
||||
return clazz.getDeclaredField(name);
|
||||
}
|
||||
};
|
||||
|
@ -263,10 +269,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Field[]
|
||||
*/
|
||||
public static final PrivilegedAction getDeclaredFieldsAction(
|
||||
final Class clazz) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Field []> getDeclaredFieldsAction(
|
||||
final Class<?> clazz) {
|
||||
return new PrivilegedAction<Field []>() {
|
||||
public Field[] run() {
|
||||
return clazz.getDeclaredFields();
|
||||
}
|
||||
};
|
||||
|
@ -281,10 +287,12 @@ public abstract class J2DoPrivHelper {
|
|||
* @return Method
|
||||
* @exception NoSuchMethodException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction getDeclaredMethodAction(
|
||||
final Class clazz, final String name, final Class[] parameterTypes) {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws NoSuchMethodException {
|
||||
public static final PrivilegedExceptionAction<Method>
|
||||
getDeclaredMethodAction(
|
||||
final Class<?> clazz, final String name,
|
||||
final Class<?>[] parameterTypes) {
|
||||
return new PrivilegedExceptionAction<Method>() {
|
||||
public Method run() throws NoSuchMethodException {
|
||||
return clazz.getDeclaredMethod(name, parameterTypes);
|
||||
}
|
||||
};
|
||||
|
@ -298,10 +306,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Method[]
|
||||
*/
|
||||
public static final PrivilegedAction getDeclaredMethodsAction(
|
||||
final Class clazz) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Method []> getDeclaredMethodsAction(
|
||||
final Class<?> clazz) {
|
||||
return new PrivilegedAction<Method []>() {
|
||||
public Method[] run() {
|
||||
return clazz.getDeclaredMethods();
|
||||
}
|
||||
};
|
||||
|
@ -315,10 +323,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return URL
|
||||
*/
|
||||
public static final PrivilegedAction getResourceAction(
|
||||
final Class clazz, final String resource) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<URL> getResourceAction(
|
||||
final Class<?> clazz, final String resource) {
|
||||
return new PrivilegedAction<URL>() {
|
||||
public URL run() {
|
||||
return clazz.getResource(resource);
|
||||
}
|
||||
};
|
||||
|
@ -353,10 +361,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return ClassLoader
|
||||
*/
|
||||
public static final PrivilegedAction getParentAction(
|
||||
public static final PrivilegedAction<ClassLoader> getParentAction(
|
||||
final ClassLoader loader) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<ClassLoader>() {
|
||||
public ClassLoader run() {
|
||||
return loader.getParent();
|
||||
}
|
||||
};
|
||||
|
@ -370,10 +378,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return URL
|
||||
*/
|
||||
public static final PrivilegedAction getResourceAction(
|
||||
public static final PrivilegedAction<URL> getResourceAction(
|
||||
final ClassLoader loader, final String resource) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<URL>() {
|
||||
public URL run() {
|
||||
return loader.getResource(resource);
|
||||
}
|
||||
};
|
||||
|
@ -388,10 +396,11 @@ public abstract class J2DoPrivHelper {
|
|||
* @return Enumeration
|
||||
* @exception IOException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction getResourcesAction(
|
||||
public static final PrivilegedExceptionAction<Enumeration<URL>>
|
||||
getResourcesAction(
|
||||
final ClassLoader loader, final String resource) throws IOException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws IOException {
|
||||
return new PrivilegedExceptionAction<Enumeration<URL>>() {
|
||||
public Enumeration<URL> run() throws IOException {
|
||||
return loader.getResources(resource);
|
||||
}
|
||||
};
|
||||
|
@ -405,9 +414,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return ClassLoader
|
||||
*/
|
||||
public static final PrivilegedAction getSystemClassLoaderAction() {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<ClassLoader>
|
||||
getSystemClassLoaderAction() {
|
||||
return new PrivilegedAction<ClassLoader>() {
|
||||
public ClassLoader run() {
|
||||
return ClassLoader.getSystemClassLoader();
|
||||
}
|
||||
};
|
||||
|
@ -421,9 +431,9 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public static final PrivilegedAction deleteAction(final File f) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Boolean> deleteAction(final File f) {
|
||||
return new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
return f.delete() ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
};
|
||||
|
@ -437,9 +447,9 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public static final PrivilegedAction existsAction(final File f) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Boolean> existsAction(final File f) {
|
||||
return new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
try {
|
||||
return f.exists() ? Boolean.TRUE : Boolean.FALSE;
|
||||
} catch (NullPointerException npe) {
|
||||
|
@ -457,9 +467,9 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return File
|
||||
*/
|
||||
public static final PrivilegedAction getAbsoluteFileAction(final File f) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<File> getAbsoluteFileAction(final File f) {
|
||||
return new PrivilegedAction<File>() {
|
||||
public File run() {
|
||||
return f.getAbsoluteFile();
|
||||
}
|
||||
};
|
||||
|
@ -473,9 +483,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return String
|
||||
*/
|
||||
public static final PrivilegedAction getAbsolutePathAction(final File f) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<String>
|
||||
getAbsolutePathAction(final File f) {
|
||||
return new PrivilegedAction<String>() {
|
||||
public String run() {
|
||||
return f.getAbsolutePath();
|
||||
}
|
||||
};
|
||||
|
@ -490,10 +501,11 @@ public abstract class J2DoPrivHelper {
|
|||
* @return String
|
||||
* @exception IOException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction getCanonicalPathAction(
|
||||
public static final PrivilegedExceptionAction<String>
|
||||
getCanonicalPathAction(
|
||||
final File f) throws IOException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws IOException {
|
||||
return new PrivilegedExceptionAction<String>() {
|
||||
public String run() throws IOException {
|
||||
return f.getCanonicalPath();
|
||||
}
|
||||
};
|
||||
|
@ -507,9 +519,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public static final PrivilegedAction isDirectoryAction(final File f) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Boolean>
|
||||
isDirectoryAction(final File f) {
|
||||
return new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
return f.isDirectory() ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
};
|
||||
|
@ -523,9 +536,9 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public static final PrivilegedAction isFileAction(final File f) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Boolean> isFileAction(final File f) {
|
||||
return new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
return f.isFile() ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
};
|
||||
|
@ -539,9 +552,9 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Long
|
||||
*/
|
||||
public static final PrivilegedAction lengthAction(final File f) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Long> lengthAction(final File f) {
|
||||
return new PrivilegedAction<Long>() {
|
||||
public Long run() {
|
||||
return new Long(f.length());
|
||||
}
|
||||
};
|
||||
|
@ -555,9 +568,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return File[]
|
||||
*/
|
||||
public static final PrivilegedAction listFilesAction(final File f) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<File []>
|
||||
listFilesAction(final File f) {
|
||||
return new PrivilegedAction<File []>() {
|
||||
public File [] run() {
|
||||
return f.listFiles();
|
||||
}
|
||||
};
|
||||
|
@ -571,9 +585,9 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public static final PrivilegedAction mkdirsAction(final File f) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Boolean> mkdirsAction(final File f) {
|
||||
return new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
return f.mkdirs() ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
};
|
||||
|
@ -587,10 +601,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public static final PrivilegedAction renameToAction(final File from,
|
||||
final File to) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Boolean> renameToAction(
|
||||
final File from, final File to) {
|
||||
return new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
return from.renameTo(to) ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
};
|
||||
|
@ -602,13 +616,14 @@ public abstract class J2DoPrivHelper {
|
|||
* Requires security policy:
|
||||
* 'permission java.io.FilePermission "read";'
|
||||
*
|
||||
* @return Boolean
|
||||
* @return URL
|
||||
* @throws MalformedURLException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction toURLAction(final File file)
|
||||
public static final PrivilegedExceptionAction<URL> toURLAction(
|
||||
final File file)
|
||||
throws MalformedURLException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws MalformedURLException {
|
||||
return new PrivilegedExceptionAction<URL>() {
|
||||
public URL run() throws MalformedURLException {
|
||||
return file.toURL();
|
||||
}
|
||||
};
|
||||
|
@ -623,10 +638,11 @@ public abstract class J2DoPrivHelper {
|
|||
* @return FileInputStream
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction newFileInputStreamAction(
|
||||
public static final PrivilegedExceptionAction<FileInputStream>
|
||||
newFileInputStreamAction(
|
||||
final File f) throws FileNotFoundException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws FileNotFoundException {
|
||||
return new PrivilegedExceptionAction<FileInputStream>() {
|
||||
public FileInputStream run() throws FileNotFoundException {
|
||||
return new FileInputStream(f);
|
||||
}
|
||||
};
|
||||
|
@ -641,10 +657,11 @@ public abstract class J2DoPrivHelper {
|
|||
* @return FileOutputStream
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction newFileOutputStreamAction(
|
||||
public static final PrivilegedExceptionAction<FileOutputStream>
|
||||
newFileOutputStreamAction(
|
||||
final File f) throws FileNotFoundException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws FileNotFoundException {
|
||||
return new PrivilegedExceptionAction<FileOutputStream>() {
|
||||
public FileOutputStream run() throws FileNotFoundException {
|
||||
return new FileOutputStream(f);
|
||||
}
|
||||
};
|
||||
|
@ -659,10 +676,11 @@ public abstract class J2DoPrivHelper {
|
|||
* @return FileOutputStream
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction newFileOutputStreamAction(
|
||||
public static final PrivilegedExceptionAction<FileOutputStream>
|
||||
newFileOutputStreamAction(
|
||||
final String f, final boolean append) throws FileNotFoundException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws FileNotFoundException {
|
||||
return new PrivilegedExceptionAction<FileOutputStream>() {
|
||||
public FileOutputStream run() throws FileNotFoundException {
|
||||
return new FileOutputStream(f, append);
|
||||
}
|
||||
};
|
||||
|
@ -677,10 +695,10 @@ public abstract class J2DoPrivHelper {
|
|||
* @return InetAddress
|
||||
* @throws UnknownHostException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction getByNameAction(
|
||||
public static final PrivilegedExceptionAction<InetAddress> getByNameAction(
|
||||
final String hostname) throws UnknownHostException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws UnknownHostException {
|
||||
return new PrivilegedExceptionAction<InetAddress>() {
|
||||
public InetAddress run() throws UnknownHostException {
|
||||
return InetAddress.getByName(hostname);
|
||||
}
|
||||
};
|
||||
|
@ -695,10 +713,10 @@ public abstract class J2DoPrivHelper {
|
|||
* @return Socket
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction newSocketAction(
|
||||
public static final PrivilegedExceptionAction<Socket> newSocketAction(
|
||||
final InetAddress host, final int port) throws IOException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws IOException {
|
||||
return new PrivilegedExceptionAction<Socket>() {
|
||||
public Socket run() throws IOException {
|
||||
return new Socket(host, port);
|
||||
}
|
||||
};
|
||||
|
@ -713,10 +731,10 @@ public abstract class J2DoPrivHelper {
|
|||
* @return ServerSocket
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction newServerSocketAction(
|
||||
public static final PrivilegedExceptionAction<ServerSocket> newServerSocketAction(
|
||||
final int port) throws IOException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws IOException {
|
||||
return new PrivilegedExceptionAction<ServerSocket>() {
|
||||
public ServerSocket run() throws IOException {
|
||||
return new ServerSocket(port);
|
||||
}
|
||||
};
|
||||
|
@ -731,10 +749,10 @@ public abstract class J2DoPrivHelper {
|
|||
* @return Socket
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction acceptAction(
|
||||
public static final PrivilegedExceptionAction<Socket> acceptAction(
|
||||
final ServerSocket ss) throws IOException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws IOException {
|
||||
return new PrivilegedExceptionAction<Socket>() {
|
||||
public Socket run() throws IOException {
|
||||
return ss.accept();
|
||||
}
|
||||
};
|
||||
|
@ -748,9 +766,9 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Properties
|
||||
*/
|
||||
public static final PrivilegedAction getPropertiesAction() {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Properties> getPropertiesAction() {
|
||||
return new PrivilegedAction<Properties>() {
|
||||
public Properties run() {
|
||||
return System.getProperties();
|
||||
}
|
||||
};
|
||||
|
@ -764,9 +782,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return String
|
||||
*/
|
||||
public static final PrivilegedAction getPropertyAction(final String name) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<String> getPropertyAction(
|
||||
final String name) {
|
||||
return new PrivilegedAction<String>() {
|
||||
public String run() {
|
||||
return System.getProperty(name);
|
||||
}
|
||||
};
|
||||
|
@ -799,10 +818,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return Thread
|
||||
*/
|
||||
public static final PrivilegedAction newDaemonThreadAction(
|
||||
public static final PrivilegedAction<Thread> newDaemonThreadAction(
|
||||
final Runnable target, final String name) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<Thread>() {
|
||||
public Thread run() {
|
||||
Thread thread = new Thread(target, name);
|
||||
thread.setDaemon(true);
|
||||
return thread;
|
||||
|
@ -819,10 +838,10 @@ public abstract class J2DoPrivHelper {
|
|||
* @return InputStream
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction openStreamAction(
|
||||
public static final PrivilegedExceptionAction<InputStream> openStreamAction(
|
||||
final URL url) throws IOException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws IOException {
|
||||
return new PrivilegedExceptionAction<InputStream>() {
|
||||
public InputStream run() throws IOException {
|
||||
return url.openStream();
|
||||
}
|
||||
};
|
||||
|
@ -837,9 +856,9 @@ public abstract class J2DoPrivHelper {
|
|||
* @return Object
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction getContentAction(
|
||||
public static final PrivilegedExceptionAction<Object> getContentAction(
|
||||
final URLConnection con) throws IOException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
return new PrivilegedExceptionAction<Object>() {
|
||||
public Object run() throws IOException {
|
||||
return con.getContent();
|
||||
}
|
||||
|
@ -855,10 +874,11 @@ public abstract class J2DoPrivHelper {
|
|||
* @return ZipFile
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction newZipFileAction(final File f)
|
||||
public static final PrivilegedExceptionAction<ZipFile> newZipFileAction(
|
||||
final File f)
|
||||
throws IOException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
public Object run() throws IOException {
|
||||
return new PrivilegedExceptionAction<ZipFile>() {
|
||||
public ZipFile run() throws IOException {
|
||||
return new ZipFile(f);
|
||||
}
|
||||
};
|
||||
|
@ -872,9 +892,9 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return serp.bytecode.Code
|
||||
*/
|
||||
public static final PrivilegedAction newCodeAction() {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<Code> newCodeAction() {
|
||||
return new PrivilegedAction<Code>() {
|
||||
public Code run() {
|
||||
return new Code();
|
||||
}
|
||||
};
|
||||
|
@ -888,10 +908,11 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return TemporaryClassLoader
|
||||
*/
|
||||
public static final PrivilegedAction newTemporaryClassLoaderAction(
|
||||
public static final PrivilegedAction<TemporaryClassLoader>
|
||||
newTemporaryClassLoaderAction(
|
||||
final ClassLoader parent) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<TemporaryClassLoader>() {
|
||||
public TemporaryClassLoader run() {
|
||||
return new TemporaryClassLoader(parent);
|
||||
}
|
||||
};
|
||||
|
@ -905,9 +926,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return MultiClassLoader
|
||||
*/
|
||||
public static final PrivilegedAction newMultiClassLoaderAction() {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<MultiClassLoader>
|
||||
newMultiClassLoaderAction() {
|
||||
return new PrivilegedAction<MultiClassLoader>() {
|
||||
public MultiClassLoader run() {
|
||||
return new MultiClassLoader();
|
||||
}
|
||||
};
|
||||
|
@ -921,19 +943,19 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return BCClassLoader
|
||||
*/
|
||||
public static final PrivilegedAction newBCClassLoaderAction(
|
||||
public static final PrivilegedAction<BCClassLoader> newBCClassLoaderAction(
|
||||
final Project project, final ClassLoader parent) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<BCClassLoader>() {
|
||||
public BCClassLoader run() {
|
||||
return new BCClassLoader(project, parent);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static final PrivilegedAction newBCClassLoaderAction(
|
||||
public static final PrivilegedAction<BCClassLoader> newBCClassLoaderAction(
|
||||
final Project project) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<BCClassLoader>() {
|
||||
public BCClassLoader run() {
|
||||
return new BCClassLoader(project);
|
||||
}
|
||||
};
|
||||
|
@ -945,12 +967,12 @@ public abstract class J2DoPrivHelper {
|
|||
* Requires security policy:
|
||||
* 'permission java.io.FilePermission "write";'
|
||||
*
|
||||
* @return File
|
||||
* @return null
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final PrivilegedExceptionAction bCClassWrite(
|
||||
public static final PrivilegedExceptionAction<Object> bCClassWrite(
|
||||
final BCClass bc, final File f) throws IOException {
|
||||
return new PrivilegedExceptionAction() {
|
||||
return new PrivilegedExceptionAction<Object>() {
|
||||
public Object run() throws IOException {
|
||||
bc.write(f);
|
||||
return null;
|
||||
|
@ -966,10 +988,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return BCField
|
||||
*/
|
||||
public static final PrivilegedAction getBCClassFieldsAction(
|
||||
public static final PrivilegedAction<BCField []> getBCClassFieldsAction(
|
||||
final BCClass bcClass, final String fieldName) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<BCField []>() {
|
||||
public BCField [] run() {
|
||||
return bcClass.getFields(fieldName);
|
||||
}
|
||||
};
|
||||
|
@ -983,10 +1005,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return BCField
|
||||
*/
|
||||
public static final PrivilegedAction getFieldInstructionFieldAction(
|
||||
public static final PrivilegedAction<BCField> getFieldInstructionFieldAction(
|
||||
final FieldInstruction instruction) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<BCField>() {
|
||||
public BCField run() {
|
||||
return instruction.getField();
|
||||
}
|
||||
};
|
||||
|
@ -1000,10 +1022,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return BCClass
|
||||
*/
|
||||
public static final PrivilegedAction loadProjectClassAction(
|
||||
final Project project, final Class clazz) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
public static final PrivilegedAction<BCClass> loadProjectClassAction(
|
||||
final Project project, final Class<?> clazz) {
|
||||
return new PrivilegedAction<BCClass>() {
|
||||
public BCClass run() {
|
||||
return project.loadClass(clazz);
|
||||
}
|
||||
};
|
||||
|
@ -1017,10 +1039,10 @@ public abstract class J2DoPrivHelper {
|
|||
*
|
||||
* @return BCClass
|
||||
*/
|
||||
public static final PrivilegedAction loadProjectClassAction(
|
||||
public static final PrivilegedAction<BCClass> loadProjectClassAction(
|
||||
final Project project, final String clazzName) {
|
||||
return new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new PrivilegedAction<BCClass>() {
|
||||
public BCClass run() {
|
||||
return project.loadClass(clazzName);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@ public class JavaVersions {
|
|||
private static Method INIT_CAUSE = null;
|
||||
|
||||
static {
|
||||
String specVersion = (String) AccessController.doPrivileged(
|
||||
String specVersion = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getPropertyAction("java.specification.version"));
|
||||
if ("1.2".equals(specVersion))
|
||||
VERSION = 2;
|
||||
|
|
|
@ -100,7 +100,7 @@ public class Localizer {
|
|||
return loc;
|
||||
else {
|
||||
loc = new Localizer(pkg, file, locale,
|
||||
cls == null ? null:(ClassLoader) AccessController.doPrivileged(
|
||||
cls == null ? null:AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getClassLoaderAction(cls)));
|
||||
_localizers.put(key, loc);
|
||||
return loc;
|
||||
|
|
|
@ -48,7 +48,7 @@ public class MultiClassLoader extends ClassLoader {
|
|||
* The standard system class loader.
|
||||
*/
|
||||
public static final ClassLoader SYSTEM_LOADER =
|
||||
(ClassLoader) AccessController.doPrivileged(
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getSystemClassLoaderAction());
|
||||
|
||||
private List _loaders = new ArrayList(5);
|
||||
|
@ -85,7 +85,7 @@ public class MultiClassLoader extends ClassLoader {
|
|||
for (int i = 0; i < loaders.length; i++) {
|
||||
loader = (ClassLoader) itr.next();
|
||||
if (loader == THREAD_LOADER)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
loaders[i] = loader;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class MultiClassLoader extends ClassLoader {
|
|||
public ClassLoader getClassLoader(int index) {
|
||||
ClassLoader loader = (ClassLoader) _loaders.get(index);
|
||||
if (loader == THREAD_LOADER)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
return loader;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ public class MultiClassLoader extends ClassLoader {
|
|||
for (Iterator itr = _loaders.iterator(); itr.hasNext();) {
|
||||
loader = (ClassLoader) itr.next();
|
||||
if (loader == THREAD_LOADER)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
try {
|
||||
return Class.forName(name, false, loader);
|
||||
|
@ -222,13 +222,13 @@ public class MultiClassLoader extends ClassLoader {
|
|||
for (Iterator itr = _loaders.iterator(); itr.hasNext();) {
|
||||
loader = (ClassLoader) itr.next();
|
||||
if (loader == THREAD_LOADER)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
if (loader == null) // skip
|
||||
continue;
|
||||
|
||||
rsrc = (URL) AccessController.doPrivileged(
|
||||
rsrc = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourceAction(loader, name));
|
||||
if (rsrc != null)
|
||||
return rsrc;
|
||||
|
@ -244,14 +244,14 @@ public class MultiClassLoader extends ClassLoader {
|
|||
for (Iterator itr = _loaders.iterator(); itr.hasNext();) {
|
||||
loader = (ClassLoader) itr.next();
|
||||
if (loader == THREAD_LOADER)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
if (loader == null) // skip
|
||||
continue;
|
||||
|
||||
try {
|
||||
rsrcs = (Enumeration) AccessController.doPrivileged(
|
||||
rsrcs = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourcesAction(loader, name));
|
||||
while (rsrcs.hasMoreElements()) {
|
||||
rsrc = rsrcs.nextElement();
|
||||
|
|
|
@ -211,7 +211,7 @@ public class ParameterTemplate {
|
|||
if (_params.containsKey(param.toString()))
|
||||
copy.append(_params.get(param.toString()));
|
||||
else
|
||||
copy.append((String) AccessController.doPrivileged(
|
||||
copy.append(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getPropertyAction(param.toString())));
|
||||
param = null;
|
||||
} else if (param != null)
|
||||
|
|
|
@ -88,12 +88,12 @@ public class Services {
|
|||
public static String[] getImplementors(String serviceName,
|
||||
ClassLoader loader) {
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
try {
|
||||
Set resourceList = new TreeSet();
|
||||
Enumeration resources = (Enumeration) AccessController.doPrivileged(
|
||||
Enumeration resources = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourcesAction(loader, PREFIX + serviceName));
|
||||
while (resources.hasMoreElements())
|
||||
addResources((URL) resources.nextElement(), resourceList);
|
||||
|
@ -205,7 +205,7 @@ public class Services {
|
|||
public static Class[] getImplementorClasses(String serviceName,
|
||||
ClassLoader loader, boolean skipMissing) throws ClassNotFoundException {
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
String[] names = getImplementors(serviceName, loader);
|
||||
|
|
|
@ -38,7 +38,7 @@ class StreamResourceBundleProvider implements ResourceBundleProvider {
|
|||
ClassLoader loader) {
|
||||
String rsrc = name.replace('.', '/') + ".properties";
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
InputStream in = loader.getResourceAsStream(rsrc);
|
||||
|
|
|
@ -40,7 +40,7 @@ class ZipResourceBundleProvider implements ResourceBundleProvider {
|
|||
ClassLoader loader) {
|
||||
String rsrc = name.replace('.', '/') + ".properties";
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
InputStream in = loader.getResourceAsStream(rsrc);
|
||||
|
|
|
@ -1308,7 +1308,7 @@ public class AnnotationPersistenceMappingParser
|
|||
|
||||
if (xmlTypeClass != null
|
||||
&& StringUtils.isEmpty(pcols[i].columnDefinition())
|
||||
&& ((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
&& (AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(fm.getDeclaredType(),
|
||||
xmlTypeClass))).booleanValue()) {
|
||||
DBDictionary dict = ((MappingRepository) getRepository())
|
||||
|
|
|
@ -43,7 +43,7 @@ public class TestEnhancementWithMultiplePUs
|
|||
OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
|
||||
Configurations.populateConfiguration(conf, new Options());
|
||||
MetaDataRepository repos = conf.getMetaDataRepositoryInstance();
|
||||
ClassLoader loader = (ClassLoader) AccessController
|
||||
ClassLoader loader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newTemporaryClassLoaderAction(
|
||||
getClass().getClassLoader()));
|
||||
Project project = new Project();
|
||||
|
@ -76,7 +76,7 @@ public class TestEnhancementWithMultiplePUs
|
|||
"META-INF/persistence.xml#second-persistence-unit");
|
||||
Configurations.populateConfiguration(conf, opts);
|
||||
MetaDataRepository repos = conf.getMetaDataRepositoryInstance();
|
||||
ClassLoader loader = (ClassLoader) AccessController
|
||||
ClassLoader loader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newTemporaryClassLoaderAction(
|
||||
getClass().getClassLoader()));
|
||||
Project project = new Project();
|
||||
|
@ -115,7 +115,7 @@ public class TestEnhancementWithMultiplePUs
|
|||
opts.setProperty("p", "META-INF/persistence.xml");
|
||||
Configurations.populateConfiguration(conf, opts);
|
||||
MetaDataRepository repos = conf.getMetaDataRepositoryInstance();
|
||||
ClassLoader loader = (ClassLoader) AccessController
|
||||
ClassLoader loader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newTemporaryClassLoaderAction(
|
||||
getClass().getClassLoader()));
|
||||
Project project = new Project();
|
||||
|
|
|
@ -467,12 +467,12 @@ public class AnnotationPersistenceMetaDataParser
|
|||
// check immediately whether the user is using any annotations,
|
||||
// regardless of mode. this prevents adding non-entity classes to
|
||||
// repository if we're ignoring these annotations in mapping mode
|
||||
if (!((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if (!(AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(_cls, Entity.class))).booleanValue()
|
||||
&& !((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
&& !(AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(_cls, Embeddable.class)))
|
||||
.booleanValue()
|
||||
&& !((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
&& !(AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(_cls, MappedSuperclass.class)))
|
||||
.booleanValue())
|
||||
return null;
|
||||
|
@ -678,17 +678,17 @@ public class AnnotationPersistenceMetaDataParser
|
|||
cls = cls.getEnclosingClass();
|
||||
|
||||
String rsrc = StringUtils.replace(cls.getName(), ".", "/");
|
||||
ClassLoader loader = (ClassLoader) AccessController.doPrivileged(
|
||||
ClassLoader loader = AccessController.doPrivileged(
|
||||
J2DoPriv5Helper.getClassLoaderAction(cls));
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPriv5Helper.getSystemClassLoaderAction());
|
||||
if (loader == null)
|
||||
return null;
|
||||
URL url = (URL) AccessController.doPrivileged(
|
||||
URL url = AccessController.doPrivileged(
|
||||
J2DoPriv5Helper.getResourceAction(loader, rsrc + ".java"));
|
||||
if (url == null) {
|
||||
url = (URL) AccessController.doPrivileged(
|
||||
url = AccessController.doPrivileged(
|
||||
J2DoPriv5Helper.getResourceAction(loader, rsrc + ".class"));
|
||||
if (url == null)
|
||||
return null;
|
||||
|
@ -782,7 +782,7 @@ public class AnnotationPersistenceMetaDataParser
|
|||
J2DoPriv5Helper.getDeclaredFieldsAction(
|
||||
meta.getDescribedType()));
|
||||
for (int i = 0; i < fields.length; i++)
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(fields[i], DetachedState.class)))
|
||||
.booleanValue())
|
||||
meta.setDetachedState(fields[i].getName());
|
||||
|
@ -984,7 +984,7 @@ public class AnnotationPersistenceMetaDataParser
|
|||
fmd.setExplicit(true);
|
||||
|
||||
AnnotatedElement el = (AnnotatedElement) member;
|
||||
boolean lob = ((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
boolean lob = (AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(el, Lob.class))).booleanValue();
|
||||
if (isMetaDataMode()) {
|
||||
switch (pstrat) {
|
||||
|
|
|
@ -1198,7 +1198,7 @@ public class AnnotationPersistenceMetaDataSerializer
|
|||
|
||||
public void serialize(File file, int flags) throws IOException {
|
||||
try {
|
||||
FileWriter out = new FileWriter((String) AccessController
|
||||
FileWriter out = new FileWriter(AccessController
|
||||
.doPrivileged(J2DoPrivHelper.getCanonicalPathAction(file)),
|
||||
(flags & APPEND) > 0);
|
||||
serialize(out, flags);
|
||||
|
|
|
@ -173,9 +173,9 @@ public class AnnotationPersistenceXMLMetaDataParser {
|
|||
private XMLMetaData parseXMLClassAnnotations() {
|
||||
// check immediately whether the class has JAXB XML annotations
|
||||
if (_cls == null || xmlTypeClass == null
|
||||
|| !(((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
|| !((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(_cls, xmlTypeClass))).booleanValue()
|
||||
&& ((Boolean) AccessController
|
||||
&& (AccessController
|
||||
.doPrivileged(J2DoPriv5Helper.isAnnotationPresentAction(_cls,
|
||||
xmlRootElementClass))).booleanValue()))
|
||||
return null;
|
||||
|
@ -225,7 +225,7 @@ public class AnnotationPersistenceXMLMetaDataParser {
|
|||
Class superclass = cls.getSuperclass();
|
||||
|
||||
// handle inheritance at sub-element level
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(superclass, xmlTypeClass)))
|
||||
.booleanValue())
|
||||
populateFromReflection(superclass, meta);
|
||||
|
@ -247,7 +247,7 @@ public class AnnotationPersistenceXMLMetaDataParser {
|
|||
// avoid JAXB XML bind default name
|
||||
if (StringUtils.equals(XMLMetaData.defaultName, xmlname))
|
||||
xmlname = member.getName();
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(((Field) member).getType(),
|
||||
xmlTypeClass))).booleanValue()) {
|
||||
field = _repos.addXMLMetaData(((Field) member).getType()
|
||||
|
|
|
@ -118,7 +118,7 @@ public class PersistenceMetaDataDefaults
|
|||
if (member == null)
|
||||
return null;
|
||||
AnnotatedElement el = (AnnotatedElement) member;
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(el, Transient.class))).booleanValue())
|
||||
return TRANSIENT;
|
||||
if (fmd != null
|
||||
|
@ -185,7 +185,7 @@ public class PersistenceMetaDataDefaults
|
|||
}
|
||||
|
||||
//### EJB3: what if defined in XML?
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(type, Embeddable.class))).booleanValue())
|
||||
return EMBEDDED;
|
||||
if (Serializable.class.isAssignableFrom(type))
|
||||
|
@ -312,7 +312,7 @@ public class PersistenceMetaDataDefaults
|
|||
if (member instanceof Method) {
|
||||
try {
|
||||
// check for setters for methods
|
||||
Method setter = (Method) AccessController.doPrivileged(
|
||||
Method setter = AccessController.doPrivileged(
|
||||
J2DoPriv5Helper.getDeclaredMethodAction(
|
||||
meta.getDescribedType(), "set" +
|
||||
StringUtils.capitalize(name), new Class[] {
|
||||
|
@ -337,7 +337,7 @@ public class PersistenceMetaDataDefaults
|
|||
|
||||
private boolean isAnnotatedTransient(Member member) {
|
||||
return member instanceof AnnotatedElement
|
||||
&& ((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
&& (AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(((AnnotatedElement) member),
|
||||
Transient.class))).booleanValue();
|
||||
}
|
||||
|
|
|
@ -293,24 +293,24 @@ public class PersistenceMetaDataFactory
|
|||
return null;
|
||||
Collection classes = repos.loadPersistentTypes(false, loader);
|
||||
for (Class cls : (Collection<Class>) classes) {
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(cls, NamedQuery.class)))
|
||||
.booleanValue() && hasNamedQuery
|
||||
(queryName, (NamedQuery) cls.getAnnotation(NamedQuery.class)))
|
||||
return cls;
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(cls, NamedQueries.class)))
|
||||
.booleanValue() &&
|
||||
hasNamedQuery(queryName, ((NamedQueries) cls.
|
||||
getAnnotation(NamedQueries.class)).value()))
|
||||
return cls;
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(cls, NamedNativeQuery.class)))
|
||||
.booleanValue() &&
|
||||
hasNamedNativeQuery(queryName, (NamedNativeQuery) cls.
|
||||
getAnnotation(NamedNativeQuery.class)))
|
||||
return cls;
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(cls, NamedNativeQueries.class)))
|
||||
.booleanValue() &&
|
||||
hasNamedNativeQuery(queryName, ((NamedNativeQueries) cls.
|
||||
|
@ -329,14 +329,14 @@ public class PersistenceMetaDataFactory
|
|||
Collection classes = repos.loadPersistentTypes(false, loader);
|
||||
for (Class cls : (Collection<Class>) classes) {
|
||||
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(cls, SqlResultSetMapping.class)))
|
||||
.booleanValue() &&
|
||||
hasRSMapping(rsMappingName, (SqlResultSetMapping) cls.
|
||||
getAnnotation(SqlResultSetMapping.class)))
|
||||
return cls;
|
||||
|
||||
if (((Boolean) AccessController.doPrivileged(J2DoPriv5Helper
|
||||
if ((AccessController.doPrivileged(J2DoPriv5Helper
|
||||
.isAnnotationPresentAction(cls, SqlResultSetMappings.class)))
|
||||
.booleanValue() &&
|
||||
hasRSMapping(rsMappingName, ((SqlResultSetMappings) cls.
|
||||
|
@ -457,11 +457,11 @@ public class PersistenceMetaDataFactory
|
|||
private File defaultXMLFile() {
|
||||
ClassLoader loader = repos.getConfiguration().
|
||||
getClassResolverInstance().getClassLoader(getClass(), null);
|
||||
URL rsrc = (URL) AccessController.doPrivileged(
|
||||
URL rsrc = AccessController.doPrivileged(
|
||||
J2DoPriv5Helper.getResourceAction(loader, "META-INF/orm.xml"));
|
||||
if (rsrc != null) {
|
||||
File file = new File(rsrc.getFile());
|
||||
if (((Boolean) AccessController.doPrivileged(
|
||||
if ((AccessController.doPrivileged(
|
||||
J2DoPriv5Helper.existsAction(file))).booleanValue())
|
||||
return file;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ public class PersistenceProductDerivation
|
|||
public List getAnchorsInResource(String resource) throws Exception {
|
||||
ConfigurationParser parser = new ConfigurationParser(null);
|
||||
try {
|
||||
ClassLoader loader = (ClassLoader) AccessController.doPrivileged(
|
||||
ClassLoader loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
List<URL> urls = getResourceURLs(resource, loader);
|
||||
if (urls != null) {
|
||||
|
@ -249,7 +249,7 @@ public class PersistenceProductDerivation
|
|||
String[] prefixes = ProductDerivations.getConfigurationPrefixes();
|
||||
String rsrc = null;
|
||||
for (int i = 0; i < prefixes.length && StringUtils.isEmpty(rsrc); i++)
|
||||
rsrc = (String) AccessController.doPrivileged(J2DoPrivHelper
|
||||
rsrc = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.getPropertyAction(prefixes[i] + ".properties"));
|
||||
boolean explicit = !StringUtils.isEmpty(rsrc);
|
||||
String anchor = null;
|
||||
|
@ -284,11 +284,11 @@ public class PersistenceProductDerivation
|
|||
throws IOException {
|
||||
Enumeration<URL> urls = null;
|
||||
try {
|
||||
urls = (Enumeration) AccessController.doPrivileged(
|
||||
urls = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourcesAction(loader, rsrc));
|
||||
if (!urls.hasMoreElements()) {
|
||||
if (!rsrc.startsWith("META-INF"))
|
||||
urls = (Enumeration) AccessController.doPrivileged(
|
||||
urls = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourcesAction(
|
||||
loader, "META-INF/" + rsrc));
|
||||
if (!urls.hasMoreElements())
|
||||
|
@ -315,7 +315,7 @@ public class PersistenceProductDerivation
|
|||
String name, Map m, ClassLoader loader, boolean explicit)
|
||||
throws IOException {
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
|
||||
List<URL> urls = getResourceURLs(rsrc, loader);
|
||||
|
@ -401,7 +401,7 @@ public class PersistenceProductDerivation
|
|||
return true;
|
||||
|
||||
if (loader == null)
|
||||
loader = (ClassLoader) AccessController.doPrivileged(
|
||||
loader = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getContextClassLoaderAction());
|
||||
try {
|
||||
if (PersistenceProviderImpl.class.isAssignableFrom
|
||||
|
@ -513,7 +513,7 @@ public class PersistenceProductDerivation
|
|||
public void parse(File file)
|
||||
throws IOException {
|
||||
try {
|
||||
_source = (URL) AccessController.doPrivileged(J2DoPrivHelper
|
||||
_source = AccessController.doPrivileged(J2DoPrivHelper
|
||||
.toURLAction(file));
|
||||
} catch (PrivilegedActionException pae) {
|
||||
throw (MalformedURLException) pae.getException();
|
||||
|
|
|
@ -95,8 +95,8 @@ public class PersistenceUnitInfoImpl
|
|||
}
|
||||
|
||||
public ClassLoader getNewTempClassLoader() {
|
||||
return (ClassLoader) AccessController.doPrivileged(J2DoPrivHelper
|
||||
.newTemporaryClassLoaderAction((ClassLoader) AccessController
|
||||
return AccessController.doPrivileged(J2DoPrivHelper
|
||||
.newTemporaryClassLoaderAction(AccessController
|
||||
.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction())));
|
||||
}
|
||||
|
||||
|
@ -203,11 +203,11 @@ public class PersistenceUnitInfoImpl
|
|||
}
|
||||
|
||||
public void addJarFileName(String name) {
|
||||
MultiClassLoader loader = (MultiClassLoader) AccessController
|
||||
MultiClassLoader loader = AccessController
|
||||
.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
|
||||
loader.addClassLoader(getClass().getClassLoader());
|
||||
loader.addClassLoader(MultiClassLoader.THREAD_LOADER);
|
||||
URL url = (URL) AccessController.doPrivileged(
|
||||
URL url = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getResourceAction(loader, name));
|
||||
if (url != null) {
|
||||
addJarFile(url);
|
||||
|
@ -215,14 +215,14 @@ public class PersistenceUnitInfoImpl
|
|||
}
|
||||
|
||||
// jar file is not a resource; check classpath
|
||||
String[] cp = ((String) AccessController.doPrivileged(
|
||||
String[] cp = (AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getPropertyAction("java.class.path")))
|
||||
.split(J2DoPrivHelper.getPathSeparator());
|
||||
for (int i = 0; i < cp.length; i++) {
|
||||
if (cp[i].equals(name)
|
||||
|| cp[i].endsWith(File.separatorChar + name)) {
|
||||
try {
|
||||
addJarFile((URL) AccessController
|
||||
addJarFile(AccessController
|
||||
.doPrivileged(J2DoPrivHelper
|
||||
.toURLAction(new File(cp[i]))));
|
||||
return;
|
||||
|
|
|
@ -1105,13 +1105,13 @@ public class XMLPersistenceMetaDataParser
|
|||
String cap = StringUtils.capitalize(name);
|
||||
type = meta.getDescribedType();
|
||||
try {
|
||||
member = (Method) AccessController.doPrivileged(
|
||||
member = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
type, "get" + cap,
|
||||
(Class[]) null));// varargs disambiguate
|
||||
} catch (Exception excep) {
|
||||
try {
|
||||
member = (Method) AccessController.doPrivileged(
|
||||
member = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredMethodAction(
|
||||
type, "is" + cap, (Class[]) null));
|
||||
} catch (Exception excep2) {
|
||||
|
@ -1120,7 +1120,7 @@ public class XMLPersistenceMetaDataParser
|
|||
}
|
||||
type = ((Method) member).getReturnType();
|
||||
} else {
|
||||
member = (Field) AccessController.doPrivileged(
|
||||
member = AccessController.doPrivileged(
|
||||
J2DoPrivHelper.getDeclaredFieldAction(
|
||||
meta.getDescribedType(), name));
|
||||
type = ((Field) member).getType();
|
||||
|
|
|
@ -80,9 +80,9 @@ public class XMLFileHandler {
|
|||
*/
|
||||
public Collection load(ClassMetaData meta) {
|
||||
File f = getFile(meta);
|
||||
if (!((Boolean) AccessController.doPrivileged(
|
||||
if (!(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(f))).booleanValue() ||
|
||||
((Long) AccessController.doPrivileged(
|
||||
(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.lengthAction(f))).longValue() == 0)
|
||||
return Collections.EMPTY_SET;
|
||||
try {
|
||||
|
@ -133,7 +133,7 @@ public class XMLFileHandler {
|
|||
throw new InternalException();
|
||||
|
||||
File f = getFile(meta);
|
||||
if (!((Boolean) AccessController.doPrivileged(
|
||||
if (!(AccessController.doPrivileged(
|
||||
J2DoPrivHelper.existsAction(f.getParentFile()))).booleanValue())
|
||||
AccessController.doPrivileged(
|
||||
J2DoPrivHelper.mkdirsAction(f.getParentFile()));
|
||||
|
|
Loading…
Reference in New Issue