Opened 12 years ago

Closed 12 years ago

#1583 closed defect (fixed)

NullPointerException in ProjectKey.getPermissions(Project) and ItemKey.getPermissions(Group/User)

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: major Milestone: BASE 2.17.1
Component: core Version:
Keywords: Cc:

Description (last modified by Nicklas Nordborg)

Calling one of the above methods with a Project/Group/User that hasn't been assigned any permissions result in a NullPointerException:

	at net.sf.basedb.core.ProjectKey.getPermissions(
	at net.sf.basedb.reggie.servlet.InstallServlet$PermissionOptions.checkPermissions(
	at net.sf.basedb.reggie.servlet.InstallServlet.checkAnnotationType(
	at net.sf.basedb.reggie.servlet.InstallServlet.doGet(

The reason is that an Integer (which is null) is auto-unboxed to an int in a call to Permission.fromInt(int).

Change History (4)

comment:1 Changed 12 years ago by Nicklas Nordborg

ItemKey.getPermissions(Group) and ItemKey.getPermissions(Uses) have the same problem.

The workaround is to use a try { .. } catch (NullPointerException npe) and treat that as if an empty set had been returned.

comment:2 Changed 12 years ago by Nicklas Nordborg

Description: modified (diff)

comment:3 Changed 12 years ago by Nicklas Nordborg

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:4 Changed 12 years ago by Nicklas Nordborg

Resolution: fixed
Status: assignedclosed

(In [5581]) Fixes #1583: NullPointerException? in ProjectKey?.getPermissions(Project) and ItemKey?.getPermissions(Group/User?)

Note: See TracTickets for help on using tickets.