This handles the edge case in which a client has explicity specified a changeId when writing and overwrote an exisiting delta.
774292
private int skipForward() {
        int numSkips = 0;
        _next = null;
        while (_iterator.hasNext() && getBlock(_next = _iterator.next()) != 0) {
            numSkips++;
            _next = null;
        }
        return numSkips;
    }
1329184
void processGitConfigChangesHelper(List<DiffEntry> changes) throws IOException {
    for (DiffEntry change : changes) {
      switch (change.getChangeType()) {
        case ADD:
        case MODIFY:
          addChange(change);
          break;
        case DELETE:
          removeChange(change);
          break;
        case RENAME:
          removeChange(change);
          addChange(change);
          break;
        default:
          throw new RuntimeException("Unsupported change type " + change.getChangeType());
      }
    }

    // Done processing changes, so checkpoint
    this.gitRepo.moveCheckpointAndHashesForward();
  }
747090
protected void updateOutgoingEdgesStateEND(
			int currS, int currL,
			int prevS, int prevL,
			Emissions emission
	){
		updateOutgoingEdges(currS, currL, States.END, prevS, prevL, States.D, Transitions.t_D_to_END, emission);
		updateOutgoingEdges(currS, currL, States.END, prevS, prevL, States.M, Transitions.t_M_to_END, emission);
	}
