My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1002: NPE in PermissionRuleEditor when group not listed in 'groups' file in 'refs/meta/config'
1 person starred this issue and may be notified of changes. Back to list
Status:  Released
Owner:  ----
Closed:  Jun 2011


Sign in to add a comment
 
Project Member Reported by edwin.ke...@gmail.com, Jun 6, 2011
Affected Version: 2.2.0

What steps will reproduce the problem?
1. clone a repository
2. fetch & checkout the branch 'refs/meta/config'
3. edit 'project.config' and add a permission rule for a new group (group that exists in Gerrit, but for which no permission in this project is assigned yet)
4. commit the changes
5. push the changes to 'refs/meta/config'
6. go to the Gerrit WebUI and try to browse the permissions for this project (Admin -> Projects -> <project> -> Access)
7. see that the permissions are not displayed but Gerrit fails with a NPE (stacktrace see below)

What is the expected output? What do you see instead?
It is expected that the permissions are displayed.

Please provide any additional information below.
The error occurs because the new group is not contained in the 'groups' file in 'refs/meta/config'. I think the 'groups' file should be automatically updated or pushing the changes for 'project.config' should fail if they are inconsistent with the 'groups' file.

Stacktrace for the NPE:
00:32:50,790 [ERROR] Uncaught exception escaped
java.lang.NullPointerException: null
	at com.google.gerrit.client.Dispatcher.toGroup(Dispatcher.java:91)
	at com.google.gerrit.client.admin.PermissionRuleEditor.setValue(PermissionRuleEditor.java:150)
	at com.google.gerrit.client.admin.PermissionRuleEditor.setValue(PermissionRuleEditor.java:1)
	at com.google.gwt.editor.client.impl.AbstractEditorDelegate.initialize(AbstractEditorDelegate.java:260)
	at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initialize(SimpleBeanEditorDelegate.java:32)
	at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initializeSubDelegate(SimpleBeanEditorDelegate.java:44)
	at com.google.gwt.editor.client.impl.AbstractEditorDelegate$Chain.attach(AbstractEditorDelegate.java:65)
	at com.google.gwt.editor.client.adapters.ListEditorWrapper.attach(ListEditorWrapper.java:95)
	at com.google.gwt.editor.client.adapters.ListEditor.setValue(ListEditor.java:132)
	at com.google.gwt.editor.client.adapters.ListEditor.setValue(ListEditor.java:1)
	at com.google.gwt.editor.client.impl.AbstractEditorDelegate.initialize(AbstractEditorDelegate.java:260)
	at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initialize(SimpleBeanEditorDelegate.java:32)
	at com.google.gerrit.client.admin.PermissionEditor_SimpleBeanEditorDelegate.attachSubEditors(PermissionEditor_SimpleBeanEditorDelegate.java:26)
	at com.google.gwt.editor.client.impl.AbstractEditorDelegate.initialize(AbstractEditorDelegate.java:264)
	at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initialize(SimpleBeanEditorDelegate.java:32)
	at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initializeSubDelegate(SimpleBeanEditorDelegate.java:44)
	at com.google.gwt.editor.client.impl.AbstractEditorDelegate$Chain.attach(AbstractEditorDelegate.java:65)
	at com.google.gwt.editor.client.adapters.ListEditorWrapper.attach(ListEditorWrapper.java:95)
	at com.google.gwt.editor.client.adapters.ListEditor.setValue(ListEditor.java:132)
	at com.google.gwt.editor.client.adapters.ListEditor.setValue(ListEditor.java:1)
	at com.google.gwt.editor.client.impl.AbstractEditorDelegate.initialize(AbstractEditorDelegate.java:260)
	at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initialize(SimpleBeanEditorDelegate.java:32)
	at com.google.gerrit.client.admin.AccessSectionEditor_SimpleBeanEditorDelegate.attachSubEditors(AccessSectionEditor_SimpleBeanEditorDelegate.java:26)
	at com.google.gwt.editor.client.impl.AbstractEditorDelegate.initialize(AbstractEditorDelegate.java:264)
	at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initialize(SimpleBeanEditorDelegate.java:32)
	at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initializeSubDelegate(SimpleBeanEditorDelegate.java:44)
	at com.google.gwt.editor.client.impl.AbstractEditorDelegate$Chain.attach(AbstractEditorDelegate.java:65)
	at com.google.gwt.editor.client.adapters.ListEditorWrapper.attach(ListEditorWrapper.java:95)
	at com.google.gwt.editor.client.adapters.ListEditor.setValue(ListEditor.java:132)
	at com.google.gwt.editor.client.adapters.ListEditor.setValue(ListEditor.java:1)
	at com.google.gwt.editor.client.impl.AbstractEditorDelegate.initialize(AbstractEditorDelegate.java:260)
	at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initialize(SimpleBeanEditorDelegate.java:32)
	at com.google.gerrit.client.admin.ProjectAccessEditor_SimpleBeanEditorDelegate.attachSubEditors(ProjectAccessEditor_SimpleBeanEditorDelegate.java:14)
	at com.google.gwt.editor.client.impl.AbstractEditorDelegate.initialize(AbstractEditorDelegate.java:264)
	at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initialize(SimpleBeanEditorDelegate.java:32)
	at com.google.gwt.editor.client.impl.AbstractSimpleBeanEditorDriver.edit(AbstractSimpleBeanEditorDriver.java:45)
	at com.google.gerrit.client.admin.ProjectAccessScreen.edit(ProjectAccessScreen.java:105)
	at com.google.gerrit.client.admin.ProjectAccessScreen$1.preDisplay(ProjectAccessScreen.java:93)
	at com.google.gerrit.client.admin.ProjectAccessScreen$1.preDisplay(ProjectAccessScreen.java:1)
	at com.google.gerrit.client.rpc.ScreenLoadCallback.onSuccess(ScreenLoadCallback.java:32)
...


Further thoughts:
When the ProjectAccess is created by ChangeProjectAccess we ensure that the groups for all permissions are properly resolved:

...
for (Permission permission : section.getPermissions()) {
  for (PermissionRule rule : permission.getRules()) {
    lookupGroup(rule);
  }
}
...

Should we do the same in ProjectAccessFactory?

Jun 7, 2011
#1 sop@google.com
Whoops, I meant to try and fix this and include it in 2.2.1 but forgot about it today.

Its a good idea to block pushing the config file if matching groups don't exist in the groups file.

We can also try to resolve groups in ProjectAccessFactory, but not all groups will resolve, so we still need to fix the UI to not crash with an NPE when the UUID isn't available for a group entry.
Jun 14, 2011
#2 sop@google.com
(No comment was entered for this change.)
Status: Submitted
Labels: FixedIn-2.2.2
Mar 20, 2012
Project Member #3 mf...@codeaurora.org
(No comment was entered for this change.)
Status: Released
Sign in to add a comment

Powered by Google Project Hosting