code: private void fixActiveEdgeAfterSuffixLink(Suffix<T, S> suffix) {
          while (activeEdge != null && activeLength > activeEdge.getLength()) {
              activeLength = activeLength - activeEdge.getLength();
              activeNode = activeEdge.getTerminal();
              Object item = suffix.getItemXFromEnd(activeLength + 1);
              activeEdge = activeNode.getEdgeStarting(item);
          }
          resetActivePointToTerminal();
      }
docs: Deal with the case when we follow a suffix link but the active length is
  greater than the new active edge length. In this situation we must walk
  down the tree updating the entire active point.