OPENJPA-244 Fixed some formatting inconsistencies with the patch for OPENJPA-244

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@553010 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Marc Prud'hommeaux 2007-07-03 22:42:39 +00:00
parent 0c517d163e
commit 8b5a7f68a0
99 changed files with 934 additions and 931 deletions

View File

@ -64,7 +64,7 @@ public class Main {
// Go through each of the entities and print out each of their // Go through each of the entities and print out each of their
// messages, as well as the date on which it was created // messages, as well as the date on which it was created
for (Message m : (List<Message>)q.getResultList()) { for (Message m : (List<Message>) q.getResultList()) {
System.out.println(m.getMessage() System.out.println(m.getMessage()
+ " (created on: " + m.getCreated() + ")"); + " (created on: " + m.getCreated() + ")");
} }

View File

@ -135,33 +135,33 @@ public class Main {
// Go through each of the entities and print out each of their // Go through each of the entities and print out each of their
// messages, as well as the date on which it was created // messages, as well as the date on which it was created
for (Deity m : (List<Deity>)q.getResultList()) { for (Deity m : (List<Deity>) q.getResultList()) {
System.out.println(m.getName()); System.out.println(m.getName());
} }
q = em.createQuery("select x from Deity x " q = em.createQuery("select x from Deity x "
+ "where x.father.name = 'Zeus'"); + "where x.father.name = 'Zeus'");
for (Deity m : (List<Deity>)q.getResultList()) { for (Deity m : (List<Deity>) q.getResultList()) {
System.out.println("Child of Zeus: " + m.getName()); System.out.println("Child of Zeus: " + m.getName());
} }
q = em.createNamedQuery("siblings"). q = em.createNamedQuery("siblings").
setParameter(1, em.getReference(Deity.class, "Rhea")); setParameter(1, em.getReference(Deity.class, "Rhea"));
for (Deity m : (List<Deity>)em.createNamedQuery("siblings"). for (Deity m : (List<Deity>) em.createNamedQuery("siblings").
setParameter(1, em.getReference(Deity.class, "Rhea")). setParameter(1, em.getReference(Deity.class, "Rhea")).
getResultList()) { getResultList()) {
System.out.println("Siblings of Rhea: " + m.getName()); System.out.println("Siblings of Rhea: " + m.getName());
} }
for (Deity m : (List<Deity>)em.createNamedQuery("half-siblings"). for (Deity m : (List<Deity>) em.createNamedQuery("half-siblings").
setParameter(1, em.getReference(Deity.class, "Apollo")). setParameter(1, em.getReference(Deity.class, "Apollo")).
getResultList()) { getResultList()) {
System.out.println("Half-siblings of Apollo: " + m.getName()); System.out.println("Half-siblings of Apollo: " + m.getName());
} }
for (Deity m : (List<Deity>)em.createNamedQuery("cousins"). for (Deity m : (List<Deity>) em.createNamedQuery("cousins").
setParameter(1, em.getReference(Deity.class, "Leto")). setParameter(1, em.getReference(Deity.class, "Leto")).
getResultList()) { getResultList()) {
System.out.println("Cousins of Leto: " + m.getName()); System.out.println("Cousins of Leto: " + m.getName());

View File

@ -73,7 +73,7 @@ public class XMLValueHandler
m.marshal( val, result ); m.marshal( val, result );
return result.toString(); return result.toString();
} }
catch(JAXBException je) { catch (JAXBException je) {
throw new InternalException(je); throw new InternalException(je);
} }
} }
@ -89,7 +89,7 @@ public class XMLValueHandler
return u.unmarshal(new StreamSource(new StringReader return u.unmarshal(new StreamSource(new StringReader
(val.toString()))); (val.toString())));
} }
catch(JAXBException je) { catch (JAXBException je) {
throw new InternalException(je); throw new InternalException(je);
} }
} }

View File

@ -186,7 +186,7 @@ public class MappingToolTask
MultiLoaderClassResolver resolver = new MultiLoaderClassResolver(); MultiLoaderClassResolver resolver = new MultiLoaderClassResolver();
resolver.addClassLoader(loader); resolver.addClassLoader(loader);
resolver.addClassLoader((ClassLoader)AccessController.doPrivileged( resolver.addClassLoader((ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(MappingTool.class))); J2DoPrivHelper.getClassLoaderAction(MappingTool.class)));
JDBCConfiguration conf = (JDBCConfiguration) getConfiguration(); JDBCConfiguration conf = (JDBCConfiguration) getConfiguration();
conf.setClassResolver(resolver); conf.setClassResolver(resolver);

View File

@ -262,14 +262,14 @@ public class ReverseMappingToolTask
// load customizer properties // load customizer properties
Properties customProps = new Properties(); Properties customProps = new Properties();
File propsFile = Files.getFile(customizerProperties, loader); File propsFile = Files.getFile(customizerProperties, loader);
if (propsFile != null && ((Boolean)AccessController.doPrivileged( if (propsFile != null && ((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( propsFile ))).booleanValue() ) { J2DoPrivHelper.existsAction(propsFile))).booleanValue()) {
FileInputStream fis = null; FileInputStream fis = null;
try { try {
fis = (FileInputStream) AccessController.doPrivileged( fis = (FileInputStream) AccessController.doPrivileged(
J2DoPrivHelper.newFileInputStreamAction(propsFile)); J2DoPrivHelper.newFileInputStreamAction(propsFile));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (FileNotFoundException)pae.getException(); throw (FileNotFoundException) pae.getException();
} }
customProps.load(fis); customProps.load(fis);
} }
@ -278,7 +278,7 @@ public class ReverseMappingToolTask
JDBCConfiguration conf = (JDBCConfiguration) getConfiguration(); JDBCConfiguration conf = (JDBCConfiguration) getConfiguration();
flags.customizer = (ReverseCustomizer) Configurations. flags.customizer = (ReverseCustomizer) Configurations.
newInstance(customizerClass, conf, null, newInstance(customizerClass, conf, null,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction( J2DoPrivHelper.getClassLoaderAction(
ReverseCustomizer.class))); ReverseCustomizer.class)));
if (flags.customizer != null) if (flags.customizer != null)

View File

@ -48,14 +48,14 @@ public class MappingRepositoryValue
// we need to manually perform the instantiation // we need to manually perform the instantiation
try { try {
Class cls = Strings.toClass(clsName, Class cls = Strings.toClass(clsName,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(type))); J2DoPrivHelper.getClassLoaderAction(type)));
return cls.getConstructor(new Class[]{ JDBCConfiguration.class }). return cls.getConstructor(new Class[]{ JDBCConfiguration.class }).
newInstance(new Object[]{ conf }); newInstance(new Object[]{ conf });
} catch (RuntimeException e) { } catch (RuntimeException e) {
throw e; throw e;
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
if (e.getTargetException()instanceof RuntimeException) if (e.getTargetException() instanceof RuntimeException)
throw(RuntimeException) e.getTargetException(); throw(RuntimeException) e.getTargetException();
// fall back to default behavior for better error reporting // fall back to default behavior for better error reporting

View File

@ -252,7 +252,7 @@ public class JDBCStoreManager
FetchConfiguration fetch, Object context) { FetchConfiguration fetch, Object context) {
ConnectionInfo info = (ConnectionInfo) context; ConnectionInfo info = (ConnectionInfo) context;
try { try {
return initializeState(sm, state, (JDBCFetchConfiguration)fetch, return initializeState(sm, state, (JDBCFetchConfiguration) fetch,
info); info);
} catch (ClassNotFoundException cnfe) { } catch (ClassNotFoundException cnfe) {
throw new UserException(cnfe); throw new UserException(cnfe);

View File

@ -127,7 +127,8 @@ class ConstPath
action = itr.next(); action = itr.next();
if (action instanceof Class) { if (action instanceof Class) {
try { try {
cstate.value = Filters.convert(cstate.value, (Class)action); cstate.value = Filters.convert(cstate.value,
(Class) action);
continue; continue;
} catch (ClassCastException cce) { } catch (ClassCastException cce) {
failed = true; failed = true;

View File

@ -361,7 +361,7 @@ public class ClassMappingInfo
Table table = cm.getTable(); Table table = cm.getTable();
Collection result = new ArrayList(); Collection result = new ArrayList();
while (uniqueConstraints.hasNext()) { while (uniqueConstraints.hasNext()) {
Unique template = (Unique)uniqueConstraints.next(); Unique template = (Unique) uniqueConstraints.next();
Column[] templateColumns = template.getColumns(); Column[] templateColumns = template.getColumns();
Column[] uniqueColumns = new Column[templateColumns.length]; Column[] uniqueColumns = new Column[templateColumns.length];
boolean missingColumn = true; boolean missingColumn = true;
@ -380,7 +380,7 @@ public class ClassMappingInfo
if (unique != null) if (unique != null)
result.add(unique); result.add(unique);
} }
return (Unique[])result.toArray(new Unique[result.size()]); return (Unique[]) result.toArray(new Unique[result.size()]);
} }
public File getSourceFile() { public File getSourceFile() {

View File

@ -123,7 +123,7 @@ public class DiscriminatorMappingInfo
// set io before syncing cols // set io before syncing cols
setColumnIO(disc.getColumnIO()); setColumnIO(disc.getColumnIO());
syncColumns(disc, disc.getColumns(), disc.getValue() != null syncColumns(disc, disc.getColumns(), disc.getValue() != null
&& !(disc.getValue()instanceof String)); && !(disc.getValue() instanceof String));
syncIndex(disc, disc.getIndex()); syncIndex(disc, disc.getIndex());
if (disc.getValue() == Discriminator.NULL) if (disc.getValue() == Discriminator.NULL)
_value = "null"; _value = "null";
@ -131,7 +131,7 @@ public class DiscriminatorMappingInfo
_value = disc.getValue().toString(); _value = disc.getValue().toString();
if (disc.getStrategy() == null if (disc.getStrategy() == null
|| disc.getStrategy()instanceof SuperclassDiscriminatorStrategy) || disc.getStrategy() instanceof SuperclassDiscriminatorStrategy)
return; return;
// explicit discriminator strategy if: // explicit discriminator strategy if:

View File

@ -449,18 +449,18 @@ public class MappingRepository
try { try {
if (strat == null) if (strat == null)
strat = JavaTypes.classForName(name, cls, strat = JavaTypes.classForName(name, cls,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction( J2DoPrivHelper.getClassLoaderAction(
ClassStrategy.class))); ClassStrategy.class)));
ClassStrategy strategy = ClassStrategy strategy =
(ClassStrategy)AccessController.doPrivileged( (ClassStrategy) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(strat)); J2DoPrivHelper.newInstanceAction(strat));
Configurations.configureInstance(strategy, getConfiguration(), Configurations.configureInstance(strategy, getConfiguration(),
props); props);
return strategy; return strategy;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
throw new MetaDataException(_loc.get("bad-cls-strategy", throw new MetaDataException(_loc.get("bad-cls-strategy",
cls, name), e); cls, name), e);
} }
@ -483,7 +483,7 @@ public class MappingRepository
name = Configurations.getClassName(name); name = Configurations.getClassName(name);
try { try {
Class c = JavaTypes.classForName(name, field, Class c = JavaTypes.classForName(name, field,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(FieldStrategy.class))); J2DoPrivHelper.getClassLoaderAction(FieldStrategy.class)));
if (FieldStrategy.class.isAssignableFrom(c)) { if (FieldStrategy.class.isAssignableFrom(c)) {
FieldStrategy strat = (FieldStrategy) FieldStrategy strat = (FieldStrategy)
@ -496,7 +496,7 @@ public class MappingRepository
// must be named handler // must be named handler
if (installHandlers) { if (installHandlers) {
ValueHandler vh = (ValueHandler)AccessController.doPrivileged( ValueHandler vh = (ValueHandler) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(c)); J2DoPrivHelper.newInstanceAction(c));
Configurations.configureInstance(vh, getConfiguration(), Configurations.configureInstance(vh, getConfiguration(),
props); props);
@ -505,7 +505,7 @@ public class MappingRepository
return new HandlerFieldStrategy(); return new HandlerFieldStrategy();
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException )e).getException(); e = ((PrivilegedActionException) e).getException();
throw new MetaDataException(_loc.get("bad-field-strategy", throw new MetaDataException(_loc.get("bad-field-strategy",
field, name), e); field, name), e);
} }
@ -556,7 +556,7 @@ public class MappingRepository
if (strat == null) if (strat == null)
strat = JavaTypes.classForName(name, strat = JavaTypes.classForName(name,
discrim.getClassMapping(), discrim.getClassMapping(),
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction( J2DoPrivHelper.getClassLoaderAction(
DiscriminatorStrategy.class))); DiscriminatorStrategy.class)));
DiscriminatorStrategy strategy = (DiscriminatorStrategy) DiscriminatorStrategy strategy = (DiscriminatorStrategy)
@ -567,7 +567,7 @@ public class MappingRepository
return strategy; return strategy;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException )e).getException(); e = ((PrivilegedActionException) e).getException();
throw new MetaDataException(_loc.get("bad-discrim-strategy", throw new MetaDataException(_loc.get("bad-discrim-strategy",
discrim.getClassMapping(), name), e); discrim.getClassMapping(), name), e);
} }
@ -618,7 +618,7 @@ public class MappingRepository
if (strat == null) if (strat == null)
strat = JavaTypes.classForName(name, strat = JavaTypes.classForName(name,
version.getClassMapping(), version.getClassMapping(),
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction( J2DoPrivHelper.getClassLoaderAction(
VersionStrategy.class))); VersionStrategy.class)));
} catch (Exception e) { } catch (Exception e) {
@ -643,7 +643,7 @@ public class MappingRepository
return strategy; return strategy;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException )e).getException(); e = ((PrivilegedActionException) e).getException();
throw new MetaDataException(_loc.get("bad-version-strategy", throw new MetaDataException(_loc.get("bad-version-strategy",
version.getClassMapping(), strat + ""), e); version.getClassMapping(), strat + ""), e);
} }
@ -941,7 +941,7 @@ public class MappingRepository
name = Configurations.getClassName(name); name = Configurations.getClassName(name);
try { try {
Class c = JavaTypes.classForName(name, val, Class c = JavaTypes.classForName(name, val,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(FieldStrategy.class))); J2DoPrivHelper.getClassLoaderAction(FieldStrategy.class)));
Object o = AccessController.doPrivileged( Object o = AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(c)); J2DoPrivHelper.newInstanceAction(c));
@ -949,7 +949,7 @@ public class MappingRepository
return o; return o;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException )e).getException(); e = ((PrivilegedActionException) e).getException();
throw new MetaDataException(_loc.get("bad-mapped-strategy", throw new MetaDataException(_loc.get("bad-mapped-strategy",
val, name), e); val, name), e);
} }
@ -968,10 +968,10 @@ public class MappingRepository
name = Configurations.getClassName(name); name = Configurations.getClassName(name);
try { try {
Class c = JavaTypes.classForName(name, val, Class c = JavaTypes.classForName(name, val,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(ValueHandler.class))); J2DoPrivHelper.getClassLoaderAction(ValueHandler.class)));
if (ValueHandler.class.isAssignableFrom(c)) { if (ValueHandler.class.isAssignableFrom(c)) {
ValueHandler vh = (ValueHandler)AccessController.doPrivileged( ValueHandler vh = (ValueHandler) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(c)); J2DoPrivHelper.newInstanceAction(c));
Configurations.configureInstance(vh, getConfiguration(), Configurations.configureInstance(vh, getConfiguration(),
props); props);
@ -980,7 +980,7 @@ public class MappingRepository
return null; // named field strategy return null; // named field strategy
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException )e).getException(); e = ((PrivilegedActionException) e).getException();
throw new MetaDataException(_loc.get("bad-value-handler", throw new MetaDataException(_loc.get("bad-value-handler",
val, name), e); val, name), e);
} }

View File

@ -1078,12 +1078,12 @@ public class MappingTool
Class[] types = Services.getImplementorClasses(ImportExport.class); Class[] types = Services.getImplementorClasses(ImportExport.class);
ImportExport[] instances = new ImportExport[types.length]; ImportExport[] instances = new ImportExport[types.length];
for (int i = 0; i < types.length; i++) for (int i = 0; i < types.length; i++)
instances[i] = (ImportExport)AccessController.doPrivileged( instances[i] = (ImportExport) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(types[i])); J2DoPrivHelper.newInstanceAction(types[i]));
return instances; return instances;
} catch (Throwable t) { } catch (Throwable t) {
if (t instanceof PrivilegedActionException) if (t instanceof PrivilegedActionException)
t = ((PrivilegedActionException)t).getException(); t = ((PrivilegedActionException) t).getException();
throw new InternalException(_loc.get("importexport-instantiate"),t); throw new InternalException(_loc.get("importexport-instantiate"),t);
} }
} }

View File

@ -1895,14 +1895,14 @@ public class ReverseMappingTool
File customFile = Files.getFile File customFile = Files.getFile
(opts.removeProperty("customizerProperties", "cp", null), null); (opts.removeProperty("customizerProperties", "cp", null), null);
Properties customProps = new Properties(); Properties customProps = new Properties();
if (customFile != null && ((Boolean)AccessController.doPrivileged( if (customFile != null && ((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( customFile ))).booleanValue()) { J2DoPrivHelper.existsAction(customFile))).booleanValue()) {
FileInputStream fis = null; FileInputStream fis = null;
try { try {
fis = (FileInputStream) AccessController.doPrivileged( fis = (FileInputStream) AccessController.doPrivileged(
J2DoPrivHelper.newFileInputStreamAction(customFile)); J2DoPrivHelper.newFileInputStreamAction(customFile));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (FileNotFoundException)pae.getException(); throw (FileNotFoundException) pae.getException();
} }
customProps.load(fis); customProps.load(fis);
} }

View File

@ -73,7 +73,7 @@ public class VersionMappingInfo
syncIndex(version, version.getIndex()); syncIndex(version, version.getIndex());
if (version.getStrategy() == null if (version.getStrategy() == null
|| version.getStrategy()instanceof SuperclassVersionStrategy) || version.getStrategy() instanceof SuperclassVersionStrategy)
return; return;
// explicit version strategy if: // explicit version strategy if:

View File

@ -60,7 +60,7 @@ public abstract class EmbedValueHandler
for (int i = 0; i < fms.length; i++) { for (int i = 0; i < fms.length; i++) {
if (fms[i].getManagement() != FieldMapping.MANAGE_PERSISTENT) if (fms[i].getManagement() != FieldMapping.MANAGE_PERSISTENT)
continue; continue;
if (!(fms[i].getStrategy()instanceof Embeddable)) if (!(fms[i].getStrategy() instanceof Embeddable))
throw new MetaDataException(_loc.get("not-embeddable", throw new MetaDataException(_loc.get("not-embeddable",
vm, fms[i])); vm, fms[i]));

View File

@ -112,7 +112,7 @@ public class DataSourceFactory {
// see if their driver name is actually a data source // see if their driver name is actually a data source
if (DataSource.class.isAssignableFrom(driverClass)) { if (DataSource.class.isAssignableFrom(driverClass)) {
return (DataSource) Configurations.newInstance(driver, return (DataSource) Configurations.newInstance(driver,
conf, props, (ClassLoader)AccessController.doPrivileged( conf, props, (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction( J2DoPrivHelper.getClassLoaderAction(
DataSource.class))); DataSource.class)));
} }
@ -156,7 +156,8 @@ public class DataSourceFactory {
// ask the DriverDataSource to provide any additional decorators // ask the DriverDataSource to provide any additional decorators
if (ds instanceof DriverDataSource) { if (ds instanceof DriverDataSource) {
List decs = ((DriverDataSource)ds).createConnectionDecorators(); List decs = ((DriverDataSource) ds).
createConnectionDecorators();
if (decs != null) if (decs != null)
decorators.addAll(decs); decorators.addAll(decs);
} }

View File

@ -79,7 +79,7 @@ public class FileSchemaFactory
} }
public SchemaGroup readSchema() { public SchemaGroup readSchema() {
URL url = (URL)AccessController.doPrivileged( URL url = (URL) AccessController.doPrivileged(
J2DoPrivHelper.getResourceAction(_loader, _fileName)); J2DoPrivHelper.getResourceAction(_loader, _fileName));
if (url == null) if (url == null)
return new SchemaGroup(); return new SchemaGroup();

View File

@ -171,14 +171,14 @@ public class SimpleDriverDataSource
try { try {
Class c = Class.forName(_connectionDriverName, Class c = Class.forName(_connectionDriverName,
true, _classLoader); true, _classLoader);
_driver = (Driver)AccessController.doPrivileged( _driver = (Driver) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(c)); J2DoPrivHelper.newInstanceAction(c));
return _driver; return _driver;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof RuntimeException) if (e instanceof RuntimeException)
throw(RuntimeException) e; throw(RuntimeException) e;
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
throw new StoreException(e); throw new StoreException(e);
} }
} }

View File

@ -476,7 +476,7 @@ public class DB2Dictionary
"[Errp=" + getSqlErrpMethd.invoke(sqlca, new Object[]{}) "[Errp=" + getSqlErrpMethd.invoke(sqlca, new Object[]{})
+ ", Errd=" + errdStr); + ", Errd=" + errdStr);
String Warn = new String((char[])getSqlWarnMethd. String Warn = new String((char[]) getSqlWarnMethd.
invoke(sqlca, new Object[]{})); invoke(sqlca, new Object[]{}));
if(Warn.trim().length() != 0) if(Warn.trim().length() != 0)
exceptionMsg = exceptionMsg.concat(", Warn=" +Warn + "]" ); exceptionMsg = exceptionMsg.concat(", Warn=" +Warn + "]" );

View File

@ -890,7 +890,7 @@ public class DBDictionary
else if (col != null && col.getType() == Types.TIME) else if (col != null && col.getType() == Types.TIME)
setTime(stmnt, idx, new Time(val.getTime()), null, col); setTime(stmnt, idx, new Time(val.getTime()), null, col);
else if (val instanceof Timestamp) else if (val instanceof Timestamp)
setTimestamp(stmnt, idx,(Timestamp)val, null, col); setTimestamp(stmnt, idx,(Timestamp) val, null, col);
else else
setTimestamp(stmnt, idx, new Timestamp(val.getTime()), null, col); setTimestamp(stmnt, idx, new Timestamp(val.getTime()), null, col);
} }

View File

@ -121,14 +121,14 @@ public class DBDictionaryFactory {
DBDictionary dict = null; DBDictionary dict = null;
try { try {
Class c = Class.forName(dclass, true, Class c = Class.forName(dclass, true,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction( J2DoPrivHelper.getClassLoaderAction(
DBDictionary.class))); DBDictionary.class)));
dict = (DBDictionary)AccessController.doPrivileged( dict = (DBDictionary) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(c)); J2DoPrivHelper.newInstanceAction(c));
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
throw new UserException(e).setFatal(true); throw new UserException(e).setFatal(true);
} }

View File

@ -223,7 +223,7 @@ public class HSQLDictionary
// HSQL has a bug where it cannot store a double if it is // HSQL has a bug where it cannot store a double if it is
// exactly the same as Long.MAX_VALUE or MIN_VALUE // exactly the same as Long.MAX_VALUE or MIN_VALUE
if (val == Long.MAX_VALUE || val == Long.MIN_VALUE) { if (val == Long.MAX_VALUE || val == Long.MIN_VALUE) {
stmnt.setLong(idx, (long)val); stmnt.setLong(idx, (long) val);
} else { } else {
super.setDouble(stmnt, idx, val, col); super.setDouble(stmnt, idx, val, col);
} }

View File

@ -1213,7 +1213,7 @@ public class SelectImpl
int count = 0; int count = 0;
for (int i = 0; i < toCols.length; i++, count++) { for (int i = 0; i < toCols.length; i++, count++) {
if (pks == null) if (pks == null)
val = (oid == null) ? null : Numbers.valueOf(((Id)oid).getId()); val = (oid == null) ? null : Numbers.valueOf(((Id) oid).getId());
else { else {
// must be app identity; use pk index to get correct pk value // must be app identity; use pk index to get correct pk value
join = mapping.assertJoinable(toCols[i]); join = mapping.assertJoinable(toCols[i]);
@ -2796,7 +2796,7 @@ public class SelectImpl
Object id = (ident && _idents != null) ? _idents.get(i) Object id = (ident && _idents != null) ? _idents.get(i)
: _ids.get(i); : _ids.get(i);
Object alias = _aliases.get(id); Object alias = _aliases.get(id);
if (id instanceof Column && ((Column)id).isXML()) if (id instanceof Column && ((Column) id).isXML())
alias = alias + _dict.getStringVal; alias = alias + _dict.getStringVal;
String as = null; String as = null;

View File

@ -57,7 +57,7 @@ public class PCEnhancerAgent {
conf.setConnectionFactoryName(null); conf.setConnectionFactoryName(null);
// set single class resolver // set single class resolver
final ClassLoader tmpLoader = new TemporaryClassLoader( final ClassLoader tmpLoader = new TemporaryClassLoader(
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction())); J2DoPrivHelper.getContextClassLoaderAction()));
conf.setClassResolver(new ClassResolver() { conf.setClassResolver(new ClassResolver() {
public ClassLoader getClassLoader(Class context, ClassLoader env) { public ClassLoader getClassLoader(Class context, ClassLoader env) {

View File

@ -133,7 +133,7 @@ public class AbstractStoreBrokerFactory
private static AbstractStoreManager createStoreManager(String cls, private static AbstractStoreManager createStoreManager(String cls,
String props) { String props) {
AbstractStoreManager store = (AbstractStoreManager) Configurations. AbstractStoreManager store = (AbstractStoreManager) Configurations.
newInstance(cls, (ClassLoader)AccessController.doPrivileged( newInstance(cls, (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction( J2DoPrivHelper.getClassLoaderAction(
AbstractStoreManager.class))); AbstractStoreManager.class)));
Configurations.configureInstance(store, null, props, Configurations.configureInstance(store, null, props,

View File

@ -113,7 +113,7 @@ public class OpenJPAVersion {
buf.append("java.class.path:\n"); buf.append("java.class.path:\n");
StringTokenizer tok = new StringTokenizer StringTokenizer tok = new StringTokenizer
((String)AccessController.doPrivileged( ((String) AccessController.doPrivileged(
J2DoPrivHelper.getPropertyAction("java.class.path")), J2DoPrivHelper.getPropertyAction("java.class.path")),
File.pathSeparator); File.pathSeparator);
while (tok.hasMoreTokens()) { while (tok.hasMoreTokens()) {
@ -138,7 +138,7 @@ public class OpenJPAVersion {
private StringBuffer appendProperty(String prop, StringBuffer buf) { private StringBuffer appendProperty(String prop, StringBuffer buf) {
return buf.append(prop).append(": ") return buf.append(prop).append(": ")
.append((String)AccessController.doPrivileged( .append((String) AccessController.doPrivileged(
J2DoPrivHelper.getPropertyAction(prop))); J2DoPrivHelper.getPropertyAction(prop)));
} }
} }

View File

@ -107,7 +107,7 @@ public class AutomaticManagedRuntime
try { try {
mr = new WASManagedRuntime(); mr = new WASManagedRuntime();
} }
catch(Throwable t) { catch (Throwable t) {
} }
WAS= (WASManagedRuntime) mr; WAS= (WASManagedRuntime) mr;
} }

View File

@ -1419,10 +1419,10 @@ public class ApplicationIdTool {
name = Strings.getPackageName(context) + "." + name; name = Strings.getPackageName(context) + "." + name;
// first try with regular class loader // first try with regular class loader
ClassLoader loader = (ClassLoader)AccessController.doPrivileged( ClassLoader loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(context)); J2DoPrivHelper.getClassLoaderAction(context));
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
try { try {
return Class.forName(name, false, loader); return Class.forName(name, false, loader);

View File

@ -97,7 +97,7 @@ public class DynamicStorageGenerator {
// the project/classloader for the classes. // the project/classloader for the classes.
private final Project _project = new Project(); private final Project _project = new Project();
private final BCClassLoader _loader = new BCClassLoader(_project, private final BCClassLoader _loader = new BCClassLoader(_project,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(DynamicStorage.class))); J2DoPrivHelper.getClassLoaderAction(DynamicStorage.class)));
/** /**

View File

@ -133,7 +133,7 @@ public class PCEnhancer {
static { static {
Class[] classes = Services.getImplementorClasses( Class[] classes = Services.getImplementorClasses(
AuxiliaryEnhancer.class, AuxiliaryEnhancer.class,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(AuxiliaryEnhancer.class))); J2DoPrivHelper.getClassLoaderAction(AuxiliaryEnhancer.class)));
List auxEnhancers = new ArrayList(classes.length); List auxEnhancers = new ArrayList(classes.length);
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
@ -484,7 +484,7 @@ public class PCEnhancer {
* Package-protected and static for testing. * Package-protected and static for testing.
*/ */
static BCField getReturnedField(BCMethod meth) { static BCField getReturnedField(BCMethod meth) {
return findField(meth, ((Code)AccessController.doPrivileged( return findField(meth, ((Code) AccessController.doPrivileged(
J2DoPrivHelper.newCodeAction())).xreturn() J2DoPrivHelper.newCodeAction())).xreturn()
.setType(meth.getReturnType()), false); .setType(meth.getReturnType()), false);
} }
@ -494,7 +494,7 @@ public class PCEnhancer {
* Package-protected and static for testing. * Package-protected and static for testing.
*/ */
static BCField getAssignedField(BCMethod meth) { static BCField getAssignedField(BCMethod meth) {
return findField(meth, ((Code)AccessController.doPrivileged( return findField(meth, ((Code) AccessController.doPrivileged(
J2DoPrivHelper.newCodeAction())).putfield(), true); J2DoPrivHelper.newCodeAction())).putfield(), true);
} }
@ -596,7 +596,7 @@ public class PCEnhancer {
*/ */
private void replaceAndValidateFieldAccess() { private void replaceAndValidateFieldAccess() {
// create template putfield/getfield instructions to search for // create template putfield/getfield instructions to search for
Code template = (Code)AccessController.doPrivileged( Code template = (Code) AccessController.doPrivileged(
J2DoPrivHelper.newCodeAction()); J2DoPrivHelper.newCodeAction());
Instruction put = template.putfield(); Instruction put = template.putfield();
Instruction get = template.getfield(); Instruction get = template.getfield();
@ -1204,55 +1204,55 @@ public class PCEnhancer {
try { try {
// pcGetGenericContext // pcGetGenericContext
translateFromStateManagerMethod( translateFromStateManagerMethod(
(Method)AccessController.doPrivileged( (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( J2DoPrivHelper.getDeclaredMethodAction(
SMTYPE, "get" + CONTEXTNAME, (Class[]) null))); SMTYPE, "get" + CONTEXTNAME, (Class[]) null)));
// pcFetchObjectId // pcFetchObjectId
translateFromStateManagerMethod( translateFromStateManagerMethod(
(Method)AccessController.doPrivileged( (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( J2DoPrivHelper.getDeclaredMethodAction(
SMTYPE, "fetchObjectId", (Class[]) null))); SMTYPE, "fetchObjectId", (Class[]) null)));
// pcIsDeleted // pcIsDeleted
translateFromStateManagerMethod( translateFromStateManagerMethod(
(Method)AccessController.doPrivileged( (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( J2DoPrivHelper.getDeclaredMethodAction(
SMTYPE, "isDeleted", (Class[]) null))); SMTYPE, "isDeleted", (Class[]) null)));
// pcIsDirty // pcIsDirty
translateFromStateManagerMethod( translateFromStateManagerMethod(
(Method)AccessController.doPrivileged( (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( J2DoPrivHelper.getDeclaredMethodAction(
SMTYPE, "isDirty", (Class[]) null))); SMTYPE, "isDirty", (Class[]) null)));
// pcIsNew // pcIsNew
translateFromStateManagerMethod( translateFromStateManagerMethod(
(Method)AccessController.doPrivileged( (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( J2DoPrivHelper.getDeclaredMethodAction(
SMTYPE, "isNew", (Class[]) null))); SMTYPE, "isNew", (Class[]) null)));
// pcIsPersistent // pcIsPersistent
translateFromStateManagerMethod( translateFromStateManagerMethod(
(Method)AccessController.doPrivileged( (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( J2DoPrivHelper.getDeclaredMethodAction(
SMTYPE, "isPersistent", (Class[]) null))); SMTYPE, "isPersistent", (Class[]) null)));
// pcIsTransactional // pcIsTransactional
translateFromStateManagerMethod( translateFromStateManagerMethod(
(Method)AccessController.doPrivileged( (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( J2DoPrivHelper.getDeclaredMethodAction(
SMTYPE, "isTransactional", (Class[]) null))); SMTYPE, "isTransactional", (Class[]) null)));
// pcSerializing // pcSerializing
translateFromStateManagerMethod( translateFromStateManagerMethod(
(Method)AccessController.doPrivileged( (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( J2DoPrivHelper.getDeclaredMethodAction(
SMTYPE, "serializing", (Class[]) null))); SMTYPE, "serializing", (Class[]) null)));
// pcDirty // pcDirty
translateFromStateManagerMethod( translateFromStateManagerMethod(
(Method)AccessController.doPrivileged( (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( J2DoPrivHelper.getDeclaredMethodAction(
SMTYPE, "dirty", new Class[]{ String.class }))); SMTYPE, "dirty", new Class[]{ String.class })));
@ -1265,8 +1265,8 @@ public class PCEnhancer {
code.areturn(); code.areturn();
code.calculateMaxStack(); code.calculateMaxStack();
code.calculateMaxLocals(); code.calculateMaxLocals();
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (NoSuchMethodException)pae.getException(); throw (NoSuchMethodException) pae.getException();
} }
} }
@ -2195,8 +2195,8 @@ public class PCEnhancer {
try { try {
method = (Method) AccessController.doPrivileged( method = (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction(owner, name, params)); J2DoPrivHelper.getDeclaredMethodAction(owner, name, params));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (NoSuchMethodException)pae.getException(); throw (NoSuchMethodException) pae.getException();
} }
return method; return method;
} }
@ -2497,7 +2497,7 @@ public class PCEnhancer {
code.vreturn(); code.vreturn();
} }
Instruction tmplate = ((Code)AccessController.doPrivileged( Instruction tmplate = ((Code) AccessController.doPrivileged(
J2DoPrivHelper.newCodeAction())).vreturn(); J2DoPrivHelper.newCodeAction())).vreturn();
JumpInstruction toret; JumpInstruction toret;
Instruction ret; Instruction ret;
@ -2766,7 +2766,7 @@ public class PCEnhancer {
if (clinit != null) { if (clinit != null) {
code = clinit.getCode(true); code = clinit.getCode(true);
if (replaceLast) { if (replaceLast) {
Code template = (Code)AccessController.doPrivileged( Code template = (Code) AccessController.doPrivileged(
J2DoPrivHelper.newCodeAction()); J2DoPrivHelper.newCodeAction());
code.searchForward(template.vreturn()); code.searchForward(template.vreturn());
code.previous(); code.previous();
@ -2808,8 +2808,8 @@ public class PCEnhancer {
if (clone == null) { if (clone == null) {
// add clone support for base classes // add clone support for base classes
// which also implement cloneable // which also implement cloneable
if (!((Boolean)AccessController.doPrivileged( if (!((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.isInstanceOfAction( _pc, Cloneable.class ))) J2DoPrivHelper.isInstanceOfAction(_pc, Cloneable.class)))
.booleanValue() .booleanValue()
|| !superName.equals(Object.class.getName())) || !superName.equals(Object.class.getName()))
return; return;
@ -2838,7 +2838,7 @@ public class PCEnhancer {
} }
// create template super.clone () instruction to match against // create template super.clone () instruction to match against
Instruction template = ((Code)AccessController.doPrivileged( Instruction template = ((Code) AccessController.doPrivileged(
J2DoPrivHelper.newCodeAction())).invokespecial() J2DoPrivHelper.newCodeAction())).invokespecial()
.setMethod(superName, "clone", Object.class.getName(), null); .setMethod(superName, "clone", Object.class.getName(), null);

View File

@ -118,8 +118,8 @@ public class Reflection {
*/ */
private static Method getDeclaredMethod(Class cls, String name, private static Method getDeclaredMethod(Class cls, String name,
Class param) { Class param) {
Method[] methods = (Method[])AccessController.doPrivileged( Method[] methods = (Method[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodsAction( cls )); J2DoPrivHelper.getDeclaredMethodsAction(cls));
for (int i = 0 ; i < methods.length; i++) { for (int i = 0 ; i < methods.length; i++) {
if (name.equals(methods[i].getName())) { if (name.equals(methods[i].getName())) {
Class[] methodParams = methods[i].getParameterTypes(); Class[] methodParams = methods[i].getParameterTypes();
@ -163,8 +163,8 @@ public class Reflection {
* @since 0.9.8 * @since 0.9.8
*/ */
private static Field getDeclaredField(Class cls, String name) { private static Field getDeclaredField(Class cls, String name) {
Field[] fields = (Field[])AccessController.doPrivileged( Field[] fields = (Field[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredFieldsAction( cls )); J2DoPrivHelper.getDeclaredFieldsAction(cls));
for (int i = 0 ; i < fields.length; i++) { for (int i = 0 ; i < fields.length; i++) {
if (name.equals(fields[i].getName())) if (name.equals(fields[i].getName()))
return fields[i]; return fields[i];

View File

@ -67,7 +67,7 @@ public class BeanLifecycleCallbacks
J2DoPrivHelper.newInstanceAction(cls)); J2DoPrivHelper.newInstanceAction(cls));
} catch (Throwable t) { } catch (Throwable t) {
if (t instanceof PrivilegedActionException) if (t instanceof PrivilegedActionException)
t = ((PrivilegedActionException )t).getException(); t = ((PrivilegedActionException) t).getException();
throw new UserException(_loc.get("bean-constructor", throw new UserException(_loc.get("bean-constructor",
cls.getName()), t); cls.getName()), t);
} }

View File

@ -103,8 +103,8 @@ public class MethodLifecycleCallbacks
protected static Method getMethod(Class cls, String method, Class[] args) { protected static Method getMethod(Class cls, String method, Class[] args) {
Class currentClass = cls; Class currentClass = cls;
do { do {
Method[] methods = (Method[])AccessController.doPrivileged( Method[] methods = (Method[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodsAction( currentClass )); J2DoPrivHelper.getDeclaredMethodsAction(currentClass));
for (int i = 0; i < methods.length; i++) { for (int i = 0; i < methods.length; i++) {
if (!method.equals(methods[i].getName())) if (!method.equals(methods[i].getName()))
continue; continue;

View File

@ -116,7 +116,7 @@ public class Bootstrap {
// handle cases where there is a mismatch between loaders by falling // handle cases where there is a mismatch between loaders by falling
// back to the configuration's class loader for broker resolution // back to the configuration's class loader for broker resolution
cls = getFactoryClass(conf, cls = getFactoryClass(conf,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(conf.getClass()))); J2DoPrivHelper.getClassLoaderAction(conf.getClass())));
meth = cls.getMethod(methodName, FACTORY_ARGS); meth = cls.getMethod(methodName, FACTORY_ARGS);
} }
@ -139,7 +139,7 @@ public class Bootstrap {
private static Class getFactoryClass(ConfigurationProvider conf, private static Class getFactoryClass(ConfigurationProvider conf,
ClassLoader loader) { ClassLoader loader) {
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
Object cls = BrokerFactoryValue.get(conf); Object cls = BrokerFactoryValue.get(conf);

View File

@ -258,7 +258,7 @@ public class BrokerImpl
public void initialize(AbstractBrokerFactory factory, public void initialize(AbstractBrokerFactory factory,
DelegatingStoreManager sm, boolean managed, int connMode) { DelegatingStoreManager sm, boolean managed, int connMode) {
_initializeWasInvoked = true; _initializeWasInvoked = true;
_loader = (ClassLoader)AccessController.doPrivileged( _loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
_jca = new JCAHelper(); _jca = new JCAHelper();
_conf = factory.getConfiguration(); _conf = factory.getConfiguration();
@ -4135,7 +4135,7 @@ public class BrokerImpl
if (!PCRegistry.isRegistered(cls)) { if (!PCRegistry.isRegistered(cls)) {
try { try {
Class.forName(cls.getName(), true, Class.forName(cls.getName(), true,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(cls))); J2DoPrivHelper.getClassLoaderAction(cls)));
} catch (Throwable t) { } catch (Throwable t) {
} }
@ -4275,10 +4275,10 @@ public class BrokerImpl
if (intfs[i].getName().equals(PersistenceCapable.class.getName())) { if (intfs[i].getName().equals(PersistenceCapable.class.getName())) {
throw new UserException(_loc.get("pc-loader-different", throw new UserException(_loc.get("pc-loader-different",
Exceptions.toString(obj), Exceptions.toString(obj),
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction( J2DoPrivHelper.getClassLoaderAction(
PersistenceCapable.class)), PersistenceCapable.class)),
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(intfs[i])))) J2DoPrivHelper.getClassLoaderAction(intfs[i]))))
.setFailedObject(obj); .setFailedObject(obj);
} }

View File

@ -752,7 +752,7 @@ public class Filters {
Class.forName((String) hint, true, loader))); Class.forName((String) hint, true, loader)));
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
cause = e; cause = e;
} }
} }
@ -785,13 +785,13 @@ public class Filters {
AggregateListener[] aggs = new AggregateListener[clss.length]; AggregateListener[] aggs = new AggregateListener[clss.length];
try { try {
for (int i = 0; i < clss.length; i++) for (int i = 0; i < clss.length; i++)
aggs[i] = (AggregateListener)AccessController.doPrivileged( aggs[i] = (AggregateListener) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction( J2DoPrivHelper.newInstanceAction(
Class.forName(clss[i], true, loader))); Class.forName(clss[i], true, loader)));
return aggs; return aggs;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
cause = e; cause = e;
} }
} }
@ -813,12 +813,12 @@ public class Filters {
Exception cause = null; Exception cause = null;
if (hint instanceof String) { if (hint instanceof String) {
try { try {
return (FilterListener)AccessController.doPrivileged( return (FilterListener) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction( J2DoPrivHelper.newInstanceAction(
Class.forName((String) hint, true, loader))); Class.forName((String) hint, true, loader)));
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
cause = e; cause = e;
} }
} }
@ -850,13 +850,13 @@ public class Filters {
FilterListener[] filts = new FilterListener[clss.length]; FilterListener[] filts = new FilterListener[clss.length];
try { try {
for (int i = 0; i < clss.length; i++) for (int i = 0; i < clss.length; i++)
filts[i] = (FilterListener)AccessController.doPrivileged( filts[i] = (FilterListener) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction( J2DoPrivHelper.newInstanceAction(
Class.forName(clss[i], true, loader))); Class.forName(clss[i], true, loader)));
return filts; return filts;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
cause = e; cause = e;
} }
} }

View File

@ -717,7 +717,7 @@ public class ObjectIdStateManager
getMetaData().getDescribedType())); getMetaData().getDescribedType()));
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
throw new GeneralException(e); throw new GeneralException(e);
} }
} else if (_oid == null) } else if (_oid == null)

View File

@ -1557,7 +1557,7 @@ public class QueryImpl
// first check the aliases map in the MetaDataRepository // first check the aliases map in the MetaDataRepository
ClassLoader loader = (_class == null) ? _loader ClassLoader loader = (_class == null) ? _loader
: (ClassLoader)AccessController.doPrivileged( : (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(_class)); J2DoPrivHelper.getClassLoaderAction(_class));
ClassMetaData meta = _broker.getConfiguration(). ClassMetaData meta = _broker.getConfiguration().
getMetaDataRepositoryInstance().getMetaData(name, loader, false); getMetaDataRepositoryInstance().getMetaData(name, loader, false);

View File

@ -41,14 +41,14 @@ public class QueryLanguages {
// Load and cache all the query languages available in the system. // Load and cache all the query languages available in the system.
Class[] classes = Services.getImplementorClasses( Class[] classes = Services.getImplementorClasses(
ExpressionParser.class, ExpressionParser.class,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(ExpressionParser.class))); J2DoPrivHelper.getClassLoaderAction(ExpressionParser.class)));
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
ExpressionParser ep; ExpressionParser ep;
try { try {
ep = (ExpressionParser)AccessController.doPrivileged( ep = (ExpressionParser) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(classes[i])); J2DoPrivHelper.newInstanceAction(classes[i]));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw new InternalException(pae.getException()); throw new InternalException(pae.getException());
} catch (InstantiationException e) { } catch (InstantiationException e) {
throw new InternalException(e); throw new InternalException(e);

View File

@ -252,7 +252,7 @@ public class ResultPacker {
return user; return user;
} catch (OpenJPAException ke) { } catch (OpenJPAException ke) {
throw ke; throw ke;
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw new UserException(_loc.get("pack-instantiation-err", throw new UserException(_loc.get("pack-instantiation-err",
_resultClass), pae.getException()); _resultClass), pae.getException());
} catch (InstantiationException ie) { } catch (InstantiationException ie) {

View File

@ -97,8 +97,8 @@ public abstract class AbstractCFMetaDataFactory
File file; File file;
for (int i = 0; i < strs.length; i++) { for (int i = 0; i < strs.length; i++) {
file = new File(strs[i]); file = new File(strs[i]);
if (((Boolean)AccessController.doPrivileged( if (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( file ))).booleanValue()) J2DoPrivHelper.existsAction(file))).booleanValue())
this.files.add(file); this.files.add(file);
} }
} }
@ -377,8 +377,8 @@ public abstract class AbstractCFMetaDataFactory
queries[i].setSource(defaultSourceFile(queries[i], queries[i].setSource(defaultSourceFile(queries[i],
clsNames), queries[i].getSourceScope(), clsNames), queries[i].getSourceScope(),
queries[i].getSourceType()); queries[i].getSourceType());
if (((Boolean)AccessController.doPrivileged( if (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( queries[i].getSourceFile()))) J2DoPrivHelper.existsAction(queries[i].getSourceFile())))
.booleanValue()) { .booleanValue()) {
if (files == null) if (files == null)
files = new HashSet(); files = new HashSet();
@ -390,7 +390,7 @@ public abstract class AbstractCFMetaDataFactory
if (getSourceFile(seqs[i]) == null) if (getSourceFile(seqs[i]) == null)
setSourceFile(seqs[i], defaultSourceFile(seqs[i], setSourceFile(seqs[i], defaultSourceFile(seqs[i],
clsNames)); clsNames));
if (((Boolean)AccessController.doPrivileged( if (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction(getSourceFile(seqs[i])))) J2DoPrivHelper.existsAction(getSourceFile(seqs[i]))))
.booleanValue()) { .booleanValue()) {
if (files == null) if (files == null)
@ -418,8 +418,8 @@ public abstract class AbstractCFMetaDataFactory
if (queries[i].getSourceFile() == null) if (queries[i].getSourceFile() == null)
queries[i].setSource(defaultSourceFile(queries[i], clsNames), queries[i].setSource(defaultSourceFile(queries[i], clsNames),
queries[i].getSourceScope(), queries[i].getSourceType()); queries[i].getSourceScope(), queries[i].getSourceType());
if (((Boolean)AccessController.doPrivileged( if (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( queries[i].getSourceFile() ))) J2DoPrivHelper.existsAction(queries[i].getSourceFile())))
.booleanValue()) { .booleanValue()) {
if (files == null) if (files == null)
files = new HashSet(); files = new HashSet();
@ -683,8 +683,8 @@ public abstract class AbstractCFMetaDataFactory
scan(new ZipStreamMetaDataIterator( scan(new ZipStreamMetaDataIterator(
new ZipInputStream(is), new ZipInputStream(is),
newMetaDataFilter()), cparser, names, true, url); newMetaDataFilter()), cparser, names, true, url);
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
} else { } else {
if (log.isTraceEnabled()) if (log.isTraceEnabled())
@ -703,7 +703,7 @@ public abstract class AbstractCFMetaDataFactory
for (Iterator itr = rsrcs.iterator(); itr.hasNext();) { for (Iterator itr = rsrcs.iterator(); itr.hasNext();) {
rsrc = (String) itr.next(); rsrc = (String) itr.next();
if (rsrc.endsWith(".jar")) { if (rsrc.endsWith(".jar")) {
url = (URL)AccessController.doPrivileged( url = (URL) AccessController.doPrivileged(
J2DoPrivHelper.getResourceAction(loader, rsrc)); J2DoPrivHelper.getResourceAction(loader, rsrc));
if (url != null) { if (url != null) {
if (log.isTraceEnabled()) if (log.isTraceEnabled())
@ -716,8 +716,8 @@ public abstract class AbstractCFMetaDataFactory
(new ZipInputStream(is), (new ZipInputStream(is),
newMetaDataFilter()), cparser, names, true, newMetaDataFilter()), cparser, names, true,
url); url);
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
} }
} else { } else {

View File

@ -187,7 +187,7 @@ public abstract class AbstractMetaDataDefaults
FieldMetaData fmd; FieldMetaData fmd;
for (int i = 0; i < fieldNames.length; i ++) { for (int i = 0; i < fieldNames.length; i ++) {
if (meta.getAccessType() == ClassMetaData.ACCESS_FIELD) if (meta.getAccessType() == ClassMetaData.ACCESS_FIELD)
member = (Field)AccessController.doPrivileged( member = (Field) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredFieldAction( J2DoPrivHelper.getDeclaredFieldAction(
cls,fieldNames[i])); cls,fieldNames[i]));
else else
@ -205,7 +205,7 @@ public abstract class AbstractMetaDataDefaults
throw ke; throw ke;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
throw new UserException(e); throw new UserException(e);
} }
} }
@ -217,11 +217,11 @@ public abstract class AbstractMetaDataDefaults
Member[] members; Member[] members;
boolean iface = meta.getDescribedType().isInterface(); boolean iface = meta.getDescribedType().isInterface();
if (meta.getAccessType() == ClassMetaData.ACCESS_FIELD && !iface) if (meta.getAccessType() == ClassMetaData.ACCESS_FIELD && !iface)
members = (Field[])AccessController.doPrivileged( members = (Field[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredFieldsAction( J2DoPrivHelper.getDeclaredFieldsAction(
meta.getDescribedType())); meta.getDescribedType()));
else else
members = (Method[])AccessController.doPrivileged( members = (Method[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodsAction( J2DoPrivHelper.getDeclaredMethodsAction(
meta.getDescribedType())); meta.getDescribedType()));
@ -332,7 +332,7 @@ public abstract class AbstractMetaDataDefaults
throw ke; throw ke;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
throw new InternalException(e); throw new InternalException(e);
} }
} }

View File

@ -845,8 +845,8 @@ public class ClassMetaData
if (getDeclaredField(field) != null) if (getDeclaredField(field) != null)
return true; return true;
if (_staticFields == null) { if (_staticFields == null) {
Field[] fields = (Field[])AccessController.doPrivileged( Field[] fields = (Field[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredFieldsAction( _type )); J2DoPrivHelper.getDeclaredFieldsAction(_type));
Set names = new HashSet((int) (fields.length * 1.33 + 1)); Set names = new HashSet((int) (fields.length * 1.33 + 1));
for (int i = 0; i < fields.length; i++) for (int i = 0; i < fields.length; i++)
if (Modifier.isStatic(fields[i].getModifiers())) if (Modifier.isStatic(fields[i].getModifiers()))

View File

@ -1251,7 +1251,7 @@ public class FieldMetaData
if (e instanceof OpenJPAException) if (e instanceof OpenJPAException)
throw (OpenJPAException) e; throw (OpenJPAException) e;
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
throw new MetaDataException(_loc.get("factory-err", this, throw new MetaDataException(_loc.get("factory-err", this,
Exceptions.toString(val), e.toString())).setCause(e); Exceptions.toString(val), e.toString())).setCause(e);
} }
@ -1975,7 +1975,7 @@ public class FieldMetaData
IOException ioe = new IOException(e.getMessage()); IOException ioe = new IOException(e.getMessage());
ioe.initCause(e); ioe.initCause(e);
throw ioe; throw ioe;
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
IOException ioe = new IOException( IOException ioe = new IOException(
pae.getException().getMessage()); pae.getException().getMessage());
ioe.initCause(pae); ioe.initCause(pae);

View File

@ -77,7 +77,7 @@ class InterfaceImplGenerator {
if (impl != null) if (impl != null)
return impl; return impl;
ClassLoader parentLoader = (ClassLoader)AccessController.doPrivileged( ClassLoader parentLoader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(iface)); J2DoPrivHelper.getClassLoaderAction(iface));
BCClassLoader loader = new BCClassLoader(_project, parentLoader); BCClassLoader loader = new BCClassLoader(_project, parentLoader);
BCClassLoader enhLoader = new BCClassLoader(_enhProject, parentLoader); BCClassLoader enhLoader = new BCClassLoader(_enhProject, parentLoader);
@ -87,7 +87,7 @@ class InterfaceImplGenerator {
if (sup != null) { if (sup != null) {
bc.setSuperclass(sup.getInterfaceImpl()); bc.setSuperclass(sup.getInterfaceImpl());
enhLoader = new BCClassLoader(_enhProject, enhLoader = new BCClassLoader(_enhProject,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction( J2DoPrivHelper.getClassLoaderAction(
sup.getInterfaceImpl()))); sup.getInterfaceImpl())));
} }
@ -170,8 +170,8 @@ class InterfaceImplGenerator {
*/ */
private void invalidateNonBeanMethods(BCClass bc, Class iface, private void invalidateNonBeanMethods(BCClass bc, Class iface,
Set methods) { Set methods) {
Method[] meths = (Method[])AccessController.doPrivileged( Method[] meths = (Method[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodsAction( iface )); J2DoPrivHelper.getDeclaredMethodsAction(iface));
BCMethod meth; BCMethod meth;
Code code; Code code;
Class type = _repos.getMetaDataFactory().getDefaults(). Class type = _repos.getMetaDataFactory().getDefaults().
@ -208,7 +208,7 @@ class InterfaceImplGenerator {
return (Method) AccessController.doPrivileged( return (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( J2DoPrivHelper.getDeclaredMethodAction(
iface, name, arg == null ? null : new Class[]{arg})); iface, name, arg == null ? null : new Class[]{arg}));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw new InternalException (_loc.get ("interface-mismatch", name)); throw new InternalException (_loc.get ("interface-mismatch", name));
} }
} }
@ -218,7 +218,7 @@ class InterfaceImplGenerator {
return true; return true;
try { try {
Method meth = (Method) AccessController.doPrivileged( Method meth = (Method) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodAction( iface, "is" + J2DoPrivHelper.getDeclaredMethodAction(iface, "is" +
StringUtils.capitalize(fmd.getName()), (Class[]) null)); StringUtils.capitalize(fmd.getName()), (Class[]) null));
return meth == null; return meth == null;
} catch (PrivilegedActionException pae) {} } catch (PrivilegedActionException pae) {}

View File

@ -401,7 +401,7 @@ public class MetaDataRepository
if ((_validate & VALIDATE_RUNTIME) != 0) { if ((_validate & VALIDATE_RUNTIME) != 0) {
try { try {
Class.forName(cls.getName(), true, Class.forName(cls.getName(), true,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(cls))); J2DoPrivHelper.getClassLoaderAction(cls)));
} catch (Throwable t) { } catch (Throwable t) {
} }
@ -980,7 +980,7 @@ public class MetaDataRepository
if (_log.isTraceEnabled()) if (_log.isTraceEnabled())
_log.trace(_loc.get("resolve-identity", oidClass)); _log.trace(_loc.get("resolve-identity", oidClass));
ClassLoader cl = (ClassLoader)AccessController.doPrivileged( ClassLoader cl = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(oidClass)); J2DoPrivHelper.getClassLoaderAction(oidClass));
String className; String className;
while (oidClass != null && oidClass != Object.class) { while (oidClass != null && oidClass != Object.class) {

View File

@ -255,7 +255,7 @@ public class SequenceMetaData
String clsName = plugin.getClassName(); String clsName = plugin.getClassName();
Class cls = Class.forName(clsName, true, Class cls = Class.forName(clsName, true,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(Seq.class))); J2DoPrivHelper.getClassLoaderAction(Seq.class)));
StringBuffer props = new StringBuffer(); StringBuffer props = new StringBuffer();
if (plugin.getProperties() != null) if (plugin.getProperties() != null)
@ -281,7 +281,7 @@ public class SequenceMetaData
throw ke; throw ke;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
throw new MetaDataException(_loc.get("cant-init-seq", _name)). throw new MetaDataException(_loc.get("cant-init-seq", _name)).
setCause(e); setCause(e);
} }

View File

@ -194,7 +194,7 @@ public class ApplicationIds {
J2DoPrivHelper.newInstanceAction(oidType)); J2DoPrivHelper.newInstanceAction(oidType));
} catch (Throwable t) { } catch (Throwable t) {
if (t instanceof PrivilegedActionException) if (t instanceof PrivilegedActionException)
t = ((PrivilegedActionException)t).getException(); t = ((PrivilegedActionException) t).getException();
throw new GeneralException(t); throw new GeneralException(t);
} }
@ -328,7 +328,7 @@ public class ApplicationIds {
J2DoPrivHelper.newInstanceAction(oidType)); J2DoPrivHelper.newInstanceAction(oidType));
} catch (Throwable t) { } catch (Throwable t) {
if (t instanceof PrivilegedActionException) if (t instanceof PrivilegedActionException)
t = ((PrivilegedActionException)t).getException(); t = ((PrivilegedActionException) t).getException();
throw new GeneralException(t); throw new GeneralException(t);
} }

View File

@ -40,15 +40,15 @@ public class ClassResolverImpl
// class (the bootstrap loader is the parent of the system loader) // class (the bootstrap loader is the parent of the system loader)
ClassLoader contextLoader = null; ClassLoader contextLoader = null;
if (contextClass != null) { if (contextClass != null) {
contextLoader = (ClassLoader)AccessController.doPrivileged( contextLoader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(contextClass)); J2DoPrivHelper.getClassLoaderAction(contextClass));
if (contextLoader == null) if (contextLoader == null)
contextLoader = (ClassLoader)AccessController.doPrivileged( contextLoader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getSystemClassLoaderAction()); J2DoPrivHelper.getSystemClassLoaderAction());
} }
// if there is only one unique loader, just return it // if there is only one unique loader, just return it
ClassLoader threadLoader = (ClassLoader)AccessController.doPrivileged( ClassLoader threadLoader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
if ((contextLoader == null || contextLoader == threadLoader) if ((contextLoader == null || contextLoader == threadLoader)
&& (envLoader == null || envLoader == threadLoader)) && (envLoader == null || envLoader == threadLoader))

View File

@ -78,7 +78,7 @@ public final class Id
*/ */
public Id(String str, ClassLoader loader) { public Id(String str, ClassLoader loader) {
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
if (str == null) if (str == null)

View File

@ -48,10 +48,10 @@ public class Proxies {
public static void assertAllowedType(Object value, Class allowed) { public static void assertAllowedType(Object value, Class allowed) {
if (value != null && allowed != null && !allowed.isInstance(value)) { if (value != null && allowed != null && !allowed.isInstance(value)) {
throw new UserException(_loc.get("bad-elem-type", new Object[]{ throw new UserException(_loc.get("bad-elem-type", new Object[]{
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(allowed)), J2DoPrivHelper.getClassLoaderAction(allowed)),
allowed, allowed,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(value.getClass())), J2DoPrivHelper.getClassLoaderAction(value.getClass())),
value.getClass() value.getClass()
})); }));

View File

@ -287,7 +287,7 @@ public class ProxyCollections
public static Object afterRemove(ProxyCollection coll, int index, public static Object afterRemove(ProxyCollection coll, int index,
Object removed) { Object removed) {
if (coll.getChangeTracker() != null) if (coll.getChangeTracker() != null)
((CollectionChangeTracker)coll.getChangeTracker()).removed(removed); ((CollectionChangeTracker) coll.getChangeTracker()).removed(removed);
removed(coll, removed, false); removed(coll, removed, false);
return removed; return removed;
} }

View File

@ -88,7 +88,7 @@ public class ProxyManagerImpl
if (JavaVersions.VERSION >= 5) { if (JavaVersions.VERSION >= 5) {
try { try {
Class queue = Class.forName("java.util.Queue", false, Class queue = Class.forName("java.util.Queue", false,
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction( J2DoPrivHelper.getClassLoaderAction(
Collection.class))); Collection.class)));
_stdCollections.put(queue, LinkedList.class); _stdCollections.put(queue, LinkedList.class);
@ -502,9 +502,9 @@ public class ProxyManagerImpl
} catch (InstantiationException ie) { } catch (InstantiationException ie) {
throw new UnsupportedException(_loc.get("cant-newinstance", throw new UnsupportedException(_loc.get("cant-newinstance",
cls.getSuperclass().getName())); cls.getSuperclass().getName()));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
Exception e = pae.getException(); Exception e = pae.getException();
if( e instanceof InstantiationException) if (e instanceof InstantiationException)
throw new UnsupportedException(_loc.get("cant-newinstance", throw new UnsupportedException(_loc.get("cant-newinstance",
cls.getSuperclass().getName())); cls.getSuperclass().getName()));
else else
@ -519,9 +519,9 @@ public class ProxyManagerImpl
* classes. * classes.
*/ */
private static ClassLoader getMostDerivedLoader(Class c1, Class c2) { private static ClassLoader getMostDerivedLoader(Class c1, Class c2) {
ClassLoader l1 = (ClassLoader)AccessController.doPrivileged( ClassLoader l1 = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(c1)); J2DoPrivHelper.getClassLoaderAction(c1));
ClassLoader l2 = (ClassLoader)AccessController.doPrivileged( ClassLoader l2 = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(c2)); J2DoPrivHelper.getClassLoaderAction(c2));
if (l1 == l2) if (l1 == l2)
return l1; return l1;
@ -530,10 +530,10 @@ public class ProxyManagerImpl
if (l2 == null) if (l2 == null)
return l1; return l1;
for (ClassLoader p = (ClassLoader)AccessController.doPrivileged( for (ClassLoader p = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getParentAction( l1 )); p != null; J2DoPrivHelper.getParentAction(l1)); p != null;
p = (ClassLoader)AccessController.doPrivileged( p = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getParentAction( p ))) J2DoPrivHelper.getParentAction(p)))
if (p == l2) if (p == l2)
return l1; return l1;
return l2; return l2;
@ -1588,7 +1588,7 @@ public class ProxyManagerImpl
public static void main(String[] args) public static void main(String[] args)
throws ClassNotFoundException, IOException { throws ClassNotFoundException, IOException {
File dir = Files.getClassFile(ProxyManagerImpl.class); File dir = Files.getClassFile(ProxyManagerImpl.class);
dir = (dir == null) ? new File((String)AccessController.doPrivileged( dir = (dir == null) ? new File((String) AccessController.doPrivileged(
J2DoPrivHelper.getPropertyAction("user.dir"))) J2DoPrivHelper.getPropertyAction("user.dir")))
: dir.getParentFile(); : dir.getParentFile();

View File

@ -131,7 +131,7 @@ public class Serialization {
} }
protected void addContextClassLoaders(MultiClassLoader loader) { protected void addContextClassLoaders(MultiClassLoader loader) {
loader.addClassLoader((ClassLoader)AccessController.doPrivileged( loader.addClassLoader((ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction())); J2DoPrivHelper.getContextClassLoaderAction()));
} }
} }

View File

@ -42,7 +42,7 @@ public class StoreFacadeTypeRegistry {
*/ */
public void registerImplementation(Class facadeType, Class storeType, public void registerImplementation(Class facadeType, Class storeType,
Class implType) { Class implType) {
Object key = (storeType == null) ? (Object)facadeType Object key = (storeType == null) ? (Object) facadeType
: new Key(facadeType, storeType); : new Key(facadeType, storeType);
_impls.put(key, implType); _impls.put(key, implType);
} }

View File

@ -161,7 +161,7 @@ public abstract class AbstractTask extends MatchingTask {
_conf = newConfiguration(); _conf = newConfiguration();
if (_conf.getPropertiesResource() == null) { if (_conf.getPropertiesResource() == null) {
ConfigurationProvider cp = ProductDerivations.loadDefaults ConfigurationProvider cp = ProductDerivations.loadDefaults
((ClassLoader)AccessController.doPrivileged( ((ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(_conf.getClass()))); J2DoPrivHelper.getClassLoaderAction(_conf.getClass())));
if (cp != null) if (cp != null)
cp.setInto(_conf); cp.setInto(_conf);
@ -191,8 +191,8 @@ public abstract class AbstractTask extends MatchingTask {
File f = new File(dsFiles[j]); File f = new File(dsFiles[j]);
if (!f.isFile()) if (!f.isFile())
f = new File(ds.getBasedir(), dsFiles[j]); f = new File(ds.getBasedir(), dsFiles[j]);
files.add((String)AccessController.doPrivileged( files.add((String) AccessController.doPrivileged(
J2DoPrivHelper.getAbsolutePathAction( f ))); J2DoPrivHelper.getAbsolutePathAction(f)));
} }
} }
return (String[]) files.toArray(new String[files.size()]); return (String[]) files.toArray(new String[files.size()]);

View File

@ -165,7 +165,7 @@ public class ConfigurationImpl
*/ */
public boolean loadGlobals() { public boolean loadGlobals() {
MultiClassLoader loader = new MultiClassLoader(); MultiClassLoader loader = new MultiClassLoader();
loader.addClassLoader((ClassLoader)AccessController.doPrivileged( loader.addClassLoader((ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction())); J2DoPrivHelper.getContextClassLoaderAction()));
loader.addClassLoader(getClass().getClassLoader()); loader.addClassLoader(getClass().getClassLoader());
ConfigurationProvider provider = ProductDerivations.loadGlobals(loader); ConfigurationProvider provider = ProductDerivations.loadGlobals(loader);
@ -175,7 +175,7 @@ public class ConfigurationImpl
// let system properties override other globals // let system properties override other globals
try { try {
fromProperties(new HashMap( fromProperties(new HashMap(
(Properties)AccessController.doPrivileged( (Properties) AccessController.doPrivileged(
J2DoPrivHelper.getPropertiesAction()))); J2DoPrivHelper.getPropertiesAction())));
} catch (SecurityException se) { } catch (SecurityException se) {
// security manager might disallow // security manager might disallow
@ -418,7 +418,7 @@ public class ConfigurationImpl
descs.add(new MethodDescriptor(read)); descs.add(new MethodDescriptor(read));
} }
} }
_mds = (MethodDescriptor[])descs. _mds = (MethodDescriptor[]) descs.
toArray(new MethodDescriptor[descs.size()]); toArray(new MethodDescriptor[descs.size()]);
return _mds; return _mds;
} }

View File

@ -212,8 +212,8 @@ public class Configurations {
return AccessController.doPrivileged( return AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(cls)); J2DoPrivHelper.newInstanceAction(cls));
} catch (Exception e) { } catch (Exception e) {
if( e instanceof PrivilegedActionException) { if (e instanceof PrivilegedActionException) {
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
} }
RuntimeException re = new NestableRuntimeException(_loc.get RuntimeException re = new NestableRuntimeException(_loc.get
("obj-create", cls).getMessage(), e); ("obj-create", cls).getMessage(), e);
@ -236,20 +236,20 @@ public class Configurations {
// we always prefer the thread loader, because it's the only thing we // we always prefer the thread loader, because it's the only thing we
// can access that isn't bound to the OpenJPA classloader, unless // can access that isn't bound to the OpenJPA classloader, unless
// the conf object is of a custom class // the conf object is of a custom class
ClassLoader ctxLoader = (ClassLoader)AccessController.doPrivileged( ClassLoader ctxLoader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
if (loader == null) { if (loader == null) {
if (ctxLoader != null) if (ctxLoader != null)
return ctxLoader; return ctxLoader;
if (conf != null) if (conf != null)
return (ClassLoader)AccessController.doPrivileged( return (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(conf.getClass())); J2DoPrivHelper.getClassLoaderAction(conf.getClass()));
return Configurations.class.getClassLoader(); return Configurations.class.getClassLoader();
} }
for (ClassLoader parent = ctxLoader; parent != null; for (ClassLoader parent = ctxLoader; parent != null;
parent = (ClassLoader)AccessController.doPrivileged( parent = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getParentAction( parent ))) { J2DoPrivHelper.getParentAction(parent))) {
if (parent == loader) if (parent == loader)
return ctxLoader; return ctxLoader;
} }
@ -258,10 +258,10 @@ public class Configurations {
AccessController.doPrivileged( AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(conf.getClass())); J2DoPrivHelper.getClassLoaderAction(conf.getClass()));
parent != null; parent != null;
parent = (ClassLoader)AccessController.doPrivileged( parent = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getParentAction( parent ))) { J2DoPrivHelper.getParentAction(parent))) {
if (parent == loader) if (parent == loader)
return (ClassLoader)AccessController.doPrivileged( return (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(conf.getClass())); J2DoPrivHelper.getClassLoaderAction(conf.getClass()));
} }
} }

View File

@ -59,8 +59,8 @@ public class FileValue extends Value {
} }
protected String getInternalString() { protected String getInternalString() {
return (value == null) ? null : (String)AccessController.doPrivileged( return (value == null) ? null : (String) AccessController.doPrivileged(
J2DoPrivHelper.getAbsolutePathAction( value )); J2DoPrivHelper.getAbsolutePathAction(value));
} }
protected void setInternalString(String val) { protected void setInternalString(String val) {

View File

@ -97,10 +97,10 @@ public class ObjectValue extends Value {
boolean fatal) { boolean fatal) {
ClassLoader cl = (ClassLoader) _classloaderCache.get(type); ClassLoader cl = (ClassLoader) _classloaderCache.get(type);
if (cl == null) { if (cl == null) {
cl = (ClassLoader)AccessController.doPrivileged( cl = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(type)); J2DoPrivHelper.getClassLoaderAction(type));
if (cl == null) { // System classloader is returned as null if (cl == null) { // System classloader is returned as null
cl = (ClassLoader)AccessController.doPrivileged( cl = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getSystemClassLoaderAction()); J2DoPrivHelper.getSystemClassLoaderAction());
} }
_classloaderCache.put(type, cl); _classloaderCache.put(type, cl);

View File

@ -49,7 +49,7 @@ public class ProductDerivations {
private static final Throwable[] _derivationErrors; private static final Throwable[] _derivationErrors;
private static String[] _prefixes; private static String[] _prefixes;
static { static {
ClassLoader l = (ClassLoader)AccessController.doPrivileged( ClassLoader l = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(ProductDerivation.class)); J2DoPrivHelper.getClassLoaderAction(ProductDerivation.class));
_derivationNames = Services.getImplementors(ProductDerivation.class, l); _derivationNames = Services.getImplementors(ProductDerivation.class, l);
_derivationErrors = new Throwable[_derivationNames.length]; _derivationErrors = new Throwable[_derivationNames.length];
@ -64,7 +64,7 @@ public class ProductDerivations {
derivations.add(d); derivations.add(d);
} catch (Throwable t) { } catch (Throwable t) {
if (t instanceof PrivilegedActionException) if (t instanceof PrivilegedActionException)
t = ((PrivilegedActionException)t).getException(); t = ((PrivilegedActionException) t).getException();
_derivationErrors[i] = t; _derivationErrors[i] = t;
} }
} }
@ -235,7 +235,7 @@ public class ProductDerivations {
if (StringUtils.isEmpty(resource)) if (StringUtils.isEmpty(resource))
return null; return null;
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
ConfigurationProvider provider = null; ConfigurationProvider provider = null;
StringBuffer errs = null; StringBuffer errs = null;
@ -266,7 +266,7 @@ public class ProductDerivations {
if (file == null) if (file == null)
return null; return null;
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
ConfigurationProvider provider = null; ConfigurationProvider provider = null;
StringBuffer errs = null; StringBuffer errs = null;
@ -281,8 +281,8 @@ public class ProductDerivations {
errs.append(_derivations[i].getClass().getName() + ":" + t); errs.append(_derivations[i].getClass().getName() + ":" + t);
} }
} }
String aPath = (String)AccessController.doPrivileged( String aPath = (String) AccessController.doPrivileged(
J2DoPrivHelper.getAbsolutePathAction( file )); J2DoPrivHelper.getAbsolutePathAction(file));
reportErrors(errs, aPath); reportErrors(errs, aPath);
throw new MissingResourceException(aPath, throw new MissingResourceException(aPath,
ProductDerivations.class.getName(), aPath); ProductDerivations.class.getName(), aPath);
@ -308,7 +308,7 @@ public class ProductDerivations {
private static ConfigurationProvider load(ClassLoader loader, private static ConfigurationProvider load(ClassLoader loader,
boolean globals) { boolean globals) {
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
ConfigurationProvider provider = null; ConfigurationProvider provider = null;

View File

@ -185,10 +185,10 @@ public class LogFactoryImpl
_out = new PrintStream((FileOutputStream) _out = new PrintStream((FileOutputStream)
AccessController.doPrivileged( AccessController.doPrivileged(
J2DoPrivHelper.newFileOutputStreamAction( J2DoPrivHelper.newFileOutputStreamAction(
(String)AccessController.doPrivileged( (String) AccessController.doPrivileged(
J2DoPrivHelper.getCanonicalPathAction( f )), J2DoPrivHelper.getCanonicalPathAction(f)),
true))); true)));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw new IllegalArgumentException(_loc.get("log-bad-file", throw new IllegalArgumentException(_loc.get("log-bad-file",
file) + " " + pae.getException()); file) + " " + pae.getException());
} catch (IOException ioe) { } catch (IOException ioe) {

View File

@ -298,7 +298,7 @@ public class CFMetaDataParser extends XMLMetaDataParser {
return null; return null;
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
boolean fullName = name.indexOf('.') != -1; boolean fullName = name.indexOf('.') != -1;
boolean noPackage = StringUtils.isEmpty(pkg); boolean noPackage = StringUtils.isEmpty(pkg);

View File

@ -214,8 +214,8 @@ public class ClassArgParser {
return new String[]{ getFromClassFile(file) }; return new String[]{ getFromClassFile(file) };
if (arg.endsWith(".java")) if (arg.endsWith(".java"))
return new String[]{ getFromJavaFile(file) }; return new String[]{ getFromJavaFile(file) };
if (((Boolean)AccessController.doPrivileged( if (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( file ))).booleanValue()) { J2DoPrivHelper.existsAction(file))).booleanValue()) {
Collection col = getFromMetaDataFile(file); Collection col = getFromMetaDataFile(file);
return (String[]) col.toArray(new String[col.size()]); return (String[]) col.toArray(new String[col.size()]);
} }
@ -303,8 +303,8 @@ public class ClassArgParser {
fin = (FileInputStream) AccessController.doPrivileged( fin = (FileInputStream) AccessController.doPrivileged(
J2DoPrivHelper.newFileInputStreamAction(file)); J2DoPrivHelper.newFileInputStreamAction(file));
return getFromClass(fin); return getFromClass(fin);
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (FileNotFoundException)pae.getException(); throw (FileNotFoundException) pae.getException();
} finally { } finally {
if (fin != null) if (fin != null)
try { try {

View File

@ -155,11 +155,11 @@ public class ClassMetaDataIterator implements MetaDataIterator {
_url = -1; _url = -1;
_urls.clear(); _urls.clear();
try { try {
e = (Enumeration)AccessController.doPrivileged( e = (Enumeration) AccessController.doPrivileged(
J2DoPrivHelper.getResourcesAction( J2DoPrivHelper.getResourcesAction(
_loader, (String) _locs.get(_loc))); _loader, (String) _locs.get(_loc)));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
while (e.hasMoreElements()) while (e.hasMoreElements())
_urls.add(e.nextElement()); _urls.add(e.nextElement());
@ -177,10 +177,10 @@ public class ClassMetaDataIterator implements MetaDataIterator {
if (_url == -1 || _url >= _urls.size()) if (_url == -1 || _url >= _urls.size())
throw new IllegalStateException(); throw new IllegalStateException();
try { try {
return (InputStream)AccessController.doPrivileged( return (InputStream) AccessController.doPrivileged(
J2DoPrivHelper.openStreamAction((URL) _urls.get(_url))); J2DoPrivHelper.openStreamAction((URL) _urls.get(_url)));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
} }
@ -189,8 +189,8 @@ public class ClassMetaDataIterator implements MetaDataIterator {
throw new IllegalStateException(); throw new IllegalStateException();
File file = new File(URLDecoder.decode(((URL) _urls.get(_url)). File file = new File(URLDecoder.decode(((URL) _urls.get(_url)).
getFile())); getFile()));
return (((Boolean)AccessController.doPrivileged( return (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( file ))).booleanValue()) ? file:null; J2DoPrivHelper.existsAction(file))).booleanValue()) ? file:null;
} }
public void close() { public void close() {

View File

@ -50,7 +50,7 @@ public class ClasspathMetaDataIterator extends MetaDataIteratorChain {
*/ */
public ClasspathMetaDataIterator(String[] dirs, MetaDataFilter filter) public ClasspathMetaDataIterator(String[] dirs, MetaDataFilter filter)
throws IOException { throws IOException {
Properties props = (Properties)AccessController.doPrivileged( Properties props = (Properties) AccessController.doPrivileged(
J2DoPrivHelper.getPropertiesAction()); J2DoPrivHelper.getPropertiesAction());
String path = props.getProperty("java.class.path"); String path = props.getProperty("java.class.path");
String[] tokens = Strings.split(path, String[] tokens = Strings.split(path,
@ -61,8 +61,8 @@ public class ClasspathMetaDataIterator extends MetaDataIteratorChain {
continue; continue;
File file = new File(tokens[i]); File file = new File(tokens[i]);
if (!((Boolean)AccessController.doPrivileged( if (!((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( file ))).booleanValue()) J2DoPrivHelper.existsAction(file))).booleanValue())
continue; continue;
if (file.isDirectory()) if (file.isDirectory())
addIterator(new FileMetaDataIterator(file, filter)); addIterator(new FileMetaDataIterator(file, filter));

View File

@ -121,8 +121,8 @@ public class FileMetaDataIterator implements MetaDataIterator {
fis = (FileInputStream) AccessController.doPrivileged( fis = (FileInputStream) AccessController.doPrivileged(
J2DoPrivHelper.newFileInputStreamAction(_file)); J2DoPrivHelper.newFileInputStreamAction(_file));
return fis; return fis;
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (FileNotFoundException)pae.getException(); throw (FileNotFoundException) pae.getException();
} }
} }
@ -148,14 +148,14 @@ public class FileMetaDataIterator implements MetaDataIterator {
} }
public byte[] getContent() throws IOException { public byte[] getContent() throws IOException {
long len = ((Long)AccessController.doPrivileged( long len = ((Long) AccessController.doPrivileged(
J2DoPrivHelper.lengthAction( _file ))).longValue(); J2DoPrivHelper.lengthAction(_file))).longValue();
FileInputStream fin = null; FileInputStream fin = null;
try { try {
fin = (FileInputStream) AccessController.doPrivileged( fin = (FileInputStream) AccessController.doPrivileged(
J2DoPrivHelper.newFileInputStreamAction(_file)); J2DoPrivHelper.newFileInputStreamAction(_file));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (FileNotFoundException)pae.getException(); throw (FileNotFoundException) pae.getException();
} }
try { try {
byte[] content; byte[] content;

View File

@ -65,15 +65,15 @@ public class ResourceMetaDataIterator implements MetaDataIterator {
} }
try { try {
Enumeration e = (Enumeration)AccessController.doPrivileged( Enumeration e = (Enumeration) AccessController.doPrivileged(
J2DoPrivHelper.getResourcesAction(loader, rsrc)); J2DoPrivHelper.getResourcesAction(loader, rsrc));
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
if (_urls == null) if (_urls == null)
_urls = new ArrayList(3); _urls = new ArrayList(3);
_urls.add(e.nextElement()); _urls.add(e.nextElement());
} }
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
} }
@ -91,10 +91,10 @@ public class ResourceMetaDataIterator implements MetaDataIterator {
if (_url == -1 || _url >= _urls.size()) if (_url == -1 || _url >= _urls.size())
throw new IllegalStateException(); throw new IllegalStateException();
try { try {
return (InputStream)AccessController.doPrivileged( return (InputStream) AccessController.doPrivileged(
J2DoPrivHelper.openStreamAction((URL) _urls.get(_url))); J2DoPrivHelper.openStreamAction((URL) _urls.get(_url)));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
} }
@ -103,8 +103,8 @@ public class ResourceMetaDataIterator implements MetaDataIterator {
throw new IllegalStateException(); throw new IllegalStateException();
File file = new File(URLDecoder.decode(((URL) _urls.get(_url)). File file = new File(URLDecoder.decode(((URL) _urls.get(_url)).
getFile())); getFile()));
return (((Boolean)AccessController.doPrivileged( return (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( file ))).booleanValue()) ? file :null; J2DoPrivHelper.existsAction(file))).booleanValue()) ? file :null;
} }
public void close() { public void close() {

View File

@ -49,7 +49,7 @@ public class SourceTrackers {
for (int i = 0; i < trackers.length; i++) { for (int i = 0; i < trackers.length; i++) {
sourceFilePath = (trackers[i].getSourceFile() == null ? sourceFilePath = (trackers[i].getSourceFile() == null ?
_loc.get("source-tracker-file-unknown").getMessage() : _loc.get("source-tracker-file-unknown").getMessage() :
(String)AccessController.doPrivileged( (String) AccessController.doPrivileged(
J2DoPrivHelper.getAbsolutePathAction( J2DoPrivHelper.getAbsolutePathAction(
trackers[i].getSourceFile()))); trackers[i].getSourceFile())));
buf.append(" ").append(_loc.get( buf.append(" ").append(_loc.get(

View File

@ -64,10 +64,10 @@ public class URLMetaDataIterator implements MetaDataIterator {
if (_url == null) if (_url == null)
return null; return null;
try { try {
return (InputStream)AccessController.doPrivileged( return (InputStream) AccessController.doPrivileged(
J2DoPrivHelper.openStreamAction(_url)); J2DoPrivHelper.openStreamAction(_url));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
} }
@ -77,8 +77,8 @@ public class URLMetaDataIterator implements MetaDataIterator {
if (_url == null) if (_url == null)
return null; return null;
File file = new File(URLDecoder.decode(_url.getPath())); File file = new File(URLDecoder.decode(_url.getPath()));
return (((Boolean)AccessController.doPrivileged( return (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( file ))).booleanValue()) ? file:null; J2DoPrivHelper.existsAction(file))).booleanValue()) ? file:null;
} }
public void close() { public void close() {

View File

@ -631,7 +631,7 @@ public abstract class XMLMetaDataParser extends DefaultHandler
if (_loader != null) if (_loader != null)
return _loader; return _loader;
if (_curLoader == null) if (_curLoader == null)
_curLoader = (ClassLoader)AccessController.doPrivileged( _curLoader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
return _curLoader; return _curLoader;
} }

View File

@ -138,10 +138,10 @@ public abstract class XMLMetaDataSerializer implements MetaDataSerializer {
File backup = Files.backup(file, false); File backup = Files.backup(file, false);
if (backup == null) { if (backup == null) {
File parent = file.getParentFile(); File parent = file.getParentFile();
if (parent != null && !((Boolean)AccessController.doPrivileged( if (parent != null && !((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( parent ))).booleanValue()) J2DoPrivHelper.existsAction(parent))).booleanValue())
AccessController.doPrivileged( AccessController.doPrivileged(
J2DoPrivHelper.mkdirsAction( parent )); J2DoPrivHelper.mkdirsAction(parent));
} }
return backup; return backup;
} }
@ -198,13 +198,13 @@ public abstract class XMLMetaDataSerializer implements MetaDataSerializer {
_backup = prepareWrite(file); _backup = prepareWrite(file);
try { try {
FileWriter out = new FileWriter( FileWriter out = new FileWriter(
(String)AccessController.doPrivileged( (String) AccessController.doPrivileged(
J2DoPrivHelper.getCanonicalPathAction( file )), J2DoPrivHelper.getCanonicalPathAction(file)),
(flags & APPEND) > 0); (flags & APPEND) > 0);
serialize(out, flags); serialize(out, flags);
out.close(); out.close();
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
} }

View File

@ -61,8 +61,8 @@ public class ZipFileMetaDataIterator
try { try {
_file = (ZipFile) AccessController.doPrivileged( _file = (ZipFile) AccessController.doPrivileged(
J2DoPrivHelper.getContentAction(con)); J2DoPrivHelper.getContentAction(con));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
} }
_filter = filter; _filter = filter;

View File

@ -51,17 +51,17 @@ public class Files {
* the file does not exist or a backup could not be created, returns null. * the file does not exist or a backup could not be created, returns null.
*/ */
public static File backup(File file, boolean copy) { public static File backup(File file, boolean copy) {
if (file == null || !((Boolean)AccessController.doPrivileged( if (file == null || !((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( file ))).booleanValue()) J2DoPrivHelper.existsAction(file))).booleanValue())
return null; return null;
// create new file object copy so we don't modify the original // create new file object copy so we don't modify the original
String aPath = (String)AccessController.doPrivileged( String aPath = (String) AccessController.doPrivileged(
J2DoPrivHelper.getAbsolutePathAction( file )); J2DoPrivHelper.getAbsolutePathAction(file));
File clone = new File(aPath); File clone = new File(aPath);
File bk = new File(aPath + "~"); File bk = new File(aPath + "~");
if (!((Boolean)AccessController.doPrivileged( if (!((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.renameToAction( clone, bk ))).booleanValue()) J2DoPrivHelper.renameToAction(clone, bk))).booleanValue())
return null; return null;
if (copy) { if (copy) {
try { try {
@ -83,17 +83,17 @@ public class Files {
return null; return null;
if (!backup.getName().endsWith("~")) if (!backup.getName().endsWith("~"))
backup = new File(backup.getPath() + "~"); backup = new File(backup.getPath() + "~");
if (!((Boolean)AccessController.doPrivileged( if (!((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( backup ))).booleanValue()) J2DoPrivHelper.existsAction(backup))).booleanValue())
return null; return null;
// create new file object copy so we don't modify the original // create new file object copy so we don't modify the original
String path = (String)AccessController.doPrivileged( String path = (String) AccessController.doPrivileged(
J2DoPrivHelper.getAbsolutePathAction( backup )); J2DoPrivHelper.getAbsolutePathAction(backup));
File clone = new File(path); File clone = new File(path);
File orig = new File(path.substring(0, path.length() - 1)); File orig = new File(path.substring(0, path.length() - 1));
if (!((Boolean)AccessController.doPrivileged( if (!((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.renameToAction( clone, orig ))).booleanValue()) J2DoPrivHelper.renameToAction(clone, orig))).booleanValue())
return null; return null;
if (copy) { if (copy) {
try { try {
@ -132,7 +132,7 @@ public class Files {
if (innerIdx != -1) if (innerIdx != -1)
name = name.substring(0, innerIdx); name = name.substring(0, innerIdx);
URL rsrc = (URL)AccessController.doPrivileged( URL rsrc = (URL) AccessController.doPrivileged(
J2DoPrivHelper.getResourceAction(cls, name + ext)); J2DoPrivHelper.getResourceAction(cls, name + ext));
if (rsrc != null && rsrc.getProtocol().equals("file")) if (rsrc != null && rsrc.getProtocol().equals("file"))
return new File(URLDecoder.decode(rsrc.getFile())); return new File(URLDecoder.decode(rsrc.getFile()));
@ -148,34 +148,34 @@ public class Files {
*/ */
public static File getPackageFile(File base, String pkg, boolean mkdirs) { public static File getPackageFile(File base, String pkg, boolean mkdirs) {
if (base == null) if (base == null)
base = new File((String)AccessController.doPrivileged( base = new File((String) AccessController.doPrivileged(
J2DoPrivHelper.getPropertyAction("user.dir"))); J2DoPrivHelper.getPropertyAction("user.dir")));
if (StringUtils.isEmpty(pkg)) { if (StringUtils.isEmpty(pkg)) {
if (mkdirs && !((Boolean)AccessController.doPrivileged( if (mkdirs && !((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( base ))).booleanValue()) J2DoPrivHelper.existsAction(base))).booleanValue())
AccessController.doPrivileged( AccessController.doPrivileged(
J2DoPrivHelper.mkdirsAction( base )); J2DoPrivHelper.mkdirsAction(base));
return base; return base;
} }
pkg = pkg.replace('.', File.separatorChar); pkg = pkg.replace('.', File.separatorChar);
File file = null; File file = null;
try { try {
if (((String)AccessController.doPrivileged( if (((String) AccessController.doPrivileged(
J2DoPrivHelper.getCanonicalPathAction( base ))).endsWith(pkg)) J2DoPrivHelper.getCanonicalPathAction(base))).endsWith(pkg))
file = base; file = base;
else else
file = new File(base, pkg); file = new File(base, pkg);
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw new NestableRuntimeException( throw new NestableRuntimeException(
(IOException)pae.getException()); (IOException) pae.getException());
} catch (IOException ioe) { } catch (IOException ioe) {
throw new NestableRuntimeException(ioe); throw new NestableRuntimeException(ioe);
} }
if (mkdirs && !((Boolean)AccessController.doPrivileged( if (mkdirs && !((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( file ))).booleanValue()) J2DoPrivHelper.existsAction(file))).booleanValue())
AccessController.doPrivileged(J2DoPrivHelper.mkdirsAction( file )); AccessController.doPrivileged(J2DoPrivHelper.mkdirsAction(file));
return file; return file;
} }
@ -195,21 +195,21 @@ public class Files {
return null; return null;
File file = new File(name); File file = new File(name);
if (((Boolean)AccessController.doPrivileged( if (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( file ))).booleanValue()) J2DoPrivHelper.existsAction(file))).booleanValue())
return file; return file;
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
URL url = (URL)AccessController.doPrivileged( URL url = (URL) AccessController.doPrivileged(
J2DoPrivHelper.getResourceAction(loader, name)); J2DoPrivHelper.getResourceAction(loader, name));
if (url != null) { if (url != null) {
String urlFile = url.getFile(); String urlFile = url.getFile();
if (urlFile != null) { if (urlFile != null) {
File rsrc = new File(URLDecoder.decode(urlFile)); File rsrc = new File(URLDecoder.decode(urlFile));
if (((Boolean)AccessController.doPrivileged( if (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( rsrc ))).booleanValue()) J2DoPrivHelper.existsAction(rsrc))).booleanValue())
return rsrc; return rsrc;
} }
} }
@ -257,7 +257,7 @@ public class Files {
return (FileOutputStream) AccessController.doPrivileged( return (FileOutputStream) AccessController.doPrivileged(
J2DoPrivHelper.newFileOutputStreamAction( J2DoPrivHelper.newFileOutputStreamAction(
getFile(file, loader))); getFile(file, loader)));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw new NestableRuntimeException(pae.getException()); throw new NestableRuntimeException(pae.getException());
} catch (IOException ioe) { } catch (IOException ioe) {
throw new NestableRuntimeException(ioe); throw new NestableRuntimeException(ioe);
@ -269,8 +269,8 @@ public class Files {
*/ */
public static boolean copy(File from, File to) throws IOException { public static boolean copy(File from, File to) throws IOException {
if (from == null || to == null || if (from == null || to == null ||
!((Boolean)AccessController.doPrivileged( !((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( from ))).booleanValue()) J2DoPrivHelper.existsAction(from))).booleanValue())
return false; return false;
FileInputStream in = null; FileInputStream in = null;
@ -285,8 +285,8 @@ public class Files {
for (int b; (b = inbuf.read()) != -1; outbuf.write(b)) ; for (int b; (b = inbuf.read()) != -1; outbuf.write(b)) ;
outbuf.flush(); outbuf.flush();
return true; return true;
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (FileNotFoundException)pae.getException(); throw (FileNotFoundException) pae.getException();
} finally { } finally {
if (in != null) if (in != null)
try { try {

View File

@ -74,31 +74,31 @@ import serp.bytecode.Code;
* 2) Methods with no exception thrown. PrivilegedAction is returned from * 2) Methods with no exception thrown. PrivilegedAction is returned from
* J2DoPrivHelper.*Action(). E.g. * J2DoPrivHelper.*Action(). E.g.
* *
* ClassLoader loader = (ClassLoader)AccessController.doPrivileged( * ClassLoader loader = (ClassLoader) AccessController.doPrivileged(
* J2DoPrivHelper.getClassLoaderAction( clazz )); * J2DoPrivHelper.getClassLoaderAction(clazz));
* *
* ClassLoader loader = (ClassLoader) (System.getSecurityManager() == null) * ClassLoader loader = (ClassLoader) (System.getSecurityManager() == null)
* ? clazz.getClassLoader() * ? clazz.getClassLoader()
* : AccessController.doPrivileged( * : AccessController.doPrivileged(
* J2DoPrivHelper.getClassLoaderAction( clazz )); * J2DoPrivHelper.getClassLoaderAction(clazz));
* 3) Methods with exception thrown. PrivilegedExceptionAction is returned * 3) Methods with exception thrown. PrivilegedExceptionAction is returned
* from J2DoPrivHelper.*Action(). E.g. * from J2DoPrivHelper.*Action(). E.g.
* *
* try { * try {
* method = (Method) AccessController.doPrivileged( * method = (Method) AccessController.doPrivileged(
* J2DoPrivHelper.getDeclaredMethodAction(clazz, name, parameterType)); * J2DoPrivHelper.getDeclaredMethodAction(clazz, name, parameterType));
* } catch( PrivilegedActionException pae ) { * } catch (PrivilegedActionException pae) {
* throw (NoSuchMethodException)pae.getException(); * throw (NoSuchMethodException) pae.getException();
* } * }
* *
* try { * try {
* method = ( System.getSecurityManager() == null ) * method = (System.getSecurityManager() == null)
* ? clazz.getDeclaredMethod(name,parameterType) * ? clazz.getDeclaredMethod(name,parameterType)
* : (Method) AccessController.doPrivileged( * : (Method) AccessController.doPrivileged(
* J2DoPrivHelper.getDeclaredMethodAction( * J2DoPrivHelper.getDeclaredMethodAction(
* clazz, name, parameterType)); * clazz, name, parameterType));
* } catch( PrivilegedActionException pae ) { * } catch (PrivilegedActionException pae) {
* throw (NoSuchMethodException)pae.getException() * throw (NoSuchMethodException) pae.getException()
* } * }
* </xmp> * </xmp>
* @author Albert Lee * @author Albert Lee
@ -409,7 +409,7 @@ public abstract class J2DoPrivHelper {
public static final PrivilegedAction lengthAction(final File f) { public static final PrivilegedAction lengthAction(final File f) {
return new PrivilegedAction() { return new PrivilegedAction() {
public Object run() { public Object run() {
return new Long( f.length() ); return new Long(f.length());
} }
}; };
} }

View File

@ -46,7 +46,7 @@ public class JavaVersions {
private static Method INIT_CAUSE = null; private static Method INIT_CAUSE = null;
static { static {
String specVersion = (String)AccessController.doPrivileged( String specVersion = (String) AccessController.doPrivileged(
J2DoPrivHelper.getPropertyAction("java.specification.version")); J2DoPrivHelper.getPropertyAction("java.specification.version"));
if ("1.2".equals(specVersion)) if ("1.2".equals(specVersion))
VERSION = 2; VERSION = 2;

View File

@ -100,7 +100,7 @@ public class Localizer {
return loc; return loc;
else { else {
loc = new Localizer(pkg, file, locale, loc = new Localizer(pkg, file, locale,
cls == null ? null:(ClassLoader)AccessController.doPrivileged( cls == null ? null:(ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(cls))); J2DoPrivHelper.getClassLoaderAction(cls)));
_localizers.put(key, loc); _localizers.put(key, loc);
return loc; return loc;

View File

@ -48,7 +48,7 @@ public class MultiClassLoader extends ClassLoader {
* The standard system class loader. * The standard system class loader.
*/ */
public static final ClassLoader SYSTEM_LOADER = public static final ClassLoader SYSTEM_LOADER =
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getSystemClassLoaderAction()); J2DoPrivHelper.getSystemClassLoaderAction());
private List _loaders = new ArrayList(5); private List _loaders = new ArrayList(5);
@ -85,7 +85,7 @@ public class MultiClassLoader extends ClassLoader {
for (int i = 0; i < loaders.length; i++) { for (int i = 0; i < loaders.length; i++) {
loader = (ClassLoader) itr.next(); loader = (ClassLoader) itr.next();
if (loader == THREAD_LOADER) if (loader == THREAD_LOADER)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
loaders[i] = loader; loaders[i] = loader;
} }
@ -98,7 +98,7 @@ public class MultiClassLoader extends ClassLoader {
public ClassLoader getClassLoader(int index) { public ClassLoader getClassLoader(int index) {
ClassLoader loader = (ClassLoader) _loaders.get(index); ClassLoader loader = (ClassLoader) _loaders.get(index);
if (loader == THREAD_LOADER) if (loader == THREAD_LOADER)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
return loader; return loader;
} }
@ -206,7 +206,7 @@ public class MultiClassLoader extends ClassLoader {
for (Iterator itr = _loaders.iterator(); itr.hasNext();) { for (Iterator itr = _loaders.iterator(); itr.hasNext();) {
loader = (ClassLoader) itr.next(); loader = (ClassLoader) itr.next();
if (loader == THREAD_LOADER) if (loader == THREAD_LOADER)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
try { try {
return Class.forName(name, false, loader); return Class.forName(name, false, loader);
@ -222,13 +222,13 @@ public class MultiClassLoader extends ClassLoader {
for (Iterator itr = _loaders.iterator(); itr.hasNext();) { for (Iterator itr = _loaders.iterator(); itr.hasNext();) {
loader = (ClassLoader) itr.next(); loader = (ClassLoader) itr.next();
if (loader == THREAD_LOADER) if (loader == THREAD_LOADER)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
if (loader == null) // skip if (loader == null) // skip
continue; continue;
rsrc = (URL)AccessController.doPrivileged( rsrc = (URL) AccessController.doPrivileged(
J2DoPrivHelper.getResourceAction(loader, name)); J2DoPrivHelper.getResourceAction(loader, name));
if (rsrc != null) if (rsrc != null)
return rsrc; return rsrc;
@ -244,20 +244,20 @@ public class MultiClassLoader extends ClassLoader {
for (Iterator itr = _loaders.iterator(); itr.hasNext();) { for (Iterator itr = _loaders.iterator(); itr.hasNext();) {
loader = (ClassLoader) itr.next(); loader = (ClassLoader) itr.next();
if (loader == THREAD_LOADER) if (loader == THREAD_LOADER)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
try { try {
rsrcs = (Enumeration)AccessController.doPrivileged( rsrcs = (Enumeration) AccessController.doPrivileged(
J2DoPrivHelper.getResourcesAction(loader, name)); J2DoPrivHelper.getResourcesAction(loader, name));
while (rsrcs.hasMoreElements()) { while (rsrcs.hasMoreElements()) {
rsrc = rsrcs.nextElement(); rsrc = rsrcs.nextElement();
if (!all.contains(rsrc)) if (!all.contains(rsrc))
all.addElement(rsrc); all.addElement(rsrc);
} }
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
} }
return all.elements(); return all.elements();

View File

@ -369,7 +369,7 @@ public class Options extends TypedProperties {
try { try {
inner = AccessController.doPrivileged( inner = AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(innerType)); J2DoPrivHelper.newInstanceAction(innerType));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw pae.getException(); throw pae.getException();
} }
invoke(match[0], setter, new Object[]{ inner }); invoke(match[0], setter, new Object[]{ inner });
@ -455,7 +455,7 @@ public class Options extends TypedProperties {
try { try {
return AccessController.doPrivileged( return AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(subType)); J2DoPrivHelper.newInstanceAction(subType));
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw pae.getException(); throw pae.getException();
} }
} }

View File

@ -211,7 +211,7 @@ public class ParameterTemplate {
if (_params.containsKey(param.toString())) if (_params.containsKey(param.toString()))
copy.append(_params.get(param.toString())); copy.append(_params.get(param.toString()));
else else
copy.append((String)AccessController.doPrivileged( copy.append((String) AccessController.doPrivileged(
J2DoPrivHelper.getPropertyAction(param.toString()))); J2DoPrivHelper.getPropertyAction(param.toString())));
param = null; param = null;
} else if (param != null) } else if (param != null)

View File

@ -85,12 +85,12 @@ public class Services {
public static String[] getImplementors(String serviceName, public static String[] getImplementors(String serviceName,
ClassLoader loader) { ClassLoader loader) {
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
try { try {
Set resourceList = new TreeSet(); Set resourceList = new TreeSet();
Enumeration resources = (Enumeration)AccessController.doPrivileged( Enumeration resources = (Enumeration) AccessController.doPrivileged(
J2DoPrivHelper.getResourcesAction(loader, PREFIX + serviceName)); J2DoPrivHelper.getResourcesAction(loader, PREFIX + serviceName));
while (resources.hasMoreElements()) while (resources.hasMoreElements())
addResources((URL) resources.nextElement(), resourceList); addResources((URL) resources.nextElement(), resourceList);
@ -178,7 +178,7 @@ public class Services {
public static Class[] getImplementorClasses(String serviceName, public static Class[] getImplementorClasses(String serviceName,
ClassLoader loader, boolean skipMissing) throws ClassNotFoundException { ClassLoader loader, boolean skipMissing) throws ClassNotFoundException {
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
String[] names = getImplementors(serviceName, loader); String[] names = getImplementors(serviceName, loader);

View File

@ -38,7 +38,7 @@ class StreamResourceBundleProvider implements ResourceBundleProvider {
ClassLoader loader) { ClassLoader loader) {
String rsrc = name.replace('.', '/') + ".properties"; String rsrc = name.replace('.', '/') + ".properties";
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
InputStream in = loader.getResourceAsStream(rsrc); InputStream in = loader.getResourceAsStream(rsrc);

View File

@ -88,7 +88,7 @@ public class UUIDGenerator {
// when it overflows // when it overflows
private static long _lastMillis = 0L; private static long _lastMillis = 0L;
private static final int MAX_14BIT = 0x3FFF; private static final int MAX_14BIT = 0x3FFF;
private static short _seq = (short)RANDOM.nextInt(MAX_14BIT); private static short _seq = (short) RANDOM.nextInt(MAX_14BIT);
/* /*
* Static initializer to get the IP address of the host machine. * Static initializer to get the IP address of the host machine.
@ -216,7 +216,7 @@ public class UUIDGenerator {
private static void incrementSequence() { private static void incrementSequence() {
// increment, but if it's greater than its 14-bits, reset it // increment, but if it's greater than its 14-bits, reset it
if (++_seq > MAX_14BIT) { if (++_seq > MAX_14BIT) {
_seq = (short)RANDOM.nextInt(MAX_14BIT); // semi-random _seq = (short) RANDOM.nextInt(MAX_14BIT); // semi-random
} }
} }

View File

@ -40,7 +40,7 @@ class ZipResourceBundleProvider implements ResourceBundleProvider {
ClassLoader loader) { ClassLoader loader) {
String rsrc = name.replace('.', '/') + ".properties"; String rsrc = name.replace('.', '/') + ".properties";
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
InputStream in = loader.getResourceAsStream(rsrc); InputStream in = loader.getResourceAsStream(rsrc);

View File

@ -55,7 +55,7 @@ public final class Utils {
static { static {
NanoTimer timer = null; NanoTimer timer = null;
try { try {
String nanoTimerClassName = (String)AccessController.doPrivileged( String nanoTimerClassName = (String) AccessController.doPrivileged(
J2DoPrivHelper.getPropertyAction(providerProp)); J2DoPrivHelper.getPropertyAction(providerProp));
if (nanoTimerClassName != null) { if (nanoTimerClassName != null) {
Class cls = Class.forName(nanoTimerClassName); Class cls = Class.forName(nanoTimerClassName);

View File

@ -886,10 +886,10 @@ public class XMLPersistenceMappingParser
* ClassMappingInfo. * ClassMappingInfo.
*/ */
private void endUniqueConstraint() { private void endUniqueConstraint() {
Unique unique = (Unique)popElement(); Unique unique = (Unique) popElement();
Object current = currentElement(); Object current = currentElement();
if (current instanceof ClassMapping && _secondaryTable == null) if (current instanceof ClassMapping && _secondaryTable == null)
((ClassMapping)current).getMappingInfo().addUnique(unique); ((ClassMapping) current).getMappingInfo().addUnique(unique);
} }
/** /**
@ -899,7 +899,7 @@ public class XMLPersistenceMappingParser
private boolean endColumnName() { private boolean endColumnName() {
Object current = currentElement(); Object current = currentElement();
if (current instanceof Unique) { if (current instanceof Unique) {
Unique unique = (Unique)current; Unique unique = (Unique) current;
Column column = new Column(); Column column = new Column();
column.setName(this.currentText()); column.setName(this.currentText());
unique.addColumn(column); unique.addColumn(column);

View File

@ -83,8 +83,8 @@ public class TestIsolationLevelOverride
q.getResultList(); q.getResultList();
if (dict instanceof DB2Dictionary) { if (dict instanceof DB2Dictionary) {
if ((((DB2Dictionary)dict).getDb2ServerType() == 1) if ((((DB2Dictionary) dict).getDb2ServerType() == 1)
|| (((DB2Dictionary)dict).getDb2ServerType()== 2)) { || (((DB2Dictionary) dict).getDb2ServerType()== 2)) {
assertEquals(1, sql.size()); assertEquals(1, sql.size());
assertSQL("SELECT t0.id, t0.booleanField, t0.byteField," assertSQL("SELECT t0.id, t0.booleanField, t0.byteField,"
+ " t0.charField, t0.dateField, t0.doubleField," + " t0.charField, t0.dateField, t0.doubleField,"
@ -94,8 +94,8 @@ public class TestIsolationLevelOverride
+ " FOR UPDATE OF"); + " FOR UPDATE OF");
} }
// it is DB2 v82 or later // it is DB2 v82 or later
else if ((((DB2Dictionary)dict).getDb2ServerType() == 3) else if ((((DB2Dictionary) dict).getDb2ServerType() == 3)
|| (((DB2Dictionary)dict).getDb2ServerType() == 4)) { || (((DB2Dictionary) dict).getDb2ServerType() == 4)) {
assertEquals(1, sql.size()); assertEquals(1, sql.size());
assertSQL("SELECT t0.id, t0.booleanField, t0.byteField," assertSQL("SELECT t0.id, t0.booleanField, t0.byteField,"
+ " t0.charField, t0.dateField, t0.doubleField," + " t0.charField, t0.dateField, t0.doubleField,"
@ -105,7 +105,7 @@ public class TestIsolationLevelOverride
+ " FOR READ ONLY WITH RR USE AND KEEP " + " FOR READ ONLY WITH RR USE AND KEEP "
+ "UPDATE LOCKS"); + "UPDATE LOCKS");
} }
else if (((DB2Dictionary)dict).getDb2ServerType() == 5) { else if (((DB2Dictionary) dict).getDb2ServerType() == 5) {
assertEquals(1, sql.size()); assertEquals(1, sql.size());
assertSQL("SELECT t0.id, t0.booleanField, t0.byteField," assertSQL("SELECT t0.id, t0.booleanField, t0.byteField,"
+ " t0.charField, t0.dateField, t0.doubleField," + " t0.charField, t0.dateField, t0.doubleField,"
@ -126,8 +126,8 @@ public class TestIsolationLevelOverride
.setIsolation(IsolationLevel.SERIALIZABLE); .setIsolation(IsolationLevel.SERIALIZABLE);
em.find(AllFieldTypes.class, 0); em.find(AllFieldTypes.class, 0);
if (dict instanceof DB2Dictionary ) { if (dict instanceof DB2Dictionary ) {
if ((((DB2Dictionary)dict).getDb2ServerType() == 1) if ((((DB2Dictionary) dict).getDb2ServerType() == 1)
|| (((DB2Dictionary)dict).getDb2ServerType()== 2)) { || (((DB2Dictionary) dict).getDb2ServerType()== 2)) {
assertEquals(1, sql.size()); assertEquals(1, sql.size());
assertSQL("SELECT t0.booleanField, t0.byteField, " assertSQL("SELECT t0.booleanField, t0.byteField, "
+ "t0.charField, t0.dateField, t0.doubleField," + "t0.charField, t0.dateField, t0.doubleField,"
@ -137,8 +137,8 @@ public class TestIsolationLevelOverride
+ " FOR UPDATE OF optimize for 1 row"); + " FOR UPDATE OF optimize for 1 row");
} }
// it is DB2 v82 or later // it is DB2 v82 or later
else if ((((DB2Dictionary)dict).getDb2ServerType() == 3) else if ((((DB2Dictionary) dict).getDb2ServerType() == 3)
|| (((DB2Dictionary)dict).getDb2ServerType() == 4)) { || (((DB2Dictionary) dict).getDb2ServerType() == 4)) {
assertEquals(1, sql.size()); assertEquals(1, sql.size());
assertSQL("SELECT t0.booleanField, t0.byteField, " assertSQL("SELECT t0.booleanField, t0.byteField, "
+ "t0.charField, t0.dateField, t0.doubleField," + "t0.charField, t0.dateField, t0.doubleField,"
@ -148,7 +148,7 @@ public class TestIsolationLevelOverride
+ " FOR READ ONLY WITH RR USE AND KEEP UPDATE LOCKS" + " FOR READ ONLY WITH RR USE AND KEEP UPDATE LOCKS"
+ " optimize for 1 row"); + " optimize for 1 row");
} }
else if (((DB2Dictionary)dict).getDb2ServerType() == 5) { else if (((DB2Dictionary) dict).getDb2ServerType() == 5) {
assertEquals(1, sql.size()); assertEquals(1, sql.size());
assertSQL("SELECT t0.booleanField, t0.byteField, " assertSQL("SELECT t0.booleanField, t0.byteField, "
+ "t0.charField, t0.dateField, t0.doubleField," + "t0.charField, t0.dateField, t0.doubleField,"

View File

@ -59,8 +59,8 @@ public class TestSelectForUpdateOverride
em.find(AllFieldTypes.class, 0); em.find(AllFieldTypes.class, 0);
assertEquals(1, sql.size()); assertEquals(1, sql.size());
if (dict instanceof DB2Dictionary) { if (dict instanceof DB2Dictionary) {
if ((((DB2Dictionary)dict).getDb2ServerType() == 1) if ((((DB2Dictionary) dict).getDb2ServerType() == 1)
|| (((DB2Dictionary)dict).getDb2ServerType()== 2)) { || (((DB2Dictionary) dict).getDb2ServerType()== 2)) {
assertEquals(1, sql.size()); assertEquals(1, sql.size());
assertSQL("SELECT t0.booleanField, t0.byteField, " assertSQL("SELECT t0.booleanField, t0.byteField, "
+ "t0.charField, t0.dateField, t0.doubleField," + "t0.charField, t0.dateField, t0.doubleField,"
@ -70,8 +70,8 @@ public class TestSelectForUpdateOverride
+ " FOR UPDATE OF optimize for 1 row"); + " FOR UPDATE OF optimize for 1 row");
} }
// it is DB2 v82 or later // it is DB2 v82 or later
else if ((((DB2Dictionary)dict).getDb2ServerType() == 3) else if ((((DB2Dictionary) dict).getDb2ServerType() == 3)
|| (((DB2Dictionary)dict).getDb2ServerType() == 4)) { || (((DB2Dictionary) dict).getDb2ServerType() == 4)) {
assertEquals(1, sql.size()); assertEquals(1, sql.size());
assertSQL("SELECT t0.booleanField, t0.byteField, " assertSQL("SELECT t0.booleanField, t0.byteField, "
+ "t0.charField, t0.dateField, t0.doubleField," + "t0.charField, t0.dateField, t0.doubleField,"
@ -81,7 +81,7 @@ public class TestSelectForUpdateOverride
+ " FOR READ ONLY WITH RS USE AND KEEP UPDATE LOCKS" + " FOR READ ONLY WITH RS USE AND KEEP UPDATE LOCKS"
+ " optimize for 1 row"); + " optimize for 1 row");
} }
else if (((DB2Dictionary)dict).getDb2ServerType() == 5) { else if (((DB2Dictionary) dict).getDb2ServerType() == 5) {
assertEquals(1, sql.size()); assertEquals(1, sql.size());
assertSQL("SELECT t0.booleanField, t0.byteField, " assertSQL("SELECT t0.booleanField, t0.byteField, "
+ "t0.charField, t0.dateField, t0.doubleField," + "t0.charField, t0.dateField, t0.doubleField,"

View File

@ -30,7 +30,7 @@ public class ManyOneCompoundIdOwnerId implements Serializable {
static { static {
// register persistent class in JVM // register persistent class in JVM
try { Class.forName("org.apache.openjpa.persistence.relations.ManyOneCompoundIdOwner"); } try { Class.forName("org.apache.openjpa.persistence.relations.ManyOneCompoundIdOwner"); }
catch(Exception e) {} catch (Exception e) {}
} }
public long entityId; public long entityId;

View File

@ -343,7 +343,8 @@ public class TestManyOneAsId
+ "where e.longId = :cid and e.entityId.id = :id"); + "where e.longId = :cid and e.entityId.id = :id");
q.setParameter("cid", cid); q.setParameter("cid", cid);
q.setParameter("id", id); q.setParameter("id", id);
ManyOneCompoundIdOwner pc = (ManyOneCompoundIdOwner)q.getSingleResult(); ManyOneCompoundIdOwner pc = (ManyOneCompoundIdOwner)
q.getSingleResult();
assertNotNull(pc); assertNotNull(pc);
assertEquals("cparent", pc.getName()); assertEquals("cparent", pc.getName());
em.close(); em.close();

View File

@ -661,17 +661,17 @@ public class AnnotationPersistenceMetaDataParser
cls = cls.getEnclosingClass(); cls = cls.getEnclosingClass();
String rsrc = StringUtils.replace(cls.getName(), ".", "/"); String rsrc = StringUtils.replace(cls.getName(), ".", "/");
ClassLoader loader = (ClassLoader)AccessController.doPrivileged( ClassLoader loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(cls)); J2DoPrivHelper.getClassLoaderAction(cls));
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getSystemClassLoaderAction()); J2DoPrivHelper.getSystemClassLoaderAction());
if (loader == null) if (loader == null)
return null; return null;
URL url = (URL)AccessController.doPrivileged( URL url = (URL) AccessController.doPrivileged(
J2DoPrivHelper.getResourceAction(loader, rsrc + ".java")); J2DoPrivHelper.getResourceAction(loader, rsrc + ".java"));
if (url == null) { if (url == null) {
url = (URL)AccessController.doPrivileged( url = (URL) AccessController.doPrivileged(
J2DoPrivHelper.getResourceAction(loader, rsrc + ".class")); J2DoPrivHelper.getResourceAction(loader, rsrc + ".class"));
if (url == null) if (url == null)
return null; return null;
@ -756,7 +756,7 @@ public class AnnotationPersistenceMetaDataParser
else else
meta.setDetachedState(detached.fieldName()); meta.setDetachedState(detached.fieldName());
} else { } else {
Field[] fields = (Field[])AccessController.doPrivileged( Field[] fields = (Field[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredFieldsAction( J2DoPrivHelper.getDeclaredFieldsAction(
meta.getDescribedType())); meta.getDescribedType()));
for (int i = 0; i < fields.length; i++) for (int i = 0; i < fields.length; i++)
@ -798,8 +798,8 @@ public class AnnotationPersistenceMetaDataParser
MethodKey key; MethodKey key;
Set<MethodKey> seen = new HashSet<MethodKey>(); Set<MethodKey> seen = new HashSet<MethodKey>();
do { do {
for (Method m : (Method[])AccessController.doPrivileged( for (Method m : (Method[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodsAction( sup ))) { J2DoPrivHelper.getDeclaredMethodsAction(sup))) {
mods = m.getModifiers(); mods = m.getModifiers();
if (Modifier.isStatic(mods) || Modifier.isFinal(mods) || if (Modifier.isStatic(mods) || Modifier.isFinal(mods) ||
Object.class.equals(m.getDeclaringClass())) Object.class.equals(m.getDeclaringClass()))
@ -1050,7 +1050,7 @@ public class AnnotationPersistenceMetaDataParser
break; break;
case LOAD_FETCH_GROUP: case LOAD_FETCH_GROUP:
if (isMetaDataMode()) if (isMetaDataMode())
fmd.setLoadFetchGroup(((LoadFetchGroup)anno).value()); fmd.setLoadFetchGroup(((LoadFetchGroup) anno).value());
break; break;
case LRS: case LRS:
if (isMetaDataMode()) if (isMetaDataMode())

View File

@ -77,7 +77,7 @@ class MetaDataParsers {
for (LifecycleCallbacks lc: callbacks) { for (LifecycleCallbacks lc: callbacks) {
if (!(lc instanceof MethodLifecycleCallbacks)) if (!(lc instanceof MethodLifecycleCallbacks))
continue; continue;
Method exists = ((MethodLifecycleCallbacks)lc).getCallbackMethod(); Method exists = ((MethodLifecycleCallbacks) lc).getCallbackMethod();
if (!exists.getDeclaringClass().equals(method.getDeclaringClass())) if (!exists.getDeclaringClass().equals(method.getDeclaringClass()))
continue; continue;

View File

@ -252,11 +252,11 @@ public class PersistenceMetaDataDefaults
return ClassMetaData.ACCESS_UNKNOWN; return ClassMetaData.ACCESS_UNKNOWN;
int access = 0; int access = 0;
if (usesAccess((Field[])AccessController.doPrivileged( if (usesAccess((Field[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredFieldsAction( cls )))) J2DoPrivHelper.getDeclaredFieldsAction(cls))))
access |= ClassMetaData.ACCESS_FIELD; access |= ClassMetaData.ACCESS_FIELD;
if (usesAccess((Method[])AccessController.doPrivileged( if (usesAccess((Method[]) AccessController.doPrivileged(
J2DoPrivHelper.getDeclaredMethodsAction( cls )))) J2DoPrivHelper.getDeclaredMethodsAction(cls))))
access |= ClassMetaData.ACCESS_PROPERTY; access |= ClassMetaData.ACCESS_PROPERTY;
return (access == 0) ? getAccessType(cls.getSuperclass()) : access; return (access == 0) ? getAccessType(cls.getSuperclass()) : access;
} }

View File

@ -440,12 +440,12 @@ public class PersistenceMetaDataFactory
private File defaultXMLFile() { private File defaultXMLFile() {
ClassLoader loader = repos.getConfiguration(). ClassLoader loader = repos.getConfiguration().
getClassResolverInstance().getClassLoader(getClass(), null); getClassResolverInstance().getClassLoader(getClass(), null);
URL rsrc = (URL)AccessController.doPrivileged( URL rsrc = (URL) AccessController.doPrivileged(
J2DoPrivHelper.getResourceAction(loader, "META-INF/orm.xml")); J2DoPrivHelper.getResourceAction(loader, "META-INF/orm.xml"));
if (rsrc != null) { if (rsrc != null) {
File file = new File(rsrc.getFile()); File file = new File(rsrc.getFile());
if (((Boolean)AccessController.doPrivileged( if (((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( file ))).booleanValue()) J2DoPrivHelper.existsAction(file))).booleanValue())
return file; return file;
} }
return new File("orm.xml"); return new File("orm.xml");

View File

@ -109,7 +109,7 @@ public class PersistenceProductDerivation
@Override @Override
public boolean afterSpecificationSet(Configuration c) { public boolean afterSpecificationSet(Configuration c) {
if (!(c instanceof OpenJPAConfigurationImpl) if (!(c instanceof OpenJPAConfigurationImpl)
|| !SPEC_JPA.equals(((OpenJPAConfiguration)c).getSpecification())) || !SPEC_JPA.equals(((OpenJPAConfiguration) c).getSpecification()))
return false; return false;
OpenJPAConfigurationImpl conf = (OpenJPAConfigurationImpl) c; OpenJPAConfigurationImpl conf = (OpenJPAConfigurationImpl) c;
@ -248,23 +248,23 @@ public class PersistenceProductDerivation
String name, Map m, ClassLoader loader, boolean explicit) String name, Map m, ClassLoader loader, boolean explicit)
throws IOException { throws IOException {
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
Enumeration<URL> urls = null; Enumeration<URL> urls = null;
try { try {
urls = (Enumeration)AccessController.doPrivileged( urls = (Enumeration) AccessController.doPrivileged(
J2DoPrivHelper.getResourcesAction(loader, rsrc)); J2DoPrivHelper.getResourcesAction(loader, rsrc));
if (!urls.hasMoreElements()) { if (!urls.hasMoreElements()) {
if (!rsrc.startsWith("META-INF")) if (!rsrc.startsWith("META-INF"))
urls = (Enumeration)AccessController.doPrivileged( urls = (Enumeration) AccessController.doPrivileged(
J2DoPrivHelper.getResourcesAction( J2DoPrivHelper.getResourcesAction(
loader, "META-INF/" + rsrc)); loader, "META-INF/" + rsrc));
if (!urls.hasMoreElements()) if (!urls.hasMoreElements())
return null; return null;
} }
} catch( PrivilegedActionException pae ) { } catch (PrivilegedActionException pae) {
throw (IOException)pae.getException(); throw (IOException) pae.getException();
} }
ConfigurationParser parser = new ConfigurationParser(m); ConfigurationParser parser = new ConfigurationParser(m);
@ -346,7 +346,7 @@ public class PersistenceProductDerivation
return true; return true;
if (loader == null) if (loader == null)
loader = (ClassLoader)AccessController.doPrivileged( loader = (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction()); J2DoPrivHelper.getContextClassLoaderAction());
try { try {
if (PersistenceProviderImpl.class.isAssignableFrom if (PersistenceProviderImpl.class.isAssignableFrom

View File

@ -94,7 +94,7 @@ public class PersistenceUnitInfoImpl
public ClassLoader getNewTempClassLoader() { public ClassLoader getNewTempClassLoader() {
return new TemporaryClassLoader( return new TemporaryClassLoader(
(ClassLoader)AccessController.doPrivileged( (ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getContextClassLoaderAction())); J2DoPrivHelper.getContextClassLoaderAction()));
} }
@ -204,7 +204,7 @@ public class PersistenceUnitInfoImpl
MultiClassLoader loader = new MultiClassLoader(); MultiClassLoader loader = new MultiClassLoader();
loader.addClassLoader(getClass().getClassLoader()); loader.addClassLoader(getClass().getClassLoader());
loader.addClassLoader(MultiClassLoader.THREAD_LOADER); loader.addClassLoader(MultiClassLoader.THREAD_LOADER);
URL url = (URL)AccessController.doPrivileged( URL url = (URL) AccessController.doPrivileged(
J2DoPrivHelper.getResourceAction(loader, name)); J2DoPrivHelper.getResourceAction(loader, name));
if (url != null) { if (url != null) {
addJarFile(url); addJarFile(url);
@ -212,7 +212,7 @@ public class PersistenceUnitInfoImpl
} }
// jar file is not a resource; check classpath // jar file is not a resource; check classpath
String[] cp = ((String)AccessController.doPrivileged( String[] cp = ((String) AccessController.doPrivileged(
J2DoPrivHelper.getPropertyAction("java.class.path"))) J2DoPrivHelper.getPropertyAction("java.class.path")))
.split(J2DoPrivHelper.getPathSeparator()); .split(J2DoPrivHelper.getPathSeparator());
for (int i = 0; i < cp.length; i++) { for (int i = 0; i < cp.length; i++) {

View File

@ -1121,7 +1121,7 @@ public class XMLPersistenceMetaDataParser
} }
} catch (Exception e) { } catch (Exception e) {
if (e instanceof PrivilegedActionException) if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException)e).getException(); e = ((PrivilegedActionException) e).getException();
throw getException(_loc.get("invalid-attr", name, meta), e); throw getException(_loc.get("invalid-attr", name, meta), e);
} }

View File

@ -80,10 +80,10 @@ public class XMLFileHandler {
*/ */
public Collection load(ClassMetaData meta) { public Collection load(ClassMetaData meta) {
File f = getFile(meta); File f = getFile(meta);
if (!((Boolean)AccessController.doPrivileged( if (!((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( f ))).booleanValue() || J2DoPrivHelper.existsAction(f))).booleanValue() ||
((Long)AccessController.doPrivileged( ((Long) AccessController.doPrivileged(
J2DoPrivHelper.lengthAction( f ))).longValue() == 0) J2DoPrivHelper.lengthAction(f))).longValue() == 0)
return Collections.EMPTY_SET; return Collections.EMPTY_SET;
try { try {
return read(f); return read(f);
@ -133,10 +133,10 @@ public class XMLFileHandler {
throw new InternalException(); throw new InternalException();
File f = getFile(meta); File f = getFile(meta);
if (!((Boolean)AccessController.doPrivileged( if (!((Boolean) AccessController.doPrivileged(
J2DoPrivHelper.existsAction( f.getParentFile() ))).booleanValue()) J2DoPrivHelper.existsAction(f.getParentFile()))).booleanValue())
AccessController.doPrivileged( AccessController.doPrivileged(
J2DoPrivHelper.mkdirsAction( f.getParentFile() )); J2DoPrivHelper.mkdirsAction(f.getParentFile()));
FileWriter fw = null; FileWriter fw = null;
try { try {