The GeoServerDataDirectory class has a number of "get__()" methods with a workspace version and a no workspace (global) version.For example: getStyles() .
Typically, in the catalog if a null workspace is provided, the global 'workspace' is assumed.
However, if you provide a null workspace to one of these methods, you get back the root of the data dir, instead of whatever you were asking for. This behaviour seems contrary to how most of the rest of GeoServer works, and rather error prone.
These methods should be changed to handle the case of a null workspace as if it were the global "workspace".