code: protected CmsFile readFile(CmsObject cms, CmsResource resource) throws CmsException, CmsIndexNoContentException {
  
          CmsFile file = cms.readFile(resource);
          if (file.getLength() <= 0) {
              throw new CmsIndexNoContentException(
                  Messages.get().container(Messages.ERR_NO_CONTENT_1, resource.getRootPath()));
          }
          return file;
      }
docs: Upgrades the given resource to a {@link CmsFile} with content.<p>
  
  @param cms the current users OpenCms context
  @param resource the resource to upgrade
  
  @return the given resource upgraded to a {@link CmsFile} with content
  
  @throws CmsException if the resource could not be read
  @throws CmsIndexNoContentException if the resource has no content