code: public void attachLocaleGroupIndirect(CmsResource first, CmsResource second) throws CmsException {
  
          CmsResource firstResourceCorrected = getDefaultFileOrSelf(first);
          CmsResource secondResourceCorrected = getDefaultFileOrSelf(second);
          if ((firstResourceCorrected == null) || (secondResourceCorrected == null)) {
              throw new IllegalArgumentException("no default file");
          }
  
          CmsLocaleGroup group1 = readLocaleGroup(firstResourceCorrected);
          CmsLocaleGroup group2 = readLocaleGroup(secondResourceCorrected);
          int numberOfRealGroups = (group1.isRealGroupOrPotentialGroupHead() ? 1 : 0)
              + (group2.isRealGroupOrPotentialGroupHead() ? 1 : 0);
          if (numberOfRealGroups != 1) {
              throw new IllegalArgumentException("more than one real groups");
          }
          CmsResource main = null;
          CmsResource secondary = null;
          if (group1.isRealGroupOrPotentialGroupHead()) {
              main = group1.getPrimaryResource();
              secondary = group2.getPrimaryResource();
          } else if (group2.isRealGroupOrPotentialGroupHead()) {
              main = group2.getPrimaryResource();
              secondary = group1.getPrimaryResource();
          }
          attachLocaleGroup(secondary, main);
      }
docs: Smarter method to connect a resource to a locale group.<p>
  
  Exactly one of the resources given as an argument must represent a locale group, while the other should
  be the locale that you wish to attach to the locale group.<p>
  
  @param first a resource
  @param second a resource
  @throws CmsException if something goes wrong