code: public CmsCategory readCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException {
  
          // iterate all possible category repositories, starting with the most global one
          Iterator<String> it = getCategoryRepositories(cms, referencePath).iterator();
          while (it.hasNext()) {
              String repository = it.next();
              try {
                  return getCategory(cms, internalCategoryRootPath(repository, categoryPath));
              } catch (CmsVfsResourceNotFoundException e) {
                  // throw the exception if no repository left
                  if (!it.hasNext()) {
                      throw e;
                  }
              }
          }
          // this will never be executed
          return null;
      }
docs: Reads all categories identified by the given category path for the given reference path.<p>
  
  @param cms the current cms context
  @param categoryPath the path of the category to read
  @param referencePath the reference path to find all the category repositories
  
  @return a list of matching categories, could also be empty, if no category exists with the given path
  
  @throws CmsException if something goes wrong