Uploaded image for project: 'ZK Spring'
  1. ZK Spring
  2. ZKSPRING-11

ZK SprinSecurity NullPointerException on SecurityUti.isAccessible method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 3.1
    • 3.0
    • security
    • None

      copied from http://code.google.com/p/zkspring/issues/detail?id=20


      Reported by [email protected], Apr 10, 2011
      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


      Comment 1 by [email protected], Apr 16, 2011
      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.

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

            hawk hawk
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: