mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-01 09:42:13 +00:00
Fix Sonar Issues
Fixes gh-4300
This commit is contained in:
parent
9d9aadb80f
commit
59a0ba285f
@ -83,8 +83,8 @@ public final class AdminPermissionController implements MessageSourceAware {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/secure/addPermission.htm", method = RequestMethod.GET)
|
@RequestMapping(value = "/secure/addPermission.htm", method = RequestMethod.GET)
|
||||||
public ModelAndView displayAddPermissionPageForContact(
|
public ModelAndView displayAddPermissionPageForContact(
|
||||||
@RequestParam("contactId") int contactId) {
|
@RequestParam("contactId") long contactId) {
|
||||||
Contact contact = contactManager.getById(new Long(contactId));
|
Contact contact = contactManager.getById(contactId);
|
||||||
|
|
||||||
AddPermission addPermission = new AddPermission();
|
AddPermission addPermission = new AddPermission();
|
||||||
addPermission.setContact(contact);
|
addPermission.setContact(contact);
|
||||||
@ -141,10 +141,10 @@ public final class AdminPermissionController implements MessageSourceAware {
|
|||||||
* Deletes a permission
|
* Deletes a permission
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/secure/deletePermission.htm")
|
@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) {
|
@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);
|
Sid sidObject = new PrincipalSid(sid);
|
||||||
Permission permission = permissionFactory.buildFromMask(mask);
|
Permission permission = permissionFactory.buildFromMask(mask);
|
||||||
|
@ -58,7 +58,9 @@ public class ClientApplication {
|
|||||||
|
|
||||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
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);
|
Object object = this.beanFactory.getBean("&" + beanName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -101,7 +103,6 @@ public class ClientApplication {
|
|||||||
catch (InvocationTargetException ignored) {
|
catch (InvocationTargetException ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ContactManager remoteContactManager = contactServices.get(beanName);
|
|
||||||
System.out.println("Calling ContactManager '" + beanName + "'");
|
System.out.println("Calling ContactManager '" + beanName + "'");
|
||||||
|
|
||||||
stopWatch.start(beanName);
|
stopWatch.start(beanName);
|
||||||
|
@ -108,7 +108,7 @@ public class ContactDaoSpring extends JdbcDaoSupport implements ContactDao {
|
|||||||
|
|
||||||
private Contact mapContact(ResultSet rs) throws SQLException {
|
private Contact mapContact(ResultSet rs) throws SQLException {
|
||||||
Contact contact = new Contact();
|
Contact contact = new Contact();
|
||||||
contact.setId(new Long(rs.getLong("id")));
|
contact.setId(rs.getLong("id"));
|
||||||
contact.setName(rs.getString("contact_name"));
|
contact.setName(rs.getString("contact_name"));
|
||||||
contact.setEmail(rs.getString("email"));
|
contact.setEmail(rs.getString("email"));
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class ContactManagerBackend extends ApplicationObjectSupport implements
|
|||||||
|
|
||||||
public void create(Contact contact) {
|
public void create(Contact contact) {
|
||||||
// Create the Contact itself
|
// Create the Contact itself
|
||||||
contact.setId(new Long(counter++));
|
contact.setId(Long.valueOf(counter++));
|
||||||
contactDao.create(contact);
|
contactDao.create(contact);
|
||||||
|
|
||||||
// Grant the current principal administrative permission to the contact
|
// Grant the current principal administrative permission to the contact
|
||||||
|
@ -164,7 +164,7 @@ public class DataSourcePopulator implements InitializingBean {
|
|||||||
// Create acl_object_identity rows (and also acl_class rows as needed
|
// Create acl_object_identity rows (and also acl_class rows as needed
|
||||||
for (int i = 1; i < createEntities; i++) {
|
for (int i = 1; i < createEntities; i++) {
|
||||||
final ObjectIdentity objectIdentity = new ObjectIdentityImpl(Contact.class,
|
final ObjectIdentity objectIdentity = new ObjectIdentityImpl(Contact.class,
|
||||||
new Long(i));
|
Long.valueOf(i));
|
||||||
tt.execute(new TransactionCallback<Object>() {
|
tt.execute(new TransactionCallback<Object>() {
|
||||||
public Object doInTransaction(TransactionStatus arg0) {
|
public Object doInTransaction(TransactionStatus arg0) {
|
||||||
mutableAclService.createAcl(objectIdentity);
|
mutableAclService.createAcl(objectIdentity);
|
||||||
@ -241,7 +241,7 @@ public class DataSourcePopulator implements InitializingBean {
|
|||||||
private void grantPermissions(int contactNumber, String recipientUsername,
|
private void grantPermissions(int contactNumber, String recipientUsername,
|
||||||
Permission permission) {
|
Permission permission) {
|
||||||
AclImpl acl = (AclImpl) mutableAclService.readAclById(new ObjectIdentityImpl(
|
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(
|
acl.insertAce(acl.getEntries().size(), permission, new PrincipalSid(
|
||||||
recipientUsername), true);
|
recipientUsername), true);
|
||||||
updateAclInTransaction(acl);
|
updateAclInTransaction(acl);
|
||||||
|
@ -41,7 +41,7 @@ public abstract class AbstractElement {
|
|||||||
protected AbstractElement() {
|
protected AbstractElement() {
|
||||||
this.name = "/";
|
this.name = "/";
|
||||||
this.parent = null;
|
this.parent = null;
|
||||||
this.id = new Long(-1);
|
this.id = Long.valueOf(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,7 @@ public class BankDaoStub implements BankDao {
|
|||||||
id++;
|
id++;
|
||||||
account.setId(id);
|
account.setId(id);
|
||||||
}
|
}
|
||||||
accounts.put(new Long(account.getId()), account);
|
accounts.put(account.getId(), account);
|
||||||
System.out.println("SAVE: " + account);
|
System.out.println("SAVE: " + account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user