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

java.lang.UnsupportedOperationException using Props impl for UserInfo interface

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.27.0.Final
    • 7.25.0.Final
    • KieServer, Workbench
    • None
    • NEW
    • NEW
    • 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; }

    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.

      Attachments

        Activity

          People

            swiderski.maciej Maciej Swiderski (Inactive)
            plillia@mpba.gov.ar Pablo Fernando Lillia (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: