You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2014/02/19 16:48:09 UTC
svn commit: r1569795 [23/35] - in
/tomee/tomee/trunk/container/openejb-core/src/main: config/pmd/
java/javax/xml/ws/ java/javax/xml/ws/wsaddressing/ java/org/apache/openejb/
java/org/apache/openejb/assembler/
java/org/apache/openejb/assembler/classic/ ...
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/ConnectorCallbackHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/ConnectorCallbackHandler.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/ConnectorCallbackHandler.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/ConnectorCallbackHandler.java Wed Feb 19 15:47:58 2014
@@ -46,29 +46,29 @@ public class ConnectorCallbackHandler im
private String[] groupsArray;
private final String securityRealmName;
- public ConnectorCallbackHandler(String securityRealmName) {
+ public ConnectorCallbackHandler(final String securityRealmName) {
this.securityRealmName = securityRealmName;
}
- public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
- for (Callback callback : callbacks) {
+ public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ for (final Callback callback : callbacks) {
// jaspi to server communication
if (callback instanceof CallerPrincipalCallback) {
callerPrincipal = ((CallerPrincipalCallback) callback).getPrincipal();
} else if (callback instanceof GroupPrincipalCallback) {
groupsArray = ((GroupPrincipalCallback) callback).getGroups();
} else if (callback instanceof PasswordValidationCallback) {
- PasswordValidationCallback passwordValidationCallback = (PasswordValidationCallback) callback;
+ final PasswordValidationCallback passwordValidationCallback = (PasswordValidationCallback) callback;
final String userName = passwordValidationCallback.getUsername();
final char[] password = passwordValidationCallback.getPassword();
- SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
+ final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
try {
- Object loginObj = securityService.login(securityRealmName, userName, password == null ? "" : new String(password));
+ final Object loginObj = securityService.login(securityRealmName, userName, password == null ? "" : new String(password));
securityService.associate(loginObj);
callerPrincipal = securityService.getCallerPrincipal();
passwordValidationCallback.setResult(true);
- } catch (LoginException e) {
+ } catch (final LoginException e) {
passwordValidationCallback.setResult(false);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/JaccProvider.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/JaccProvider.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/JaccProvider.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/JaccProvider.java Wed Feb 19 15:47:58 2014
@@ -39,7 +39,7 @@ public abstract class JaccProvider {
return jaccProvider;
}
- public static void set(JaccProvider provider) {
+ public static void set(final JaccProvider provider) {
// todo add a security check
jaccProvider = provider;
}
@@ -72,12 +72,12 @@ public abstract class JaccProvider {
if (factoryClassName[0] == null)
throw new ClassNotFoundException("Property " + FACTORY_NAME + " not set");
- Thread currentThread = Thread.currentThread();
- ClassLoader tccl = currentThread.getContextClassLoader();
+ final Thread currentThread = Thread.currentThread();
+ final ClassLoader tccl = currentThread.getContextClassLoader();
return Class.forName(factoryClassName[0], true, tccl).newInstance();
}
});
- } catch (PrivilegedActionException pae) {
+ } catch (final PrivilegedActionException pae) {
if (pae.getException() instanceof ClassNotFoundException) {
throw (ClassNotFoundException) pae.getException();
} else if (pae.getException() instanceof InstantiationException) {
@@ -95,11 +95,11 @@ public abstract class JaccProvider {
install();
}
- public PolicyConfiguration getPolicyConfiguration(String contextID, boolean remove) throws PolicyContextException {
+ public PolicyConfiguration getPolicyConfiguration(final String contextID, final boolean remove) throws PolicyContextException {
return get().getPolicyConfiguration(contextID, remove);
}
- public boolean inService(String contextID) throws PolicyContextException {
+ public boolean inService(final String contextID) throws PolicyContextException {
return get().inService(contextID);
}
}
@@ -110,7 +110,7 @@ public abstract class JaccProvider {
install();
}
- public PermissionCollection getPermissions(CodeSource codesource) {
+ public PermissionCollection getPermissions(final CodeSource codesource) {
return get().getPermissions(codesource);
}
@@ -118,7 +118,7 @@ public abstract class JaccProvider {
get().refresh();
}
- public boolean implies(ProtectionDomain domain, Permission permission) {
+ public boolean implies(final ProtectionDomain domain, final Permission permission) {
return get().implies(domain, permission);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/SecurityContextHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/SecurityContextHandler.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/SecurityContextHandler.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/SecurityContextHandler.java Wed Feb 19 15:47:58 2014
@@ -53,7 +53,7 @@ public class SecurityContextHandler impl
if (loginObj != null) {
try {
securityService.logout(loginObj);
- } catch (LoginException e) {
+ } catch (final LoginException e) {
//Ignore
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/SecurityServiceImpl.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/SecurityServiceImpl.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/SecurityServiceImpl.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/SecurityServiceImpl.java Wed Feb 19 15:47:58 2014
@@ -53,7 +53,7 @@ public class SecurityServiceImpl extends
// They should have a chance to perform any special
// boot-time code that they may need.
login("", "");
- } catch (Throwable e) {
+ } catch (final Throwable e) {
//Ignore
}
}
@@ -70,7 +70,7 @@ public class SecurityServiceImpl extends
try {
System.setProperty("java.security.auth.login.config", URLDecoder.decode(loginConfig.toExternalForm(), "UTF8"));
- } catch (UnsupportedEncodingException e) {
+ } catch (final UnsupportedEncodingException e) {
System.setProperty("java.security.auth.login.config", URLDecoder.decode(loginConfig.toExternalForm()));
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/GroupPrincipal.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/GroupPrincipal.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/GroupPrincipal.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/GroupPrincipal.java Wed Feb 19 15:47:58 2014
@@ -26,7 +26,7 @@ public class GroupPrincipal implements P
private final String name;
private transient int hash;
- public GroupPrincipal(String name) {
+ public GroupPrincipal(final String name) {
if (name == null) throw new IllegalArgumentException("name cannot be null");
this.name = name;
}
@@ -35,7 +35,7 @@ public class GroupPrincipal implements P
return name;
}
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/PropertiesLoginModule.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/PropertiesLoginModule.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/PropertiesLoginModule.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/PropertiesLoginModule.java Wed Feb 19 15:47:58 2014
@@ -61,13 +61,13 @@ public class PropertiesLoginModule imple
private URL usersUrl;
private URL groupsUrl;
- public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
+ public void initialize(final Subject subject, final CallbackHandler callbackHandler, final Map sharedState, final Map options) {
this.subject = subject;
this.callbackHandler = callbackHandler;
debug = log.isDebugEnabled() || "true".equalsIgnoreCase((String) options.get("Debug"));
- String usersFile = (String) options.get(USER_FILE) + "";
- String groupsFile = (String) options.get(GROUP_FILE) + "";
+ final String usersFile = (String) options.get(USER_FILE) + "";
+ final String groupsFile = (String) options.get(GROUP_FILE) + "";
usersUrl = ConfUtils.getConfResource(usersFile);
groupsUrl = ConfUtils.getConfResource(groupsFile);
@@ -81,25 +81,25 @@ public class PropertiesLoginModule imple
public boolean login() throws LoginException {
try {
users = readProperties(usersUrl);
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
throw new LoginException("Unable to load user properties file " + usersUrl.getFile());
}
try {
groups = readProperties(groupsUrl);
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
throw new LoginException("Unable to load group properties file " + groupsUrl.getFile());
}
- Callback[] callbacks = new Callback[2];
+ final Callback[] callbacks = new Callback[2];
callbacks[0] = new NameCallback("Username: ");
callbacks[1] = new PasswordCallback("Password: ", false);
try {
callbackHandler.handle(callbacks);
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
throw new LoginException(ioe.getMessage());
- } catch (UnsupportedCallbackException uce) {
+ } catch (final UnsupportedCallbackException uce) {
throw new LoginException(uce.getMessage() + " not available to obtain information from user");
}
@@ -107,7 +107,7 @@ public class PropertiesLoginModule imple
char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword();
if (tmpPassword == null) tmpPassword = new char[0];
- String password = users.getProperty(user);
+ final String password = users.getProperty(user);
if (password == null) throw new FailedLoginException("User does not exist");
if (!password.equals(new String(tmpPassword))) throw new FailedLoginException("Password does not match");
@@ -123,9 +123,9 @@ public class PropertiesLoginModule imple
public boolean commit() throws LoginException {
principals.add(new UserPrincipal(user));
- for (Enumeration enumeration = groups.keys(); enumeration.hasMoreElements();) {
- String name = (String) enumeration.nextElement();
- String[] userList = ((String) groups.getProperty(name) + "").split(",");
+ for (final Enumeration enumeration = groups.keys(); enumeration.hasMoreElements();) {
+ final String name = (String) enumeration.nextElement();
+ final String[] userList = ((String) groups.getProperty(name) + "").split(",");
for (int i = 0; i < userList.length; i++) {
if (user.equals(userList[i])) {
principals.add(new GroupPrincipal(name));
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/SQLLoginModule.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/SQLLoginModule.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/SQLLoginModule.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/SQLLoginModule.java Wed Feb 19 15:47:58 2014
@@ -98,14 +98,14 @@ public class SQLLoginModule implements L
private final Set<String> groups = new HashSet<String>();
private final Set<Principal> allPrincipals = new HashSet<Principal>();
- public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
+ public void initialize(final Subject subject, final CallbackHandler callbackHandler, final Map sharedState, final Map options) {
this.subject = subject;
this.handler = callbackHandler;
- for (Object key : options.keySet()) {
- Option option = Option.findByName((String) key);
+ for (final Object key : options.keySet()) {
+ final Option option = Option.findByName((String) key);
if (option != null) {
- String value = (String) options.get(key);
+ final String value = (String) options.get(key);
optionsMap.put(option, value.trim());
} else {
log.warning("Ignoring option: {0}. Not supported.", key);
@@ -122,7 +122,7 @@ public class SQLLoginModule implements L
// Check if the digest algorithm is available
try {
MessageDigest.getInstance(digest);
- } catch (NoSuchAlgorithmException e) {
+ } catch (final NoSuchAlgorithmException e) {
initError(e, "Digest algorithm %s is not available.", digest);
}
@@ -132,18 +132,18 @@ public class SQLLoginModule implements L
}
if (optionsMap.containsKey(Option.DATABASE_POOL_NAME)) {
- String dataSourceName = optionsMap.get(Option.DATABASE_POOL_NAME);
- ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
+ final String dataSourceName = optionsMap.get(Option.DATABASE_POOL_NAME);
+ final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
try {
dataSource = (DataSource) containerSystem.getJNDIContext().lookup("openejb/Resource/" + dataSourceName);
- } catch (NamingException e) {
+ } catch (final NamingException e) {
initError(e, "Data source %s not found.", dataSourceName);
}
} else if (optionsMap.containsKey(Option.CONNECTION_URL)) {
connectionURL = optionsMap.get(Option.CONNECTION_URL);
- String user = optionsMap.get(Option.USER);
- String password = optionsMap.get(Option.PASSWORD);
- String driverName = optionsMap.get(Option.DRIVER);
+ final String user = optionsMap.get(Option.USER);
+ final String password = optionsMap.get(Option.PASSWORD);
+ final String driverName = optionsMap.get(Option.DRIVER);
properties = new Properties();
if (user != null) {
@@ -155,12 +155,12 @@ public class SQLLoginModule implements L
}
if (driverName != null) {
- ClassLoader cl = getClass().getClassLoader();
+ final ClassLoader cl = getClass().getClassLoader();
try {
driver = (Driver) cl.loadClass(driverName).newInstance();
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
initError(e, "Driver class %s is not available. Perhaps you need to add it as a dependency in your deployment plan?", driverName);
- } catch (Exception e) {
+ } catch (final Exception e) {
initError(e, "Unable to load, instantiate, register driver %s: %s", driverName, e.getMessage());
}
}
@@ -169,8 +169,8 @@ public class SQLLoginModule implements L
}
}
- private void initError(Exception e, String format, Object... args) {
- String message = String.format(format, args);
+ private void initError(final Exception e, final String format, final Object... args) {
+ final String message = String.format(format, args);
log.error("Initialization failed. {0}", message);
throw new IllegalArgumentException(message, e);
}
@@ -184,16 +184,16 @@ public class SQLLoginModule implements L
*/
public boolean login() throws LoginException {
loginSucceeded = false;
- Callback[] callbacks = new Callback[2];
+ final Callback[] callbacks = new Callback[2];
callbacks[0] = new NameCallback("User name");
callbacks[1] = new PasswordCallback("Password", false);
try {
handler.handle(callbacks);
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
throw (LoginException) new LoginException().initCause(ioe);
- } catch (UnsupportedCallbackException uce) {
+ } catch (final UnsupportedCallbackException uce) {
throw (LoginException) new LoginException().initCause(uce);
}
@@ -205,11 +205,11 @@ public class SQLLoginModule implements L
throw new FailedLoginException();
}
- char[] provided = ((PasswordCallback) callbacks[1]).getPassword();
+ final char[] provided = ((PasswordCallback) callbacks[1]).getPassword();
cbPassword = provided == null ? null : new String(provided);
try {
- Connection conn;
+ final Connection conn;
if (dataSource != null) {
conn = dataSource.getConnection();
} else if (driver != null) {
@@ -221,17 +221,17 @@ public class SQLLoginModule implements L
try {
PreparedStatement statement = conn.prepareStatement(userSelect);
try {
- int count = statement.getParameterMetaData().getParameterCount();
+ final int count = statement.getParameterMetaData().getParameterCount();
for (int i = 0; i < count; i++) {
statement.setObject(i + 1, cbUsername);
}
- ResultSet result = statement.executeQuery();
+ final ResultSet result = statement.executeQuery();
try {
boolean found = false;
while (result.next()) {
- String userName = result.getString(1);
- String userPassword = result.getString(2);
+ final String userName = result.getString(1);
+ final String userPassword = result.getString(2);
if (cbUsername.equals(userName)) {
found = true;
@@ -254,16 +254,16 @@ public class SQLLoginModule implements L
statement = conn.prepareStatement(groupSelect);
try {
- int count = statement.getParameterMetaData().getParameterCount();
+ final int count = statement.getParameterMetaData().getParameterCount();
for (int i = 0; i < count; i++) {
statement.setObject(i + 1, cbUsername);
}
- ResultSet result = statement.executeQuery();
+ final ResultSet result = statement.executeQuery();
try {
while (result.next()) {
- String userName = result.getString(1);
- String groupName = result.getString(2);
+ final String userName = result.getString(1);
+ final String groupName = result.getString(2);
if (cbUsername.equals(userName)) {
groups.add(groupName);
@@ -278,19 +278,19 @@ public class SQLLoginModule implements L
} finally {
conn.close();
}
- } catch (LoginException e) {
+ } catch (final LoginException e) {
// Clear out the private state
cbUsername = null;
cbPassword = null;
groups.clear();
throw e;
- } catch (SQLException sqle) {
+ } catch (final SQLException sqle) {
// Clear out the private state
cbUsername = null;
cbPassword = null;
groups.clear();
throw (LoginException) new LoginException("SQL error").initCause(sqle);
- } catch (Exception e) {
+ } catch (final Exception e) {
// Clear out the private state
cbUsername = null;
cbPassword = null;
@@ -312,7 +312,7 @@ public class SQLLoginModule implements L
if (cbUsername != null) {
allPrincipals.add(new UserPrincipal(cbUsername));
}
- for (String group : groups) {
+ for (final String group : groups) {
allPrincipals.add(new GroupPrincipal(group));
}
subject.getPrincipals().addAll(allPrincipals);
@@ -359,7 +359,7 @@ public class SQLLoginModule implements L
* @param provided User provided password in clear text
* @return true If the password is correct
*/
- private boolean checkPassword(String real, String provided) {
+ private boolean checkPassword(final String real, final String provided) {
if (real == null && provided == null) {
return true;
}
@@ -376,15 +376,15 @@ public class SQLLoginModule implements L
try {
// Digest the user provided password
- MessageDigest md = MessageDigest.getInstance(digest);
- byte[] data = md.digest(provided.getBytes());
+ final MessageDigest md = MessageDigest.getInstance(digest);
+ final byte[] data = md.digest(provided.getBytes());
if (encoding == null || "hex".equalsIgnoreCase(encoding)) {
return real.equalsIgnoreCase(HexConverter.bytesToHex(data));
} else if ("base64".equalsIgnoreCase(encoding)) {
return real.equals(new String(Base64.encodeBase64(data)));
}
- } catch (NoSuchAlgorithmException e) {
+ } catch (final NoSuchAlgorithmException e) {
// Should not occur. Availability of algorithm has been checked at initialization
log.error("Should not occur. Availability of algorithm has been checked at initialization.", e);
}
@@ -404,12 +404,12 @@ public class SQLLoginModule implements L
public final String name;
- private Option(String name) {
+ private Option(final String name) {
this.name = name;
}
- public static Option findByName(String name) {
- for (Option opt : values()) {
+ public static Option findByName(final String name) {
+ for (final Option opt : values()) {
if (opt.name.equals(name))
return opt;
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ScriptLoginModule.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ScriptLoginModule.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ScriptLoginModule.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ScriptLoginModule.java Wed Feb 19 15:47:58 2014
@@ -63,14 +63,14 @@ public class ScriptLoginModule implement
public final String pass;
public final Set<String> groups = new HashSet<String>();
- private UserData(String user, String pass) {
+ private UserData(final String user, final String pass) {
this.user = user;
this.pass = pass;
}
}
@Override
- public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
+ public void initialize(final Subject subject, final CallbackHandler callbackHandler, final Map<String, ?> sharedState, final Map<String, ?> options) {
this.options = options;
this.subject = subject;
this.callbackHandler = callbackHandler;
@@ -83,9 +83,9 @@ public class ScriptLoginModule implement
callbacks[1] = new PasswordCallback("Password: ", false);
try {
this.callbackHandler.handle(callbacks);
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
throw new LoginException(ioe.getMessage());
- } catch (UnsupportedCallbackException uce) {
+ } catch (final UnsupportedCallbackException uce) {
throw new LoginException(uce.getMessage() + " not available to obtain information from user");
}
@@ -101,7 +101,7 @@ public class ScriptLoginModule implement
return new UserData(user, password);
}
- private File getScriptFile(String path) {
+ private File getScriptFile(final String path) {
if (path == null || "".equals(path)) {
final File result = new File(System.getProperty("openejb.home"), "conf/loginscript.js");
if (result.exists()) {
@@ -117,7 +117,7 @@ public class ScriptLoginModule implement
if (result.exists()) {
return result;
}
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
@@ -154,7 +154,7 @@ public class ScriptLoginModule implement
final String scriptText;
try {
scriptText = new Scanner(script).useDelimiter("\\Z").next();
- } catch (FileNotFoundException e) {
+ } catch (final FileNotFoundException e) {
throw new LoginException("Invalid login script URI.");
}
@@ -175,7 +175,7 @@ public class ScriptLoginModule implement
final List<String> myGroups;
try {
myGroups = (List) engine.eval(scriptText, newContext);
- } catch (ScriptException e) {
+ } catch (final ScriptException e) {
throw new LoginException("Cannot execute login script. Msg: " + e.getMessage());
}
this.userData.groups.addAll(myGroups);
@@ -187,7 +187,7 @@ public class ScriptLoginModule implement
public boolean commit() throws LoginException {
this.principals.add(new UserPrincipal(this.userData.user));
- for (String myGroup : this.userData.groups) {
+ for (final String myGroup : this.userData.groups) {
principals.add(new GroupPrincipal(myGroup));
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ServiceProviderLoginModule.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ServiceProviderLoginModule.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ServiceProviderLoginModule.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ServiceProviderLoginModule.java Wed Feb 19 15:47:58 2014
@@ -54,14 +54,14 @@ public class ServiceProviderLoginModule
public final String pass;
public final Set<String> groups = new HashSet<String>();
- private UserData(String user, String pass) {
+ private UserData(final String user, final String pass) {
this.user = user;
this.pass = pass;
}
}
@Override
- public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
+ public void initialize(final Subject subject, final CallbackHandler callbackHandler, final Map<String, ?> sharedState, final Map<String, ?> options) {
this.subject = subject;
this.callbackHandler = callbackHandler;
this.loader = ServiceLoader.load(LoginProvider.class);
@@ -74,9 +74,9 @@ public class ServiceProviderLoginModule
callbacks[1] = new PasswordCallback("Password: ", false);
try {
this.callbackHandler.handle(callbacks);
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
throw new LoginException(ioe.getMessage());
- } catch (UnsupportedCallbackException uce) {
+ } catch (final UnsupportedCallbackException uce) {
throw new LoginException(uce.getMessage() + " not available to obtain information from user");
}
@@ -115,7 +115,7 @@ public class ServiceProviderLoginModule
public boolean commit() throws LoginException {
this.principals.add(new UserPrincipal(this.userData.user));
- for (String myGroup : this.userData.groups) {
+ for (final String myGroup : this.userData.groups) {
principals.add(new GroupPrincipal(myGroup));
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/UserPrincipal.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/UserPrincipal.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/UserPrincipal.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/UserPrincipal.java Wed Feb 19 15:47:58 2014
@@ -29,7 +29,7 @@ public class UserPrincipal implements Pr
private final String name;
private transient int hash;
- public UserPrincipal(String name) {
+ public UserPrincipal(final String name) {
if (name == null) throw new IllegalArgumentException("name cannot be null");
this.name = name;
}
@@ -38,7 +38,7 @@ public class UserPrincipal implements Pr
return name;
}
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/UsernamePasswordCallbackHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/UsernamePasswordCallbackHandler.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/UsernamePasswordCallbackHandler.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/UsernamePasswordCallbackHandler.java Wed Feb 19 15:47:58 2014
@@ -31,23 +31,23 @@ public class UsernamePasswordCallbackHan
private final String username;
private final String password;
- public UsernamePasswordCallbackHandler(String username, String password) {
+ public UsernamePasswordCallbackHandler(final String username, final String password) {
this.username = username;
this.password = password;
}
- public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
- Callback callback = callbacks[i];
+ final Callback callback = callbacks[i];
if (callback instanceof PasswordCallback) {
- PasswordCallback passwordCallback = (PasswordCallback) callback;
+ final PasswordCallback passwordCallback = (PasswordCallback) callback;
if (password == null) {
passwordCallback.setPassword(null);
} else {
passwordCallback.setPassword(password.toCharArray());
}
} else if (callback instanceof NameCallback) {
- NameCallback nameCallback = (NameCallback) callback;
+ final NameCallback nameCallback = (NameCallback) callback;
if (username == null) {
nameCallback.setName(null);
} else {
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicJaccProvider.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicJaccProvider.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicJaccProvider.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicJaccProvider.java Wed Feb 19 15:47:58 2014
@@ -41,7 +41,7 @@ public class BasicJaccProvider extends J
systemPolicy = Policy.getPolicy();
}
- public PolicyConfiguration getPolicyConfiguration(String contextID, boolean remove) throws PolicyContextException {
+ public PolicyConfiguration getPolicyConfiguration(final String contextID, final boolean remove) throws PolicyContextException {
BasicPolicyConfiguration configuration = configurations.get(contextID);
if (configuration == null) {
@@ -54,33 +54,33 @@ public class BasicJaccProvider extends J
return configuration;
}
- protected BasicPolicyConfiguration createPolicyConfiguration(String contextID) {
+ protected BasicPolicyConfiguration createPolicyConfiguration(final String contextID) {
return new BasicPolicyConfiguration(contextID);
}
- public boolean inService(String contextID) throws PolicyContextException {
- PolicyConfiguration configuration = getPolicyConfiguration(contextID, false);
+ public boolean inService(final String contextID) throws PolicyContextException {
+ final PolicyConfiguration configuration = getPolicyConfiguration(contextID, false);
return configuration.inService();
}
- public PermissionCollection getPermissions(CodeSource codesource) {
+ public PermissionCollection getPermissions(final CodeSource codesource) {
return systemPolicy == null ? null: systemPolicy.getPermissions(codesource);
}
public void refresh() {
}
- public boolean implies(ProtectionDomain domain, Permission permission) {
- String contextID = PolicyContext.getContextID();
+ public boolean implies(final ProtectionDomain domain, final Permission permission) {
+ final String contextID = PolicyContext.getContextID();
if (contextID != null) {
try {
- BasicPolicyConfiguration configuration = configurations.get(contextID);
+ final BasicPolicyConfiguration configuration = configurations.get(contextID);
if (configuration == null || !configuration.inService()) return false;
return configuration.implies(domain, permission);
- } catch (PolicyContextException e) {
+ } catch (final PolicyContextException e) {
// no-op
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicPolicyConfiguration.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicPolicyConfiguration.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicPolicyConfiguration.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicPolicyConfiguration.java Wed Feb 19 15:47:58 2014
@@ -44,7 +44,7 @@ public class BasicPolicyConfiguration im
protected PermissionCollection unchecked = null;
protected PermissionCollection excluded = null;
- protected BasicPolicyConfiguration(String contextID) {
+ protected BasicPolicyConfiguration(final String contextID) {
this.contextID = contextID;
this.state = OPEN;
}
@@ -53,20 +53,20 @@ public class BasicPolicyConfiguration im
return contextID;
}
- public boolean implies(ProtectionDomain domain, Permission permission) {
+ public boolean implies(final ProtectionDomain domain, final Permission permission) {
if (excluded != null && excluded.implies(permission)) return false;
if (unchecked != null && unchecked.implies(permission)) return true;
- Principal[] principals = domain.getPrincipals();
+ final Principal[] principals = domain.getPrincipals();
if (principals.length == 0) return false;
- RoleResolver roleResolver = SystemInstance.get().getComponent(RoleResolver.class);
- Set<String> roles = roleResolver.getLogicalRoles(principals, rolePermissionsMap.keySet());
+ final RoleResolver roleResolver = SystemInstance.get().getComponent(RoleResolver.class);
+ final Set<String> roles = roleResolver.getLogicalRoles(principals, rolePermissionsMap.keySet());
- for (String role : roles) {
- PermissionCollection permissions = rolePermissionsMap.get(role);
+ for (final String role : roles) {
+ final PermissionCollection permissions = rolePermissionsMap.get(role);
if (permissions != null && permissions.implies(permission)) return true;
}
@@ -74,16 +74,16 @@ public class BasicPolicyConfiguration im
return false;
}
- public void addToRole(String roleName, PermissionCollection permissions) throws PolicyContextException {
+ public void addToRole(final String roleName, final PermissionCollection permissions) throws PolicyContextException {
if (state != OPEN) throw new UnsupportedOperationException("Not in an open state");
- Enumeration e = permissions.elements();
+ final Enumeration e = permissions.elements();
while (e.hasMoreElements()) {
addToRole(roleName, (Permission) e.nextElement());
}
}
- public void addToRole(String roleName, Permission permission) throws PolicyContextException {
+ public void addToRole(final String roleName, final Permission permission) throws PolicyContextException {
if (state != OPEN) throw new UnsupportedOperationException("Not in an open state");
PermissionCollection permissions = rolePermissionsMap.get(roleName);
@@ -94,16 +94,16 @@ public class BasicPolicyConfiguration im
permissions.add(permission);
}
- public void addToUncheckedPolicy(PermissionCollection permissions) throws PolicyContextException {
+ public void addToUncheckedPolicy(final PermissionCollection permissions) throws PolicyContextException {
if (state != OPEN) throw new UnsupportedOperationException("Not in an open state");
- Enumeration e = permissions.elements();
+ final Enumeration e = permissions.elements();
while (e.hasMoreElements()) {
addToUncheckedPolicy((Permission) e.nextElement());
}
}
- public void addToUncheckedPolicy(Permission permission) throws PolicyContextException {
+ public void addToUncheckedPolicy(final Permission permission) throws PolicyContextException {
if (state != OPEN) {
throw new UnsupportedOperationException("Not in an open state");
}
@@ -115,16 +115,16 @@ public class BasicPolicyConfiguration im
unchecked.add(permission);
}
- public void addToExcludedPolicy(PermissionCollection permissions) throws PolicyContextException {
+ public void addToExcludedPolicy(final PermissionCollection permissions) throws PolicyContextException {
if (state != OPEN) throw new UnsupportedOperationException("Not in an open state");
- Enumeration e = permissions.elements();
+ final Enumeration e = permissions.elements();
while (e.hasMoreElements()) {
addToExcludedPolicy((Permission) e.nextElement());
}
}
- public void addToExcludedPolicy(Permission permission) throws PolicyContextException {
+ public void addToExcludedPolicy(final Permission permission) throws PolicyContextException {
if (state != OPEN) {
throw new UnsupportedOperationException("Not in an open state");
}
@@ -136,7 +136,7 @@ public class BasicPolicyConfiguration im
excluded.add(permission);
}
- public void removeRole(String roleName) throws PolicyContextException {
+ public void removeRole(final String roleName) throws PolicyContextException {
if (state != OPEN) throw new UnsupportedOperationException("Not in an open state");
rolePermissionsMap.remove(roleName);
@@ -154,7 +154,7 @@ public class BasicPolicyConfiguration im
excluded = null;
}
- public void linkConfiguration(PolicyConfiguration link) throws PolicyContextException {
+ public void linkConfiguration(final PolicyConfiguration link) throws PolicyContextException {
if (state != OPEN) throw new UnsupportedOperationException("Not in an open state");
}
@@ -176,7 +176,7 @@ public class BasicPolicyConfiguration im
//spec p. 31 3.1.7 on the effects of remove:
//If the getPolicyConfiguration method is used, the value true should be passed as the second
// argument to cause the corresponding policy statements to be deleted from the context.
- public void open(boolean remove) {
+ public void open(final boolean remove) {
if (remove) {
rolePermissionsMap.clear();
unchecked = null;
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/EjbWsContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/EjbWsContext.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/EjbWsContext.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/EjbWsContext.java Wed Feb 19 15:47:58 2014
@@ -29,13 +29,13 @@ import java.security.Principal;
public class EjbWsContext implements WebServiceContext {
private SessionContext context;
- public EjbWsContext(SessionContext context) {
+ public EjbWsContext(final SessionContext context) {
this.context = context;
}
public MessageContext getMessageContext() {
- ThreadContext threadContext = ThreadContext.getThreadContext();
- MessageContext messageContext = threadContext.get(MessageContext.class);
+ final ThreadContext threadContext = ThreadContext.getThreadContext();
+ final MessageContext messageContext = threadContext.get(MessageContext.class);
if (messageContext == null) {
throw new IllegalStateException("Only calls on the service-endpoint have a MessageContext.");
}
@@ -46,24 +46,24 @@ public class EjbWsContext implements Web
return this.context.getCallerPrincipal();
}
- public boolean isUserInRole(String roleName) {
+ public boolean isUserInRole(final String roleName) {
return this.context.isCallerInRole(roleName);
}
private AddressingSupport getAddressingSupport() {
- ThreadContext threadContext = ThreadContext.getThreadContext();
- AddressingSupport wsaSupport = threadContext.get(AddressingSupport.class);
+ final ThreadContext threadContext = ThreadContext.getThreadContext();
+ final AddressingSupport wsaSupport = threadContext.get(AddressingSupport.class);
if (wsaSupport == null) {
throw new IllegalStateException("Only calls on the service-endpoint can get the EndpointReference.");
}
return wsaSupport;
}
- public EndpointReference getEndpointReference(Element... referenceParameters) {
+ public EndpointReference getEndpointReference(final Element... referenceParameters) {
return getAddressingSupport().getEndpointReference(referenceParameters);
}
- public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) {
+ public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz, final Element... referenceParameters) {
return getAddressingSupport().getEndpointReference(clazz, referenceParameters);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/Instance.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/Instance.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/Instance.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/Instance.java Wed Feb 19 15:47:58 2014
@@ -29,7 +29,7 @@ public class Instance {
public final ReadWriteLock lock;
public final CreationalContext creationalContext;
- public Instance(Object bean, Map<String, Object> interceptors, CreationalContext creationalContext, ReadWriteLock lock) {
+ public Instance(final Object bean, final Map<String, Object> interceptors, final CreationalContext creationalContext, final ReadWriteLock lock) {
this.bean = bean;
this.interceptors = interceptors;
this.lock = lock;
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java Wed Feb 19 15:47:58 2014
@@ -254,7 +254,7 @@ public class SingletonContainer implemen
instance.interceptors);
returnValue = interceptorStack.invoke(args);
}
- } catch (Throwable e) {// handle reflection exception
+ } catch (final Throwable e) {// handle reflection exception
final ExceptionType type = beanContext.getExceptionType(e);
if (type == ExceptionType.SYSTEM) {
/* System Exception ****************************/
@@ -311,7 +311,7 @@ public class SingletonContainer implemen
// try to get a lock within the specified period.
try {
lockAcquired = lock.tryLock(accessTimeout.getTime(), accessTimeout.getUnit());
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
throw (ConcurrentAccessTimeoutException) new ConcurrentAccessTimeoutException("Unable to get " +
(read ? "read" : "write") +
" lock within specified time on '" +
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContext.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContext.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContext.java Wed Feb 19 15:47:58 2014
@@ -26,12 +26,12 @@ import org.apache.openejb.spi.SecuritySe
*/
public class SingletonContext extends BaseSessionContext {
- public SingletonContext(SecurityService securityService) {
+ public SingletonContext(final SecurityService securityService) {
super(securityService);
}
@Override
- public void check(Call call) {
+ public void check(final Call call) {
final Operation operation = ThreadContext.getThreadContext().getCurrentOperation();
switch (call) {
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java Wed Feb 19 15:47:58 2014
@@ -27,24 +27,24 @@ import java.util.List;
public class SingletonEjbHomeHandler extends EjbHomeProxyHandler {
- public SingletonEjbHomeHandler(BeanContext beanContext, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+ public SingletonEjbHomeHandler(final BeanContext beanContext, final InterfaceType interfaceType, final List<Class> interfaces, final Class mainInterface) {
super(beanContext, interfaceType, interfaces, mainInterface);
}
- protected Object findX(Class interfce, Method method, Object[] args, Object proxy) throws Throwable {
+ protected Object findX(final Class interfce, final Method method, final Object[] args, final Object proxy) throws Throwable {
throw new UnsupportedOperationException("Stateful beans may not have find methods");
}
- protected Object removeByPrimaryKey(Class interfce, Method method, Object[] args, Object proxy) throws Throwable {
+ protected Object removeByPrimaryKey(final Class interfce, final Method method, final Object[] args, final Object proxy) throws Throwable {
throw new RemoveException("Session objects are private resources and do not have primary keys");
}
- protected Object removeWithHandle(Class interfce, Method method, Object[] args, Object proxy) throws Throwable {
+ protected Object removeWithHandle(final Class interfce, final Method method, final Object[] args, final Object proxy) throws Throwable {
// stateless can't be removed
return null;
}
- protected EjbObjectProxyHandler newEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+ protected EjbObjectProxyHandler newEjbObjectHandler(final BeanContext beanContext, final Object pk, final InterfaceType interfaceType, final List<Class> interfaces, final Class mainInterface) {
return new SingletonEjbObjectHandler(getBeanContext(), pk, interfaceType, interfaces, mainInterface);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java Wed Feb 19 15:47:58 2014
@@ -29,11 +29,11 @@ import java.util.List;
public class SingletonEjbObjectHandler extends EjbObjectProxyHandler {
public Object registryId;
- public SingletonEjbObjectHandler(BeanContext beanContext, Object pk, InterfaceType interfaceType, List<Class> interfaces, Class mainInterface) {
+ public SingletonEjbObjectHandler(final BeanContext beanContext, final Object pk, final InterfaceType interfaceType, final List<Class> interfaces, final Class mainInterface) {
super(beanContext, pk, interfaceType, interfaces, mainInterface);
}
- public static Object createRegistryId(Object primKey, Object deployId, Container contnr) {
+ public static Object createRegistryId(final Object primKey, final Object deployId, final Container contnr) {
return "" + deployId + contnr.getContainerID();
}
@@ -43,15 +43,15 @@ public class SingletonEjbObjectHandler e
return registryId;
}
- protected Object getPrimaryKey(Method method, Object[] args, Object proxy) throws Throwable {
+ protected Object getPrimaryKey(final Method method, final Object[] args, final Object proxy) throws Throwable {
throw new RemoteException("Session objects are private resources and do not have primary keys");
}
- protected Object isIdentical(Method method, Object[] args, Object proxy) throws Throwable {
+ protected Object isIdentical(final Method method, final Object[] args, final Object proxy) throws Throwable {
try {
- EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(args[0]);
+ final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(args[0]);
return new Boolean(deploymentID.equals(handler.deploymentID)); //NOPMD
- } catch (Throwable t) {
+ } catch (final Throwable t) {
return Boolean.FALSE;
}
}
@@ -60,7 +60,7 @@ public class SingletonEjbObjectHandler e
// stateless can't be removed
}
- protected Object remove(Class interfce, Method method, Object[] args, Object proxy) throws Throwable {
+ protected Object remove(final Class interfce, final Method method, final Object[] args, final Object proxy) throws Throwable {
// stateless can't be removed
return null;
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java Wed Feb 19 15:47:58 2014
@@ -72,36 +72,36 @@ public class SingletonInstanceManager {
private final SingletonContext sessionContext;
private final WebServiceContext webServiceContext;
- public SingletonInstanceManager(SecurityService securityService) {
+ public SingletonInstanceManager(final SecurityService securityService) {
this.securityService = securityService;
sessionContext = new SingletonContext(this.securityService);
webServiceContext = new EjbWsContext(sessionContext);
}
- protected void start(BeanContext beanContext) throws OpenEJBException {
+ protected void start(final BeanContext beanContext) throws OpenEJBException {
if (beanContext.isLoadOnStartup()) {
initialize(beanContext);
}
}
- private void initialize(BeanContext beanContext) throws OpenEJBException {
+ private void initialize(final BeanContext beanContext) throws OpenEJBException {
try {
- ThreadContext callContext = new ThreadContext(beanContext, null);
- ThreadContext old = ThreadContext.enter(callContext);
+ final ThreadContext callContext = new ThreadContext(beanContext, null);
+ final ThreadContext old = ThreadContext.enter(callContext);
try {
getInstance(callContext);
} finally{
ThreadContext.exit(old);
}
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
throw new OpenEJBException("Singleton startup failed: "+ beanContext.getDeploymentID(), e);
}
}
public Instance getInstance(final ThreadContext callContext) throws OpenEJBException {
final BeanContext beanContext = callContext.getBeanContext();
- Data data = (Data) beanContext.getContainerData();
- AtomicReference<Future<Instance>> singleton = data.singleton;
+ final Data data = (Data) beanContext.getContainerData();
+ final AtomicReference<Future<Instance>> singleton = data.singleton;
try {
// Has the singleton been created yet?
// If there is a Future object in the AtomicReference, then
@@ -112,7 +112,7 @@ public class SingletonInstanceManager {
// The singleton has not been created nor is being created
// We will construct this FutureTask and compete with the
// other threads for the right to create the singleton
- FutureTask<Instance> task = new FutureTask<Instance>(new Callable<Instance>() {
+ final FutureTask<Instance> task = new FutureTask<Instance>(new Callable<Instance>() {
public Instance call() throws Exception {
return createInstance(callContext, beanContext);
}
@@ -135,11 +135,11 @@ public class SingletonInstanceManager {
// At this point we can safely return the singleton
return singletonFuture.get();
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
Thread.interrupted();
throw new ApplicationException(new NoSuchEJBException("Singleton initialization interrupted").initCause(e));
- } catch (ExecutionException e) {
- Throwable throwable = e.getCause();
+ } catch (final ExecutionException e) {
+ final Throwable throwable = e.getCause();
if (throwable instanceof ApplicationException) {
throw (ApplicationException) throwable;
}
@@ -148,11 +148,11 @@ public class SingletonInstanceManager {
}
}
- private void initializeDependencies(BeanContext beanContext) throws OpenEJBException {
- SystemInstance systemInstance = SystemInstance.get();
- ContainerSystem containerSystem = systemInstance.getComponent(ContainerSystem.class);
- for (String dependencyId : beanContext.getDependsOn()) {
- BeanContext dependencyContext = containerSystem.getBeanContext(dependencyId);
+ private void initializeDependencies(final BeanContext beanContext) throws OpenEJBException {
+ final SystemInstance systemInstance = SystemInstance.get();
+ final ContainerSystem containerSystem = systemInstance.getComponent(ContainerSystem.class);
+ for (final String dependencyId : beanContext.getDependsOn()) {
+ final BeanContext dependencyContext = containerSystem.getBeanContext(dependencyId);
if (dependencyContext == null) {
throw new OpenEJBException("Deployment does not exist. Deployment(id='"+dependencyContext+"')");
}
@@ -162,14 +162,14 @@ public class SingletonInstanceManager {
// Bean may not be a singleton or may be a singleton
// managed by a different container implementation
if (containerData instanceof Data) {
- Data data = (Data) containerData;
+ final Data data = (Data) containerData;
data.initialize();
}
}
}
- private Instance createInstance(ThreadContext callContext, BeanContext beanContext) throws ApplicationException {
+ private Instance createInstance(final ThreadContext callContext, final BeanContext beanContext) throws ApplicationException {
try {
initializeDependencies(beanContext);
@@ -188,7 +188,7 @@ public class SingletonInstanceManager {
}
}
- ReadWriteLock lock;
+ final ReadWriteLock lock;
if (beanContext.isBeanManagedConcurrency()){
// Bean-Managed Concurrency
lock = new BeanManagedLock();
@@ -202,28 +202,28 @@ public class SingletonInstanceManager {
if (e instanceof InvocationTargetException) {
e = ((InvocationTargetException) e).getTargetException();
}
- String t = "The bean instance " + beanContext.getDeploymentID() + " threw a system exception:" + e;
+ final String t = "The bean instance " + beanContext.getDeploymentID() + " threw a system exception:" + e;
logger.error(t, e);
throw new ApplicationException(new NoSuchEJBException("Singleton failed to initialize").initCause(e));
}
}
- public void freeInstance(ThreadContext callContext) {
- BeanContext beanContext = callContext.getBeanContext();
- Data data = (Data) beanContext.getContainerData();
- Future<Instance> instanceFuture = data.singleton.get();
+ public void freeInstance(final ThreadContext callContext) {
+ final BeanContext beanContext = callContext.getBeanContext();
+ final Data data = (Data) beanContext.getContainerData();
+ final Future<Instance> instanceFuture = data.singleton.get();
// Possible the instance was never created
if (instanceFuture == null) return;
- Instance instance;
+ final Instance instance;
try {
instance = instanceFuture.get();
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
Thread.interrupted();
logger.error("Singleton shutdown failed because the thread was interrupted: "+beanContext.getDeploymentID(), e);
return;
- } catch (ExecutionException e) {
+ } catch (final ExecutionException e) {
// Instance was never initialized
return;
}
@@ -232,16 +232,16 @@ public class SingletonInstanceManager {
callContext.setCurrentOperation(Operation.PRE_DESTROY);
callContext.setCurrentAllowedStates(null);
- Method remove = instance.bean instanceof SessionBean? beanContext.getCreateMethod(): null;
+ final Method remove = instance.bean instanceof SessionBean? beanContext.getCreateMethod(): null;
- List<InterceptorData> callbackInterceptors = beanContext.getCallbackInterceptors();
- InterceptorStack interceptorStack = new InterceptorStack(instance.bean, remove, Operation.PRE_DESTROY, callbackInterceptors, instance.interceptors);
+ final List<InterceptorData> callbackInterceptors = beanContext.getCallbackInterceptors();
+ final InterceptorStack interceptorStack = new InterceptorStack(instance.bean, remove, Operation.PRE_DESTROY, callbackInterceptors, instance.interceptors);
//Transaction Demarcation for Singleton PostConstruct method
TransactionType transactionType;
if (beanContext.getComponentType() == BeanType.SINGLETON) {
- Set<Method> callbacks = callbackInterceptors.get(callbackInterceptors.size() -1).getPreDestroy();
+ final Set<Method> callbacks = callbackInterceptors.get(callbackInterceptors.size() -1).getPreDestroy();
if (callbacks.isEmpty()) {
transactionType = TransactionType.RequiresNew;
} else {
@@ -253,7 +253,7 @@ public class SingletonInstanceManager {
} else {
transactionType = beanContext.isBeanManagedTransaction()? TransactionType.BeanManaged: TransactionType.NotSupported;
}
- TransactionPolicy transactionPolicy = EjbTransactionUtil.createTransactionPolicy(transactionType, callContext);
+ final TransactionPolicy transactionPolicy = EjbTransactionUtil.createTransactionPolicy(transactionType, callContext);
try{
//Call the chain
final CdiEjbBean<Object> bean = beanContext.get(CdiEjbBean.class);
@@ -265,7 +265,7 @@ public class SingletonInstanceManager {
if (instance.creationalContext != null) {
instance.creationalContext.release();
}
- } catch(Throwable e) {
+ } catch(final Throwable e) {
//RollBack Transaction
EjbTransactionUtil.handleSystemException(transactionPolicy, e, callContext);
}
@@ -273,7 +273,7 @@ public class SingletonInstanceManager {
EjbTransactionUtil.afterInvoke(transactionPolicy, callContext);
}
- } catch (Throwable re) {
+ } catch (final Throwable re) {
logger.error("Singleton shutdown failed: "+beanContext.getDeploymentID(), re);
}
}
@@ -286,12 +286,12 @@ public class SingletonInstanceManager {
* @param callContext
* @param bean
*/
- public void discardInstance(ThreadContext callContext, Object bean) {
+ public void discardInstance(final ThreadContext callContext, final Object bean) {
}
- public void deploy(BeanContext beanContext) throws OpenEJBException {
- Data data = new Data(beanContext);
+ public void deploy(final BeanContext beanContext) throws OpenEJBException {
+ final Data data = new Data(beanContext);
beanContext.setContainerData(data);
beanContext.set(EJBContext.class, this.sessionContext);
@@ -301,7 +301,7 @@ public class SingletonInstanceManager {
final StatsInterceptor stats = new StatsInterceptor(beanContext.getBeanClass());
beanContext.addFirstSystemInterceptor(stats);
- ObjectNameBuilder jmxName = new ObjectNameBuilder("openejb.management");
+ final ObjectNameBuilder jmxName = new ObjectNameBuilder("openejb.management");
jmxName.set("J2EEServer", "openejb");
jmxName.set("J2EEApplication", null);
jmxName.set("EJBModule", beanContext.getModuleID());
@@ -312,13 +312,13 @@ public class SingletonInstanceManager {
// register the invocation stats interceptor
final MBeanServer server = LocalMBeanServer.get();
try {
- ObjectName objectName = jmxName.build();
+ final ObjectName objectName = jmxName.build();
if (server.isRegistered(objectName)) {
server.unregisterMBean(objectName);
}
server.registerMBean(new ManagedMBean(stats), objectName);
data.add(objectName);
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("Unable to register MBean ", e);
}
}
@@ -328,20 +328,20 @@ public class SingletonInstanceManager {
context.bind("comp/EJBContext", sessionContext);
context.bind("comp/WebServiceContext", webServiceContext);
context.bind("comp/TimerService", new TimerServiceWrapper());
- } catch (NamingException e) {
+ } catch (final NamingException e) {
throw new OpenEJBException("Failed to bind EJBContext/WebServiceContext/TimerService", e);
}
}
- public void undeploy(BeanContext beanContext) {
- Data data = (Data) beanContext.getContainerData();
+ public void undeploy(final BeanContext beanContext) {
+ final Data data = (Data) beanContext.getContainerData();
if (data == null) return;
- MBeanServer server = LocalMBeanServer.get();
- for (ObjectName objectName : data.jmxNames) {
+ final MBeanServer server = LocalMBeanServer.get();
+ for (final ObjectName objectName : data.jmxNames) {
try {
server.unregisterMBean(objectName);
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("Unable to unregister MBean "+objectName);
}
}
@@ -354,11 +354,11 @@ public class SingletonInstanceManager {
private final List<ObjectName> jmxNames = new ArrayList<ObjectName>();
private final BeanContext info;
- public Data(BeanContext info) {
+ public Data(final BeanContext info) {
this.info = info;
}
- public ObjectName add(ObjectName name) {
+ public ObjectName add(final ObjectName name) {
jmxNames.add(name);
return name;
}
@@ -386,7 +386,7 @@ public class SingletonInstanceManager {
return true;
}
- public boolean tryLock(long time, TimeUnit unit) {
+ public boolean tryLock(final long time, final TimeUnit unit) {
return true;
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/RAFPassivater.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/RAFPassivater.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/RAFPassivater.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/RAFPassivater.java Wed Feb 19 15:47:58 2014
@@ -72,7 +72,7 @@ public class RAFPassivater implements Pa
ras.write(bytes);
}
ras.close();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new SystemException(e);
}
}
@@ -92,7 +92,7 @@ public class RAFPassivater implements Pa
ras.readFully(bytes);
ras.close();
return Serializer.deserialize(bytes);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new SystemException(e);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/SimpleCache.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/SimpleCache.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/SimpleCache.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/SimpleCache.java Wed Feb 19 15:47:58 2014
@@ -90,7 +90,7 @@ public class SimpleCache<K, V> implement
public SimpleCache() {
}
- public SimpleCache(CacheListener<V> listener, PassivationStrategy passivator, int capacity, int bulkPassivate, Duration timeOut) {
+ public SimpleCache(final CacheListener<V> listener, final PassivationStrategy passivator, final int capacity, final int bulkPassivate, final Duration timeOut) {
this.listener = listener;
this.passivator = passivator;
this.capacity = capacity;
@@ -126,8 +126,8 @@ public class SimpleCache<K, V> implement
private synchronized void initScheduledExecutorService() {
if (executor == null) {
executor = Executors.newScheduledThreadPool(1, new ThreadFactory() {
- public Thread newThread(Runnable runable) {
- Thread t = new Thread(runable, "Stateful cache");
+ public Thread newThread(final Runnable runable) {
+ final Thread t = new Thread(runable, "Stateful cache");
t.setDaemon(true);
return t;
}
@@ -139,7 +139,7 @@ public class SimpleCache<K, V> implement
return listener;
}
- public synchronized void setListener(CacheListener<V> listener) {
+ public synchronized void setListener(final CacheListener<V> listener) {
this.listener = listener;
}
@@ -147,11 +147,11 @@ public class SimpleCache<K, V> implement
return passivator;
}
- public synchronized void setPassivator(PassivationStrategy passivator) {
+ public synchronized void setPassivator(final PassivationStrategy passivator) {
this.passivator = passivator;
}
- public synchronized void setPassivator(Class<? extends PassivationStrategy> passivatorClass) throws Exception {
+ public synchronized void setPassivator(final Class<? extends PassivationStrategy> passivatorClass) throws Exception {
this.passivator = passivatorClass.newInstance();
}
@@ -159,12 +159,12 @@ public class SimpleCache<K, V> implement
return capacity;
}
- public synchronized void setCapacity(int capacity) {
+ public synchronized void setCapacity(final int capacity) {
this.capacity = capacity;
}
// Old configurations use "PoolSize" to configure max cache size
- public synchronized void setPoolSize(int capacity) {
+ public synchronized void setPoolSize(final int capacity) {
this.capacity = capacity;
}
@@ -172,7 +172,7 @@ public class SimpleCache<K, V> implement
return bulkPassivate;
}
- public synchronized void setBulkPassivate(int bulkPassivate) {
+ public synchronized void setBulkPassivate(final int bulkPassivate) {
this.bulkPassivate = bulkPassivate;
}
@@ -196,7 +196,7 @@ public class SimpleCache<K, V> implement
this.timeOut = ms(timeOut, TimeUnit.MINUTES);
}
- public void setScheduledExecutorService(ScheduledExecutorService executor) {
+ public void setScheduledExecutorService(final ScheduledExecutorService executor) {
this.executor = executor;
}
@@ -212,7 +212,7 @@ public class SimpleCache<K, V> implement
return frequency;
}
- public void add(K key, V value) {
+ public void add(final K key, final V value) {
// find the existing entry
Entry entry = cache.get(key);
if (entry != null) {
@@ -233,7 +233,7 @@ public class SimpleCache<K, V> implement
cache.put(key, entry);
}
- public V checkOut(K key, boolean loadEntryIfNotFound) throws Exception {
+ public V checkOut(final K key, final boolean loadEntryIfNotFound) throws Exception {
// attempt (up to 10 times) to obtain the entry from the cache
for (int i = 0; i < 10; i++) {
// find the entry
@@ -280,16 +280,16 @@ public class SimpleCache<K, V> implement
}
// something is really messed up with this entry, try to cleanup before throwing an exception
- Entry entry = cache.remove(key);
+ final Entry entry = cache.remove(key);
if (entry != null) {
lru.remove(entry);
}
throw new OpenEJBRuntimeException("Cache is corrupted: the entry " + key + " in the Map 'cache' is in state PASSIVATED");
}
- public void checkIn(K key) {
+ public void checkIn(final K key) {
// find the entry
- Entry entry = cache.get(key);
+ final Entry entry = cache.get(key);
if (entry == null) {
return;
}
@@ -329,9 +329,9 @@ public class SimpleCache<K, V> implement
}
}
- public V remove(K key) {
+ public V remove(final K key) {
// find the entry
- Entry entry = cache.get(key);
+ final Entry entry = cache.get(key);
if (entry == null) {
return null;
}
@@ -354,9 +354,9 @@ public class SimpleCache<K, V> implement
}
}
- public void removeAll(CacheFilter<V> filter) {
- for (Iterator<Entry> iterator = cache.values().iterator(); iterator.hasNext();) {
- Entry entry = iterator.next();
+ public void removeAll(final CacheFilter<V> filter) {
+ for (final Iterator<Entry> iterator = cache.values().iterator(); iterator.hasNext();) {
+ final Entry entry = iterator.next();
entry.lock.lock();
try {
@@ -378,14 +378,14 @@ public class SimpleCache<K, V> implement
}
public void processLRU() {
- CacheListener<V> listener = this.getListener();
+ final CacheListener<V> listener = this.getListener();
// check for timed out entries
// go through all lru entries since even though entries are in
// least recently used order they might have different timeouts.
- Iterator<Entry> iterator = lru.iterator();
+ final Iterator<Entry> iterator = lru.iterator();
while (iterator.hasNext()) {
- Entry entry = iterator.next();
+ final Entry entry = iterator.next();
entry.lock.lock();
try {
switch (entry.getState()) {
@@ -414,7 +414,7 @@ public class SimpleCache<K, V> implement
if (listener != null) {
try {
listener.timedOut(entry.getValue());
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("An unexpected exception occured from timedOut callback", e);
}
}
@@ -427,13 +427,13 @@ public class SimpleCache<K, V> implement
// if there are to many beans in the lru, shink is by on bulkPassivate size
// bulkPassivate size is just an estimate, as locked or timed out beans are skipped
if (lru.size() >= getCapacity()) {
- Map<K, V> valuesToStore = new LinkedHashMap<K, V>();
- List<Entry> entries = new ArrayList<Entry>();
+ final Map<K, V> valuesToStore = new LinkedHashMap<K, V>();
+ final List<Entry> entries = new ArrayList<Entry>();
int bulkPassivate = getBulkPassivate();
if (bulkPassivate < 1) bulkPassivate = 1;
for (int i = 0; i < bulkPassivate; i++) {
- Entry entry = lru.poll();
+ final Entry entry = lru.poll();
if (entry == null) {
// lru is empty
break;
@@ -474,7 +474,7 @@ public class SimpleCache<K, V> implement
if (listener != null) {
try {
listener.timedOut(entry.getValue());
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("An unexpected exception occured from timedOut callback", e);
}
}
@@ -495,7 +495,7 @@ public class SimpleCache<K, V> implement
try {
storeEntries(valuesToStore);
} finally {
- for (Entry entry : entries) {
+ for (final Entry entry : entries) {
// release the extra passivation lock
entry.lock.unlock();
}
@@ -504,8 +504,8 @@ public class SimpleCache<K, V> implement
}
}
- private Entry loadEntry(K key) throws Exception {
- PassivationStrategy passivator = getPassivator();
+ private Entry loadEntry(final K key) throws Exception {
+ final PassivationStrategy passivator = getPassivator();
if (passivator == null) {
return null;
}
@@ -513,7 +513,7 @@ public class SimpleCache<K, V> implement
V value = null;
try {
value = (V) passivator.activate(key);
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("An unexpected exception occured while reading entries from disk", e);
}
@@ -521,24 +521,24 @@ public class SimpleCache<K, V> implement
return null;
}
- CacheListener<V> listener = this.getListener();
+ final CacheListener<V> listener = this.getListener();
if (listener != null) {
listener.afterLoad(value);
}
- Entry entry = new Entry(key, value, EntryState.AVAILABLE);
+ final Entry entry = new Entry(key, value, EntryState.AVAILABLE);
cache.put(key, entry);
return entry;
}
- private void storeEntries(Map<K, V> entriesToStore) {
- CacheListener<V> listener = this.getListener();
- for (Iterator<Map.Entry<K, V>> iterator = entriesToStore.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry<K, V> entry = iterator.next();
+ private void storeEntries(final Map<K, V> entriesToStore) {
+ final CacheListener<V> listener = this.getListener();
+ for (final Iterator<Map.Entry<K, V>> iterator = entriesToStore.entrySet().iterator(); iterator.hasNext();) {
+ final Map.Entry<K, V> entry = iterator.next();
if (listener != null) {
try {
listener.beforeStore(entry.getValue());
- } catch (Exception e) {
+ } catch (final Exception e) {
iterator.remove();
logger.error("An unexpected exception occured from beforeStore callback", e);
}
@@ -546,14 +546,14 @@ public class SimpleCache<K, V> implement
}
- PassivationStrategy passivator = getPassivator();
+ final PassivationStrategy passivator = getPassivator();
if (passivator == null) {
return;
}
try {
passivator.passivate(entriesToStore);
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("An unexpected exception occured while writting the entries to disk", e);
}
}
@@ -570,13 +570,13 @@ public class SimpleCache<K, V> implement
private long lastAccess;
private long timeOut;
- private Entry(K key, V value, EntryState state) {
+ private Entry(final K key, final V value, final EntryState state) {
this.key = key;
this.value = value;
this.state = state;
if (value instanceof Cache.TimeOut) {
- Duration duration = ((Cache.TimeOut) value).getTimeOut();
+ final Duration duration = ((Cache.TimeOut) value).getTimeOut();
this.timeOut = duration != null ? duration.getTime(TimeUnit.MILLISECONDS) : getTimeOut();
} else {
this.timeOut = getTimeOut();
@@ -600,7 +600,7 @@ public class SimpleCache<K, V> implement
return state;
}
- private void setState(EntryState state) {
+ private void setState(final EntryState state) {
assertLockHeld();
this.state = state;
}
@@ -613,7 +613,7 @@ public class SimpleCache<K, V> implement
} else if (timeOut == 0) {
return true;
} else {
- long now = System.currentTimeMillis();
+ final long now = System.currentTimeMillis();
return now - lastAccess > timeOut;
}
}