Bug #2095
openAbstractDataPackage - entity array not initialized automatically
0%
Description
This was discovered while writing a plugin for morpho - it doesn't affect how
morpho runs at the moment - but may cause complications in future if not addressed
Under some circumstances, for a datapackage with 1 or more entities, a call to
the AbstractDataPackage getEntityCount() method returns zero (0), and a call to
dataPackage.getEntityName(0) returns "No such entity!"
The reason is that the "entityArray" variable is not initialized until a call is
made to the getEntityArray() method. Therefore, as a temporary workaround for my
plugin, I called getEntityArray() before calling getEntityName(0)
SUGGESTED FIX -
1) ensure that all methods within AbstractDataPackage call getEntityArray()
instead of just using the global "entityArray" variable
2) ensure that subclasses do the same, by making "entityArray" private instead
of protected
(The plugin code can be seen in the jalama cvs module, under
jalama/src/edu/ucsb/nceas/jalama/entrypoint/morpho/OpenUIGenCommand.java, within
the method: private String getUniqueID_EML(int i) )