vieiraan / zkspring

Automatically exported from code.google.com/p/zkspring
0 stars 0 forks source link

ZK SprinSecurity NullPointerException on SecurityUti.isAccessible method #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. SecurityUti.isAccessible("WRITE", domainObject)
2.
3.

What is the expected output?  true or false
What do you see instead? permissionFactory is null, NullPointerException

What version of the product are you using? 3.0
On what operating system? Ubuntu 9.10

Please provide any additional information below.
In the method private static void initializeIfRequired(); there are not 
initializations of permissionFactory.

Original issue reported on code.google.com by gesuino....@gmail.com on 10 Apr 2011 at 5:09

GoogleCodeExporter commented 9 years ago
To solve this issue should change the initializedIfRequired method and insert 
the following code:

 map = _applicationContext.getBeansOfType(PermissionFactory.class);

        if (map.size() == 0) {
            permissionFactory = new DefaultPermissionFactory();
        } else if (map.size() == 1) {
            permissionFactory = (PermissionFactory) map.values().iterator().next();
        } else {
            throw new UiException("Found incorrect number of PermissionFactory instances in application "
                    + "context - you must have only have one!");
        }

With this change no NullPointerException is throws and we can change the 
DefaultPermissionFactory simply adding a new one to the applicationContext.

I Attach my modified SecurityUtilACL class.

Original comment by gesuino....@gmail.com on 16 Apr 2011 at 2:10

Attachments: