code: private List<CmsCategory> internalReadSubCategories(CmsObject cms, String rootPath, boolean includeSubCats)
      throws CmsException {
  
          List<CmsCategory> categories = new ArrayList<CmsCategory>();
          List<CmsResource> resources = cms.readResources(
              cms.getRequestContext().removeSiteRoot(rootPath),
              CmsResourceFilter.DEFAULT.addRequireType(CmsResourceTypeFolder.RESOURCE_TYPE_ID),
              includeSubCats);
          Iterator<CmsResource> it = resources.iterator();
          while (it.hasNext()) {
              CmsResource resource = it.next();
              categories.add(getCategory(cms, resource));
          }
          return categories;
      }
docs: Returns all sub categories of the given one, including sub sub categories if needed.<p>
  
  @param cms the current cms context
  @param rootPath the base category's root path (this category is not part of the result)
  @param includeSubCats flag to indicate if sub categories should also be read
  
  @return a list of {@link CmsCategory} objects
  
  @throws CmsException if something goes wrong