Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-8770

java.lang.UnsupportedOperationException using Props impl for UserInfo interface

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 7.25.0.Final
    • Fix Version/s: 7.27.0.Final
    • Component/s: KieServer, Workbench
    • Labels:
      None
    • Environment:

      Not relevant. Tested on Linux Ubuntu 18.04 and Win10.

    • Steps to Reproduce:
      Hide

      Using jbpm-server-7.25.0.Final-dist.zip
      1) start jbpm with ./standalone.sh -Dorg.jbpm.ht.callback=props -Dorg.jbpm.ht.userinfo=props
      2) login as wbadmin on BusinessCentral, and create a simple bpm (import attached sample)
      3) start an instance process
      4) login as jack (IT group).
      5) Go to Task Inbox. Error with stacktrace is throw on the Console. The designed form didn't shows up. A default generated form is shown instead.

      PROPOSED FIX:

      Looking at GetUserTaskCommand.java:67

          protected boolean checkUserPermissions(String userId,
                                                 Task task,
                                                 TaskContext context) {
              List<String> usersGroup = context.getUserGroupCallback().getGroupsForUser(userId);
              usersGroup.add(userId);
      

      userGroup is an inmmutable list, because JBossUserGroupCallbackImpl.getGroupsForUser(String) is returning an inmutable list.

      I propose a minor change into JBossUserGroupCallbackImpl.getGroupsForUser(String), to return a new ArrayList like this:

      	
      public List<String> getGroupsForUser(String userId) {
      		
      		List<String> groups = groupStore.get(userId);
      		if( groups == null ) { 
      		    groups = new ArrayList<String>(0);
      		}
      		return new java.util.ArrayList<String>(groups); // <-- changed from return groups;
      	}
      
      Show
      Using jbpm-server-7.25.0.Final-dist.zip 1) start jbpm with ./standalone.sh -Dorg.jbpm.ht.callback=props -Dorg.jbpm.ht.userinfo=props 2) login as wbadmin on BusinessCentral, and create a simple bpm (import attached sample) 3) start an instance process 4) login as jack (IT group). 5) Go to Task Inbox. Error with stacktrace is throw on the Console. The designed form didn't shows up. A default generated form is shown instead. PROPOSED FIX: Looking at GetUserTaskCommand.java:67 protected boolean checkUserPermissions( String userId, Task task, TaskContext context) { List< String > usersGroup = context.getUserGroupCallback().getGroupsForUser(userId); usersGroup.add(userId); userGroup is an inmmutable list, because JBossUserGroupCallbackImpl.getGroupsForUser(String) is returning an inmutable list. I propose a minor change into JBossUserGroupCallbackImpl.getGroupsForUser(String), to return a new ArrayList like this: public List< String > getGroupsForUser( String userId) { List< String > groups = groupStore.get(userId); if ( groups == null ) { groups = new ArrayList< String >(0); } return new java.util.ArrayList< String >(groups); // <-- changed from return groups; }
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      Using Props impl for UserInfo interface, a java.lang.UnsupportedOperationException is thrown when showing user designed forms. Instead, a default generated form is showed.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                swiderski.maciej Maciej Swiderski
                Reporter:
                plillia Pablo Fernando Lillia
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: