code: @FFDCIgnore(SizeLimitExceededException.class)
      private static int cloneSearchResults(NamingEnumeration<SearchResult> results, CachedNamingEnumeration clone1,
                                            CachedNamingEnumeration clone2) throws WIMSystemException {
          final String METHODNAME = "cloneSearchResults(NamingEnumeration, CachedNamingEnumeration, CachedNamingEnumeration)";
          int count = 0;
          try {
              while (results.hasMore()) {
                  SearchResult result = results.nextElement();
                  Attributes attrs = (Attributes) result.getAttributes().clone();
                  SearchResult cachedResult = new SearchResult(result.getName(), null, null, attrs);
                  clone1.add(result);
                  clone2.add(cachedResult);
                  count++;
              }
          } catch (SizeLimitExceededException e) {
              // if size limit is reached because of LDAP server limit, then log the result
              // and return the available results
              if (tc.isDebugEnabled())
                  Tr.debug(tc, METHODNAME + " " + e.toString(true), e);
          } catch (NamingException e) {
              String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
              throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
          }
  
          return count;
      }
docs: Clone the given {@link NamingNumeration}.
  
  @param results The results to clone.
  @param clone1 {@link CachedNamingEnumeration} with the original results.
  @param clone2 {@link CachedNamingEnumeration} with the cloned results.
  @return The number of entries in the results.
  @throws WIMSystemException If the results could not be cloned.