213351
public void disableAllOverrides(int pathID, String clientUUID) {
        PreparedStatement statement = null;
        try (Connection sqlConnection = sqlService.getConnection()) {
            statement = sqlConnection.prepareStatement(
                "DELETE FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE +
                    " WHERE " + Constants.ENABLED_OVERRIDES_PATH_ID + " = ? " +
                    " AND " + Constants.GENERIC_CLIENT_UUID + " = ? "
            );
            statement.setInt(1, pathID);
            statement.setString(2, clientUUID);
            statement.execute();
            statement.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
    }
494905
def _redirect_edge(self, u_id, v_id, new_v_id):
        
        layer_id = None
        for index, edge_tuple in enumerate(self.adj_list[u_id]):
            if edge_tuple[0] == v_id:
                layer_id = edge_tuple[1]
                self.adj_list[u_id][index] = (new_v_id, layer_id)
                self.layer_list[layer_id].output = self.node_list[new_v_id]
                break

        for index, edge_tuple in enumerate(self.reverse_adj_list[v_id]):
            if edge_tuple[0] == u_id:
                layer_id = edge_tuple[1]
                self.reverse_adj_list[v_id].remove(edge_tuple)
                break
        self.reverse_adj_list[new_v_id].append((u_id, layer_id))
        for index, value in enumerate(self.layer_id_to_output_node_ids[layer_id]):
            if value == v_id:
                self.layer_id_to_output_node_ids[layer_id][index] = new_v_id
                break
1140796
function applyChange(from, to, text) {
        var delta = from - to + text.length;
        var node = nodeAtLocation(from);

        // insert a text node
        if (!node) {
            if (!(/^\s*$/).test(text)) {
                console.warn("Inserting nodes not supported.");
                node = nodeBeforeLocation(from);
            }
        } else if (node.type === 3) {
            // update a text node
            var value = node.value.substr(0, from - node.location);
            value += text;
            value += node.value.substr(to - node.location);
            node.value = value;
            if (!EditAgent.isEditing) {
                // only update the DOM if the change was not caused by the edit agent
                Inspector.DOM.setNodeValue(node.nodeId, node.value);
            }
        } else {
            console.warn("Changing non-text nodes not supported.");
        }

        // adjust the location of all nodes after the change
        if (node) {
            node.length += delta;
            exports.root.each(function each(n) {
                if (n.location > node.location) {
                    n.location += delta;
                }
                if (n.closeLocation !== undefined && n.closeLocation > node.location) {
                    n.closeLocation += delta;
                }
            });
        }
    }
981575
private void handleChangeConfigurationRequest(final int executorId, final String actionName,
      final HttpServletRequest req, final HashMap<String, Object> ret)
      throws ServletException, IOException {
    try {
      final Map<String, Object> result =
          this.execManagerAdapter
              .callExecutorStats(executorId, actionName, getAllParams(req));
      if (result.containsKey(ConnectorParams.RESPONSE_ERROR)) {
        ret.put(ConnectorParams.RESPONSE_ERROR,
            result.get(ConnectorParams.RESPONSE_ERROR).toString());
      } else {
        ret.put(ConnectorParams.STATUS_PARAM,
            result.get(ConnectorParams.STATUS_PARAM));
      }
    } catch (final ExecutorManagerException ex) {
      logger.error(ex.getMessage(), ex);
      ret.put("error", "Failed to change config change");
    }
  }
420320
@Override
  public boolean deleteFlowEdge(String edgeId) {
    try {
      rwLock.writeLock().lock();
      return flowEdgeMap.containsKey(edgeId) && deleteFlowEdge(flowEdgeMap.get(edgeId));
    } finally {
      rwLock.writeLock().unlock();
    }
  }
864387
private void handleWriteException(int responseCode, Write write) {
        assert responseCode != BKException.Code.OK : "cannot handle an exception when responseCode == " + BKException.Code.OK;
        Exception ex = BKException.create(responseCode);
        try {
            if (ex instanceof BKException.BKLedgerFencedException) {
                // We were fenced out.
                ex = new DataLogWriterNotPrimaryException("BookKeeperLog is not primary anymore.", ex);
            } else if (ex instanceof BKException.BKNotEnoughBookiesException) {
                // Insufficient Bookies to complete the operation. This is a retryable exception.
                ex = new DataLogNotAvailableException("BookKeeperLog is not available.", ex);
            } else if (ex instanceof BKException.BKLedgerClosedException) {
                // LedgerClosed can happen because we just rolled over the ledgers or because BookKeeper closed a ledger
                // due to some error. In either case, this is a retryable exception.
                ex = new WriteFailureException("Active Ledger is closed.", ex);
            } else if (ex instanceof BKException.BKWriteException) {
                // Write-related failure or current Ledger closed. This is a retryable exception.
                ex = new WriteFailureException("Unable to write to active Ledger.", ex);
            } else if (ex instanceof BKException.BKClientClosedException) {
                // The BookKeeper client was closed externally. We cannot restart it here. We should close.
                ex = new ObjectClosedException(this, ex);
            } else {
                // All the other kind of exceptions go in the same bucket.
                ex = new DurableDataLogException("General exception while accessing BookKeeper.", ex);
            }
        } finally {
            write.fail(ex, !isRetryable(ex));
        }
    }
922268
public void handleChange(Object propertyId) {

        try {
            lockOnChange(propertyId);
        } catch (CmsException e) {
            LOG.debug(e);
        }
        if (isDescriptorProperty(propertyId)) {
            m_descriptorHasChanges = true;
        }
        if (isBundleProperty(propertyId)) {
            m_changedTranslations.add(getLocale());
        }

    }
727196
@MustBeLocked (ELockType.WRITE)
  protected final void markAsChanged ()
  {
    // Just remember that something changed
    internalSetPendingChanges (true);
    if (internalIsAutoSaveEnabled ())
    {
      // Auto save
      if (_writeToFile ().isSuccess ())
        internalSetPendingChanges (false);
      else
      {
        if (LOGGER.isErrorEnabled ())
          LOGGER.error ("The DAO of class " +
                        getClass ().getName () +
                        " still has pending changes after markAsChanged!");
      }
    }
  }
335954
@Override
  public void handleSuccessfulDispatch(long clientId, long sentTime) {
    ClientData clientData = core.getClientData(clientId);
    if (sentTime == -1 || clientData == null)
      return;
    
    clientData.markedAsFailedTime = -1;
    if (clientData.markedAsFailedTime != -1) {
      LOG.info("Unmarking " + clientId + " at " + sentTime);
    }
    
    clientData.lastSentTime = sentTime;
  }
47529
public static boolean handleIfModifiedSince(final HttpServerExchange exchange, final Date lastModified) {
        return handleIfModifiedSince(exchange.getRequestHeaders().getFirst(Headers.IF_MODIFIED_SINCE), lastModified);
    }
284510
private void applyChanges(PrintWriter out, Reconfigurable reconf,
                            HttpServletRequest req)
    throws IOException, ReconfigurationException {
    Configuration oldConf = reconf.getConf();
    Configuration newConf = new Configuration();

    if (reconf instanceof ReconfigurableBase)
      ((ReconfigurableBase) reconf).preProcessConfiguration(newConf); 
    
    Enumeration<String> params = getParams(req);

    synchronized(oldConf) {
      while (params.hasMoreElements()) {
        String rawParam = params.nextElement();
        String param = StringEscapeUtils.unescapeHtml(rawParam);
        String value =
          StringEscapeUtils.unescapeHtml(req.getParameter(rawParam));
        if (reconf instanceof ReconfigurableBase)
          param = ((ReconfigurableBase) reconf).preProcessKey(param);
        
        if (value != null) {
          if (value.equals(newConf.getRaw(param)) || value.equals("default") ||
              value.equals("null") || value.equals("")) {
            if ((value.equals("default") || value.equals("null") ||
                 value.equals("")) &&
                oldConf.getRaw(param) != null) {
              out.println("<p>Changed \"" +
                          StringEscapeUtils.escapeHtml(param) + "\" from \"" +
                          StringEscapeUtils.escapeHtml(oldConf.getRaw(param)) +
                          "\" to default</p>");
              reconf.reconfigureProperty(param, null);
            } else if (!value.equals("default") && !value.equals("null") &&
                       !value.equals("") &&
                       (oldConf.getRaw(param) == null ||
                        !oldConf.getRaw(param).equals(value))) {
              // change from default or value to different value
              if (oldConf.getRaw(param) == null) {
                out.println("<p>Changed \"" +
                            StringEscapeUtils.escapeHtml(param) +
                            "\" from default to \"" +
                            StringEscapeUtils.escapeHtml(value) + "\"</p>");
              } else {
                out.println("<p>Changed \"" +
                            StringEscapeUtils.escapeHtml(param) + "\" from \"" +
                            StringEscapeUtils.escapeHtml(oldConf.
                                                         getRaw(param)) +
                            "\" to \"" +
                            StringEscapeUtils.escapeHtml(value) + "\"</p>");
              }
              reconf.reconfigureProperty(param, value);
            } else {
              LOG.info("property " + param + " unchanged");
            }
          } else {
            // parameter value != newConf value
            out.println("<p>\"" + StringEscapeUtils.escapeHtml(param) +
                        "\" not changed because value has changed from \"" +
                        StringEscapeUtils.escapeHtml(value) + "\" to \"" +
                        StringEscapeUtils.escapeHtml(newConf.getRaw(param)) +
                        "\" since approval</p>");
          }
        }
      }
    }
  }
688521
@Override
    protected synchronized void handleTransliterate(Replaceable text,
                Position offsets, boolean isIncremental) {
        if(csp==null) {
            return;
        }

        if(offsets.start >= offsets.limit) {
            return;
        }

        iter.setText(text);
        result.setLength(0);
        int c, delta;

        // Walk through original string
        // If there is a case change, modify corresponding position in replaceable

        iter.setIndex(offsets.start);
        iter.setLimit(offsets.limit);
        iter.setContextLimits(offsets.contextStart, offsets.contextLimit);
        while((c=iter.nextCaseMapCP())>=0) {
            c=csp.toFullUpper(c, iter, result, caseLocale);

            if(iter.didReachLimit() && isIncremental) {
                // the case mapping function tried to look beyond the context limit
                // wait for more input
                offsets.start=iter.getCaseMapCPStart();
                return;
            }

            /* decode the result */
            if(c<0) {
                /* c mapped to itself, no change */
                continue;
            } else if(c<=UCaseProps.MAX_STRING_LENGTH) {
                /* replace by the mapping string */
                delta=iter.replace(result.toString());
                result.setLength(0);
            } else {
                /* replace by single-code point mapping */
                delta=iter.replace(UTF16.valueOf(c));
            }

            if(delta!=0) {
                offsets.limit += delta;
                offsets.contextLimit += delta;
            }
        }
        offsets.start = offsets.limit;
    }
498238
private void _idAdded(String clientId)
  {
    // An id to visit has been added, update our other
    // collections to reflect this.

    // Update the ids collection
    _ids.add(_getIdFromClientId(clientId));

    // Update the unvisited ids collection
    _unvisitedClientIds.add(clientId);

    // Update the subtree ids collection
    _addSubtreeClientId(clientId);
  }
1224394
def setedge(delta, is_multigraph, graph, orig, dest, idx, exists):
    """"""
    if is_multigraph(graph):
        delta.setdefault(graph, {}).setdefault('edges', {})\
            .setdefault(orig, {}).setdefault(dest, {})[idx] = bool(exists)
    else:
        delta.setdefault(graph, {}).setdefault('edges', {})\
            .setdefault(orig, {})[dest] = bool(exists)