java.lang.NullPointerException

Sakai JIRA | Ian Boston | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    In the XMLUI If I edit a collection Add a role to a workflow step clicking create. Add a user to that role. save then delete the role from the workflow step. I get the following NPE: java.lang.NullPointerException at org.dspace.xmlworkflow.WorkflowUtils.deleteRoleGroup(WorkflowUtils.java:215) at org.dspace.app.xmlui.aspect.administrative.FlowContainerUtils.processDeleteCollectionRole(FlowContainerUtils.java:538) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3237) The method is: public static void deleteRoleGroup(Context context, Collection collection, String roleID) throws SQLException, IOException, WorkflowConfigurationException { Workflow workflow = WorkflowFactory.getWorkflow(collection); Role role = workflow.getRoles().get(roleID); Line: 215>>>>>>> NPE on role if(role.getScope() == Role.Scope.COLLECTION){ CollectionRole ass = CollectionRole.find(context, collection.getID(), roleID); ass.delete(); } } You could do if ( role != null && role.getScope() ... but role should not be null ?

    Sakai JIRA | 4 years ago | Ian Boston
    java.lang.NullPointerException
  2. 0

    In the XMLUI If I edit a collection Add a role to a workflow step clicking create. Add a user to that role. save then delete the role from the workflow step. I get the following NPE: java.lang.NullPointerException at org.dspace.xmlworkflow.WorkflowUtils.deleteRoleGroup(WorkflowUtils.java:215) at org.dspace.app.xmlui.aspect.administrative.FlowContainerUtils.processDeleteCollectionRole(FlowContainerUtils.java:538) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3237) The method is: public static void deleteRoleGroup(Context context, Collection collection, String roleID) throws SQLException, IOException, WorkflowConfigurationException { Workflow workflow = WorkflowFactory.getWorkflow(collection); Role role = workflow.getRoles().get(roleID); Line: 215>>>>>>> NPE on role if(role.getScope() == Role.Scope.COLLECTION){ CollectionRole ass = CollectionRole.find(context, collection.getID(), roleID); ass.delete(); } } You could do if ( role != null && role.getScope() ... but role should not be null ?

    Sakai JIRA | 4 years ago | Ian Boston
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.dspace.xmlworkflow.WorkflowUtils.deleteRoleGroup()
    2. DSpace Kernel :: API and Implementation
      WorkflowUtils.deleteRoleGroup
      1. org.dspace.xmlworkflow.WorkflowUtils.deleteRoleGroup(WorkflowUtils.java:215)
      1 frame
    3. org.dspace.app
      FlowContainerUtils.processDeleteCollectionRole
      1. org.dspace.app.xmlui.aspect.administrative.FlowContainerUtils.processDeleteCollectionRole(FlowContainerUtils.java:538)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    5. Rhino
      Interpreter.interpretLoop
      1. org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
      2. org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
      3. org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3237)
      3 frames