IDEA inspection refactorings.
This commit is contained in:
@@ -20,7 +20,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
public class AddDeleteContactController {
|
||||
@Autowired
|
||||
private ContactManager contactManager;
|
||||
private Validator validator = new WebContactValidator();
|
||||
private final Validator validator = new WebContactValidator();
|
||||
|
||||
/**
|
||||
* Displays the "add contact" form.
|
||||
|
||||
@@ -45,8 +45,8 @@ public final class AdminPermissionController implements MessageSourceAware{
|
||||
@Autowired
|
||||
private ContactManager contactManager;
|
||||
private MessageSourceAccessor messages;
|
||||
private Validator addPermissionValidator = new AddPermissionValidator();
|
||||
private PermissionFactory permissionFactory = new DefaultPermissionFactory();
|
||||
private final Validator addPermissionValidator = new AddPermissionValidator();
|
||||
private final PermissionFactory permissionFactory = new DefaultPermissionFactory();
|
||||
|
||||
/**
|
||||
* Displays the permission admin page for a particular contact.
|
||||
@@ -83,7 +83,7 @@ public final class AdminPermissionController implements MessageSourceAware{
|
||||
|
||||
@InitBinder("addPermission")
|
||||
public void initBinder(WebDataBinder binder) {
|
||||
binder.setAllowedFields(new String[] {"recipient", "permission"});
|
||||
binder.setAllowedFields("recipient", "permission");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ClientApplication {
|
||||
|
||||
Method method = object.getClass().getMethod("setUsername", new Class[] {String.class});
|
||||
System.out.println("Found; Trying to setUsername(String) to " + authentication.getPrincipal());
|
||||
method.invoke(object, new Object[] {authentication.getPrincipal()});
|
||||
method.invoke(object, authentication.getPrincipal());
|
||||
} catch (NoSuchMethodException ignored) {
|
||||
System.out.println("This client proxy factory does not have a setUsername(String) method");
|
||||
} catch (IllegalAccessException ignored) {
|
||||
@@ -76,7 +76,7 @@ public class ClientApplication {
|
||||
System.out.println("Trying to find setPassword(String) method on: " + object.getClass().getName());
|
||||
|
||||
Method method = object.getClass().getMethod("setPassword", new Class[] {String.class});
|
||||
method.invoke(object, new Object[] {authentication.getCredentials()});
|
||||
method.invoke(object, authentication.getCredentials());
|
||||
System.out.println("Found; Trying to setPassword(String) to " + authentication.getCredentials());
|
||||
} catch (NoSuchMethodException ignored) {
|
||||
System.out.println("This client proxy factory does not have a setPassword(String) method");
|
||||
|
||||
@@ -134,9 +134,7 @@ public class ContactManagerBackend extends ApplicationObjectSupport implements C
|
||||
public List<String> getAllRecipients() {
|
||||
logger.debug("Returning all recipients");
|
||||
|
||||
List<String> list = contactDao.findAllPrincipals();
|
||||
|
||||
return list;
|
||||
return contactDao.findAllPrincipals();
|
||||
}
|
||||
|
||||
@Transactional(readOnly=true)
|
||||
|
||||
@@ -49,14 +49,14 @@ public class DataSourcePopulator implements InitializingBean {
|
||||
|
||||
JdbcTemplate template;
|
||||
private MutableAclService mutableAclService;
|
||||
Random rnd = new Random();
|
||||
final Random rnd = new Random();
|
||||
TransactionTemplate tt;
|
||||
String[] firstNames = {
|
||||
final String[] firstNames = {
|
||||
"Bob", "Mary", "James", "Jane", "Kristy", "Kirsty", "Kate", "Jeni", "Angela", "Melanie", "Kent", "William",
|
||||
"Geoff", "Jeff", "Adrian", "Amanda", "Lisa", "Elizabeth", "Prue", "Richard", "Darin", "Phillip", "Michael",
|
||||
"Belinda", "Samantha", "Brian", "Greg", "Matthew"
|
||||
};
|
||||
String[] lastNames = {
|
||||
final String[] lastNames = {
|
||||
"Smith", "Williams", "Jackson", "Rictor", "Nelson", "Fitzgerald", "McAlpine", "Sutherland", "Abbott", "Hall",
|
||||
"Edwards", "Gates", "Black", "Brown", "Gray", "Marwell", "Booch", "Johnson", "McTaggart", "Parklin",
|
||||
"Findlay", "Robinson", "Giugni", "Lang", "Chi", "Carmichael"
|
||||
|
||||
@@ -10,7 +10,7 @@ public enum AppRole implements GrantedAuthority {
|
||||
NEW_USER (1),
|
||||
USER (2);
|
||||
|
||||
private int bit;
|
||||
private final int bit;
|
||||
|
||||
/**
|
||||
* Creates an authority with a specific bit representation. It's important that this doesn't
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GaeAuthenticationFilter extends GenericFilterBean {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private AuthenticationDetailsSource ads = new WebAuthenticationDetailsSource();
|
||||
private final AuthenticationDetailsSource ads = new WebAuthenticationDetailsSource();
|
||||
private AuthenticationManager authenticationManager;
|
||||
private AuthenticationFailureHandler failureHandler = new SimpleUrlAuthenticationFailureHandler();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.springframework.util.Assert;
|
||||
public class InMemoryUserRegistry implements UserRegistry {
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private Map<String, GaeUser> users = Collections.synchronizedMap(new HashMap<String, GaeUser>());
|
||||
private final Map<String, GaeUser> users = Collections.synchronizedMap(new HashMap<String, GaeUser>());
|
||||
|
||||
public GaeUser findUser(String userId) {
|
||||
return users.get(userId);
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.springframework.security.openid.OpenIDAuthenticationToken;
|
||||
*/
|
||||
public class CustomUserDetailsService implements UserDetailsService, AuthenticationUserDetailsService<OpenIDAuthenticationToken> {
|
||||
|
||||
private Map<String, CustomUserDetails> registeredUsers = new HashMap<String, CustomUserDetails>();
|
||||
private final Map<String, CustomUserDetails> registeredUsers = new HashMap<String, CustomUserDetails>();
|
||||
|
||||
private static final List<GrantedAuthority> DEFAULT_AUTHORITIES = AuthorityUtils.createAuthorityList("ROLE_USER");
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Map;
|
||||
|
||||
public class BankDaoStub implements BankDao {
|
||||
private long id = 0;
|
||||
private Map<Long, Account> accounts = new HashMap<Long, Account>();
|
||||
private final Map<Long, Account> accounts = new HashMap<Long, Account>();
|
||||
|
||||
public void createOrUpdateAccount(Account account) {
|
||||
if (account.getId() == -1) {
|
||||
@@ -17,12 +17,12 @@ public class BankDaoStub implements BankDao {
|
||||
}
|
||||
|
||||
public Account[] findAccounts() {
|
||||
Account[] a = accounts.values().toArray(new Account[] {});
|
||||
System.out.println("Returning " + a.length + " account(s):");
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
System.out.println(" > " + a[i]);
|
||||
Account[] accounts = this.accounts.values().toArray(new Account[] {});
|
||||
System.out.println("Returning " + accounts.length + " account(s):");
|
||||
for (Account account : accounts) {
|
||||
System.out.println(" > " + account);
|
||||
}
|
||||
return a;
|
||||
return accounts;
|
||||
}
|
||||
|
||||
public Account readAccount(Long id) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
public class BankServiceImpl implements BankService {
|
||||
private BankDao bankDao;
|
||||
private final BankDao bankDao;
|
||||
|
||||
// Not used unless you declare a <protect-pointcut>
|
||||
@Pointcut("execution(* bigbank.BankServiceImpl.*(..))")
|
||||
|
||||
@@ -11,7 +11,7 @@ import bigbank.BankService;
|
||||
|
||||
public class ListAccounts implements Controller {
|
||||
|
||||
private BankService bankService;
|
||||
private final BankService bankService;
|
||||
|
||||
public ListAccounts(BankService bankService) {
|
||||
Assert.notNull(bankService);
|
||||
|
||||
@@ -13,7 +13,7 @@ import bigbank.BankService;
|
||||
|
||||
public class PostAccounts implements Controller {
|
||||
|
||||
private BankService bankService;
|
||||
private final BankService bankService;
|
||||
|
||||
public PostAccounts(BankService bankService) {
|
||||
Assert.notNull(bankService);
|
||||
|
||||
Reference in New Issue
Block a user