Opened 16 years ago

Closed 16 years ago

#1202 closed enhancement (fixed)

PluginDefinition.loadPluginInformation throws strange error message if a plug-in request permissions for an item that doesn't have a RoleKey

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: minor Milestone: BASE 2.9.1
Component: core Version:
Keywords: Cc:

Description

This is typically child item that takes the permissions from a parent item and doesn't have a RoleKey by itself. For example, a plug-in requests the following permission for creating a platform variant:

public Collection<Permissions> getPermissions()
{
   return Collections.singleton(
      new Permissions(Item.PLATFORMVARIANT, null, EnumSet.of(Permission.CREATE))
   );
}

PlatformVariant is a child item to platform and the correct permission to ask for is write permission on platforms. In any case, when this requests is handled by the PluginDefinition.loadPluginInformation() the following error is thrown:

net.sf.basedb.core.ItemNotFoundException: Item not found: RoleKey[id=0]
   at net.sf.basedb.core.RoleKey.getById(RoleKey.java:91)
   at net.sf.basedb.core.RoleKey.getByItemType(RoleKey.java:111)
   at net.sf.basedb.core.PluginDefinition.loadPluginInformation(PluginDefinition.java:1362)
   at net.sf.basedb.core.PluginDefinition.getNew(PluginDefinition.java:199)

I think a more descriptive error message should be thrown.

Change History (2)

comment:1 by Nicklas Nordborg, 16 years ago

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:2 by Nicklas Nordborg, 16 years ago

Resolution: fixed
Status: assignedclosed

(In [4687]) Fixes #1202: PluginDefinition.loadPluginInformation throws strange error message if a plug-in request permissions for an item that doesn't have a RoleKey

Well... the error message may not be more understandable, but the condition is at least properly handled in the code.

Note: See TracTickets for help on using tickets.