Fix Sonar Issues

Fixes gh-4300
This commit is contained in:
Rob Winch 2017-04-18 21:07:00 -05:00
parent 9d9aadb80f
commit 59a0ba285f
7 changed files with 13 additions and 12 deletions

View File

@ -83,8 +83,8 @@ public final class AdminPermissionController implements MessageSourceAware {
*/
@RequestMapping(value = "/secure/addPermission.htm", method = RequestMethod.GET)
public ModelAndView displayAddPermissionPageForContact(
@RequestParam("contactId") int contactId) {
Contact contact = contactManager.getById(new Long(contactId));
@RequestParam("contactId") long contactId) {
Contact contact = contactManager.getById(contactId);
AddPermission addPermission = new AddPermission();
addPermission.setContact(contact);
@ -141,10 +141,10 @@ public final class AdminPermissionController implements MessageSourceAware {
* Deletes a permission
*/
@RequestMapping(value = "/secure/deletePermission.htm")
public ModelAndView deletePermission(@RequestParam("contactId") int contactId,
public ModelAndView deletePermission(@RequestParam("contactId") long contactId,
@RequestParam("sid") String sid, @RequestParam("permission") int mask) {
Contact contact = contactManager.getById(new Long(contactId));
Contact contact = contactManager.getById(contactId);
Sid sidObject = new PrincipalSid(sid);
Permission permission = permissionFactory.buildFromMask(mask);

View File

@ -58,7 +58,9 @@ public class ClientApplication {
SecurityContextHolder.getContext().setAuthentication(authentication);
for (String beanName : contactServices.keySet()) {
for (Map.Entry<String,ContactManager> entry : contactServices.entrySet()) {
String beanName = entry.getKey();
ContactManager remoteContactManager = entry.getValue();
Object object = this.beanFactory.getBean("&" + beanName);
try {
@ -101,7 +103,6 @@ public class ClientApplication {
catch (InvocationTargetException ignored) {
}
ContactManager remoteContactManager = contactServices.get(beanName);
System.out.println("Calling ContactManager '" + beanName + "'");
stopWatch.start(beanName);

View File

@ -108,7 +108,7 @@ public class ContactDaoSpring extends JdbcDaoSupport implements ContactDao {
private Contact mapContact(ResultSet rs) throws SQLException {
Contact contact = new Contact();
contact.setId(new Long(rs.getLong("id")));
contact.setId(rs.getLong("id"));
contact.setName(rs.getString("contact_name"));
contact.setEmail(rs.getString("email"));

View File

@ -84,7 +84,7 @@ public class ContactManagerBackend extends ApplicationObjectSupport implements
public void create(Contact contact) {
// Create the Contact itself
contact.setId(new Long(counter++));
contact.setId(Long.valueOf(counter++));
contactDao.create(contact);
// Grant the current principal administrative permission to the contact

View File

@ -164,7 +164,7 @@ public class DataSourcePopulator implements InitializingBean {
// Create acl_object_identity rows (and also acl_class rows as needed
for (int i = 1; i < createEntities; i++) {
final ObjectIdentity objectIdentity = new ObjectIdentityImpl(Contact.class,
new Long(i));
Long.valueOf(i));
tt.execute(new TransactionCallback<Object>() {
public Object doInTransaction(TransactionStatus arg0) {
mutableAclService.createAcl(objectIdentity);
@ -241,7 +241,7 @@ public class DataSourcePopulator implements InitializingBean {
private void grantPermissions(int contactNumber, String recipientUsername,
Permission permission) {
AclImpl acl = (AclImpl) mutableAclService.readAclById(new ObjectIdentityImpl(
Contact.class, new Long(contactNumber)));
Contact.class, Long.valueOf(contactNumber)));
acl.insertAce(acl.getEntries().size(), permission, new PrincipalSid(
recipientUsername), true);
updateAclInTransaction(acl);

View File

@ -41,7 +41,7 @@ public abstract class AbstractElement {
protected AbstractElement() {
this.name = "/";
this.parent = null;
this.id = new Long(-1);
this.id = Long.valueOf(-1);
}
/**

View File

@ -27,7 +27,7 @@ public class BankDaoStub implements BankDao {
id++;
account.setId(id);
}
accounts.put(new Long(account.getId()), account);
accounts.put(account.getId(), account);
System.out.println("SAVE: " + account);
}