code: private CmsResource readResourceFromCurrentOrRootSite(CmsObject cms, String name) throws CmsException {
  
          CmsResource resource = null;
          try {
              resource = cms.readResource(name, CmsResourceFilter.IGNORE_EXPIRATION);
          } catch (CmsVfsResourceNotFoundException e) {
              String originalSiteRoot = cms.getRequestContext().getSiteRoot();
              try {
                  cms.getRequestContext().setSiteRoot("");
                  resource = cms.readResource(name, CmsResourceFilter.IGNORE_EXPIRATION);
              } finally {
                  cms.getRequestContext().setSiteRoot(originalSiteRoot);
              }
  
          }
          return resource;
      }
docs: Tries to read a resource either from the current site or from the root site.<p>
  
  @param cms the CMS context to use
  @param name the resource path
  
  @return the resource which was read
  @throws CmsException if something goes wrong