nus-yam/ex-repair huggingface dataset:
Program: 13319
Project: 13319
Buggy source:
public JsonValue handle(JsonValue request) throws JsonResourceException {
  Map<String,Object> scope=Utils.deepCopy(parameters.asMap());
  ObjectSetContext.push(request);
  try {
    scope.putAll(scopeFactory.newInstance(ObjectSetContext.get()));
    scope.put("String_Node_Str",request.getObject());
    return new JsonValue(script.exec(scope));
  }
 catch (  ScriptThrownException ste) {
    throw ste.toJsonResourceException(null);
  }
catch (  ScriptException se) {
    throw se.toJsonResourceException("String_Node_Str" + se.getMessage());
  }
 finally {
    ObjectSetContext.pop();
  }
}

Fixed version (ground truth):
public JsonValue handle(JsonValue request) throws JsonResourceException {
  Map<String,Object> scope=Utils.deepCopy(parameters.asMap());
  JsonValue params=request.get("String_Node_Str");
  JsonValue caller=params.get("String_Node_Str");
  JsonValue parent=request.get("String_Node_Str");
  if (parent.get("String_Node_Str").isNull()) {
    boolean isHttp=false;
    if (!caller.isNull() && caller.asString().equals("String_Node_Str")) {
      parent=parent.get("String_Node_Str");
    }
    if (!parent.isNull() && !parent.get("String_Node_Str").isNull()) {
      isHttp=parent.get("String_Node_Str").asString().equals("String_Node_Str");
    }
    request.add("String_Node_Str",isHttp);
  }
 else {
    request.add("String_Node_Str",parent.get("String_Node_Str").asBoolean());
  }
  ObjectSetContext.push(request);
  try {
    scope.putAll(scopeFactory.newInstance(ObjectSetContext.get()));
    scope.put("String_Node_Str",request.getObject());
    return new JsonValue(script.exec(scope));
  }
 catch (  ScriptThrownException ste) {
    throw ste.toJsonResourceException(null);
  }
catch (  ScriptException se) {
    throw se.toJsonResourceException("String_Node_Str" + se.getMessage());
  }
 finally {
    ObjectSetContext.pop();
  }
}
Program: 13320
Project: 13320
Buggy source:
/** 
 * Get the   {@link org.apache.felix.service.command.CommandProcessor#COMMAND_SCOPE} value.<p/> TODO add description
 * @return
 */
public String getScope();

Fixed version (ground truth):
/** 
 * Get the   {@link org.apache.felix.service.command.CommandProcessor#COMMAND_SCOPE} value.<p/> TODO add description
 * @return
 */
public abstract String getScope();
Program: 13321
Project: 13321
Buggy source:
/** 
 * Get the   {@link org.apache.felix.service.command.CommandProcessor#COMMAND_FUNCTION} value.<p/> TODO add description
 * @return retrun a new map where the key is the command name and the value is the description.
 */
public Map<String,String> getFunctionMap();

Fixed version (ground truth):
/** 
 * Get the   {@link org.apache.felix.service.command.CommandProcessor#COMMAND_FUNCTION} value.<p/> TODO add description
 * @return retrun a new map where the key is the command name and the value is the description.
 */
public abstract Map<String,String> getFunctionMap();
Program: 13323
Project: 13323
Buggy source:
@Override public JsonValue handle(JsonValue request) throws JsonResourceException {
  try {
    ActivitiConstants.WorkflowPath path=getPath(request);
    String user=JsonResourceContext.getParentContext(request).get(new JsonPointer("String_Node_Str")).asString();
    Authentication.setAuthenticatedUserId(user);
    Method method=request.get("String_Node_Str").required().asEnum(SimpleJsonResource.Method.class);
switch (path) {
case processdefinition:
      return processDefinition(method,request);
case processdefinitionid:
    return processDefinitionId(method,request);
case processinstance:
  return processInstance(method,request);
case processinstanceid:
return processInstanceId(method,request);
case taskdefinition:
return taskDefinition(method,request);
case taskinstance:
return taskInstance(method,request);
case taskinstanceid:
return taskInstanceId(method,request);
default :
throw new JsonResourceException(JsonResourceException.FORBIDDEN,"String_Node_Str");
}
}
 catch (JsonValueException jve) {
throw new JsonResourceException(JsonResourceException.BAD_REQUEST,jve);
}
}

Fixed version (ground truth):
@Override public JsonValue handle(JsonValue request) throws JsonResourceException {
  try {
    ActivitiConstants.WorkflowPath path=getPath(request);
    Method method=request.get("String_Node_Str").required().asEnum(SimpleJsonResource.Method.class);
switch (path) {
case processdefinition:
      return processDefinition(method,request);
case processdefinitionid:
    return processDefinitionId(method,request);
case processinstance:
  return processInstance(method,request);
case processinstanceid:
return processInstanceId(method,request);
case taskdefinition:
return taskDefinition(method,request);
case taskinstance:
return taskInstance(method,request);
case taskinstanceid:
return taskInstanceId(method,request);
default :
throw new JsonResourceException(JsonResourceException.FORBIDDEN,"String_Node_Str");
}
}
 catch (JsonValueException jve) {
throw new JsonResourceException(JsonResourceException.BAD_REQUEST,jve);
}
}
Program: 13324
Project: 13324
Buggy source:
/** 
 * Initialize the DB pool.
 * @param dbURL the orientdb URL
 * @param user the orientdb user to connect
 * @param password the orientdb password to connect
 * @param minSize the orientdb pool minimum size
 * @param maxSize the orientdb pool maximum size
 * @param completeConfig
 * @return the initialized pool
 * @throws org.forgerock.openidm.config.InvalidException
 */
private static ODatabaseDocumentPool initPool(String dbURL,String user,String password,int minSize,int maxSize,JsonValue completeConfig) throws InvalidException {
  logger.trace("String_Node_Str",dbURL);
  OGlobalConfiguration.TX_USE_LOG.setValue(true);
  OGlobalConfiguration.TX_COMMIT_SYNCH.setValue(true);
  OGlobalConfiguration.STORAGE_KEEP_OPEN.setValue(false);
  boolean success=false;
  int maxRetry=10;
  int retryCount=0;
  ODatabaseDocumentPool pool=null;
  do {
    retryCount++;
    if (pool != null) {
      pool.close();
    }
    pool=new ODatabaseDocumentPool();
    pool.setup(minSize,maxSize);
    warmUpPool(pool,dbURL,user,password,minSize);
    boolean finalTry=(retryCount >= maxRetry);
    success=test(pool,dbURL,user,password,finalTry);
  }
 while (!success && retryCount < maxRetry);
  if (!success) {
    logger.warn("String_Node_Str");
  }
 else {
    logger.info("String_Node_Str",retryCount);
  }
  logger.debug("String_Node_Str",pool);
  return pool;
}

Fixed version (ground truth):
/** 
 * Initialize the DB pool.
 * @param dbURL the orientdb URL
 * @param user the orientdb user to connect
 * @param password the orientdb password to connect
 * @param minSize the orientdb pool minimum size
 * @param maxSize the orientdb pool maximum size
 * @param completeConfig
 * @return the initialized pool
 * @throws org.forgerock.openidm.config.InvalidException
 */
private static ODatabaseDocumentPool initPool(String dbURL,String user,String password,int minSize,int maxSize,JsonValue completeConfig) throws InvalidException {
  logger.trace("String_Node_Str",dbURL);
  OGlobalConfiguration.TX_USE_LOG.setValue(true);
  OGlobalConfiguration.TX_COMMIT_SYNCH.setValue(true);
  OGlobalConfiguration.STORAGE_KEEP_OPEN.setValue(false);
  boolean success=false;
  int maxRetry=10;
  int retryCount=0;
  ODatabaseDocumentPool pool=null;
  do {
    retryCount++;
    if (pool != null) {
      pool.close();
    }
    pool=ODatabaseDocumentPool.global();
    warmUpPool(pool,dbURL,user,password,1);
    boolean finalTry=(retryCount >= maxRetry);
    success=test(pool,dbURL,user,password,finalTry);
  }
 while (!success && retryCount < maxRetry);
  if (!success) {
    logger.warn("String_Node_Str");
  }
 else {
    logger.info("String_Node_Str",retryCount);
  }
  logger.debug("String_Node_Str",pool);
  return pool;
}
Program: 13325
Project: 13325
Buggy source:
@Override public JsonValue encrypt(JsonValue value,String cipher,String alias) throws JsonCryptoException, JsonException {
  JsonValue result=null;
  if (value != null) {
    result=getEncryptor(cipher,alias).encrypt(value);
  }
  return result;
}

Fixed version (ground truth):
@Override public JsonValue encrypt(JsonValue value,String cipher,String alias) throws JsonCryptoException, JsonException {
  JsonValue result=null;
  if (value != null) {
    JsonEncryptor encryptor=getEncryptor(cipher,alias);
    result=new JsonCrypto(encryptor.getType(),encryptor.encrypt(value)).toJsonValue();
  }
  return result;
}
Program: 13328
Project: 13328
Buggy source:
/** 
 * Query by primary key, the OpenIDM identifier. This identifier is different from the OrientDB internal record id.
 * @param id the OpenIDM identifier for an object
 * @param type the OrientDB class
 * @param database a handle to the OrientDB database object. No other thread must operate on this concurrently.
 * @return The ODocument if found, null if not found.
 * @throws Bad if the passed identifier or type are invalid
 */
public ODocument getByID(final String id,final String type,ODatabaseDocumentTx database) throws BadRequestException {
  String orientClassName=OrientDBRepoService.typeToOrientClassName(type);
  if (id == null) {
    throw new BadRequestException("String_Node_Str");
  }
 else   if (type == null) {
    throw new BadRequestException("String_Node_Str");
  }
  OSQLSynchQuery<ODocument> query=new OSQLSynchQuery<ODocument>("String_Node_Str" + orientClassName + "String_Node_Str"+ DocumentUtil.ORIENTDB_PRIMARY_KEY+ "String_Node_Str"+ id+ "String_Node_Str");
  List<ODocument> result=database.query(query);
  logger.trace("String_Node_Str",query,result);
  ODocument first=null;
  if (result.size() > 0) {
    first=result.get(0);
    first.reload();
  }
  return first;
}

Fixed version (ground truth):
/** 
 * Query by primary key, the OpenIDM identifier. This identifier is different from the OrientDB internal record id.
 * @param id the OpenIDM identifier for an object
 * @param type the OrientDB class
 * @param database a handle to the OrientDB database object. No other thread must operate on this concurrently.
 * @return The ODocument if found, null if not found.
 * @throws Bad if the passed identifier or type are invalid
 */
public ODocument getByID(final String id,final String type,ODatabaseDocumentTx database) throws BadRequestException {
  String orientClassName=OrientDBRepoService.typeToOrientClassName(type);
  if (id == null) {
    throw new BadRequestException("String_Node_Str");
  }
 else   if (type == null) {
    throw new BadRequestException("String_Node_Str");
  }
  OSQLSynchQuery<ODocument> query=new OSQLSynchQuery<ODocument>("String_Node_Str" + orientClassName + "String_Node_Str"+ DocumentUtil.ORIENTDB_PRIMARY_KEY+ "String_Node_Str"+ id+ "String_Node_Str");
  List<ODocument> result=database.query(query);
  logger.trace("String_Node_Str",query,result);
  ODocument first=null;
  if (result.size() > 0) {
    first=result.get(0);
  }
  return first;
}
Program: 13329
Project: 13329
Buggy source:
/** 
 * TODO: Description.
 * @return TODO.
 * @throws SynchronizationException TODO.
 */
protected boolean isSourceValid() throws SynchronizationException {
  boolean result=false;
  if (sourceObject != null) {
    if (validSource != null) {
      HashMap<String,Object> scope=new HashMap<String,Object>();
      scope.put("String_Node_Str",sourceObject);
      try {
        Object o=validSource.exec(scope);
        if (o == null || !(o instanceof Boolean)) {
          throw new SynchronizationException("String_Node_Str");
        }
        result=(Boolean)o;
      }
 catch (      ScriptException se) {
        throw new SynchronizationException(se);
      }
    }
 else {
      result=true;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @return TODO.
 * @throws SynchronizationException TODO.
 */
protected boolean isSourceValid() throws SynchronizationException {
  boolean result=false;
  if (sourceObject != null) {
    if (validSource != null) {
      HashMap<String,Object> scope=new HashMap<String,Object>();
      scope.put("String_Node_Str",sourceObject.asMap());
      try {
        Object o=validSource.exec(scope);
        if (o == null || !(o instanceof Boolean)) {
          throw new SynchronizationException("String_Node_Str");
        }
        result=(Boolean)o;
      }
 catch (      ScriptException se) {
        throw new SynchronizationException(se);
      }
    }
 else {
      result=true;
    }
  }
  return result;
}
Program: 13330
Project: 13330
Buggy source:
public void recon(String reconId) throws SynchronizationException {
  InvokeContext.getContext().pushActivityId(reconId);
  try {
    performRecon(reconId);
  }
  finally {
    InvokeContext.getContext().popActivityId();
  }
}

Fixed version (ground truth):
public void recon(String reconId) throws SynchronizationException {
  InvokeContext.getContext().pushActivityId(reconId);
  try {
    doRecon(reconId);
  }
  finally {
    InvokeContext.getContext().popActivityId();
  }
}
Program: 13331
Project: 13331
Buggy source:
/** 
 * TODO: Description.
 * @param source TODO.
 * @param target TODO.
 * @throws MappingException TODO.
 */
public void apply(JsonNode source,JsonNode target) throws SynchronizationException {
  try {
    Object result=this.source.get(source).getValue();
    if (script != null) {
      HashMap<String,Object> scope=new HashMap<String,Object>();
      scope.put("String_Node_Str",result);
      result=script.exec(scope);
    }
    this.target.put(target,result);
  }
 catch (  JsonNodeException jne) {
    throw new SynchronizationException(jne);
  }
catch (  ScriptException se) {
    throw new SynchronizationException(se);
  }
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @param source TODO.
 * @param target TODO.
 * @throws MappingException TODO.
 */
public void apply(JsonNode sourceObject,JsonNode targetObject) throws SynchronizationException {
  try {
    JsonNode node=sourcePath.get(sourceObject);
    if (node == null) {
      throw new SynchronizationException("String_Node_Str" + sourcePath.toString() + "String_Node_Str");
    }
    Object result=node.getValue();
    if (script != null) {
      HashMap<String,Object> scope=new HashMap<String,Object>();
      scope.put("String_Node_Str",result);
      result=script.exec(scope);
    }
    targetPath.put(targetObject,result);
  }
 catch (  JsonNodeException jne) {
    throw new SynchronizationException(jne);
  }
catch (  ScriptException se) {
    throw new SynchronizationException(se);
  }
}
Program: 13332
Project: 13332
Buggy source:
/** 
 * TODO: Description.
 * @param config TODO.
 * @throws JsonNodeException TODO>
 */
public PropertyMapping(JsonNode config) throws JsonNodeException {
  source=asPath(config,"String_Node_Str");
  target=asPath(config,"String_Node_Str");
  script=Scripts.newInstance(config.get("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @param config TODO.
 * @throws JsonNodeException TODO>
 */
public PropertyMapping(JsonNode config) throws JsonNodeException {
  sourcePath=asPath(config,"String_Node_Str");
  targetPath=asPath(config,"String_Node_Str");
  script=Scripts.newInstance(config.get("String_Node_Str"));
}
Program: 13334
Project: 13334
Buggy source:
/** 
 * TODO: Description.
 * @param object TODO.
 * @return TODO.
 */
private Tag getTag(Map<String,Object> map){
  Object rev=(map != null ? map.get("String_Node_Str") : null);
  return (rev != null && rev instanceof String ? new Tag((String)rev) : null);
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @param object TODO.
 * @return TODO.
 */
private Tag getTag(Map<String,Object> map){
  Object rev=(map != null ? map.get("String_Node_Str") : null);
  return (rev != null && rev instanceof String ? new Tag((String)rev,false) : null);
}
Program: 13335
Project: 13335
Buggy source:
/** 
 * TODO: Description.
 * @param object TODO.
 * @return TODO.
 * @throws InternalServerErrorException TODO.
 */
private Representation cuResponse(Map<String,Object> object) throws InternalServerErrorException {
  HashMap<String,Object> map=new HashMap<String,Object>();
  Object id=object.get("String_Node_Str");
  if (id == null || !(id instanceof String)) {
    throw new InternalServerErrorException("String_Node_Str");
  }
  map.put("String_Node_Str",(String)id);
  Object rev=object.get("String_Node_Str");
  if (rev != null && !(rev instanceof String)) {
    throw new InternalServerErrorException("String_Node_Str");
  }
  if (rev != null) {
    map.put("String_Node_Str",(String)rev);
  }
  Representation result=jacksonRepresentation(map);
  if (rev != null) {
    result.setTag(new Tag((String)rev));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @param object TODO.
 * @return TODO.
 * @throws InternalServerErrorException TODO.
 */
private Representation cuResponse(Map<String,Object> object) throws InternalServerErrorException {
  HashMap<String,Object> map=new HashMap<String,Object>();
  Object id=object.get("String_Node_Str");
  if (id != null && !(id instanceof String)) {
    throw new InternalServerErrorException("String_Node_Str");
  }
  map.put("String_Node_Str",(id != null ? (String)id : this.id));
  Object rev=object.get("String_Node_Str");
  if (rev != null && !(rev instanceof String)) {
    throw new InternalServerErrorException("String_Node_Str");
  }
  if (rev != null) {
    map.put("String_Node_Str",(String)rev);
  }
  Representation result=jacksonRepresentation(map);
  if (rev != null) {
    result.setTag(new Tag((String)rev,false));
  }
  return result;
}
Program: 13336
Project: 13336
Buggy source:
/** 
 * TODO: Description.
 * @returns TODO.
 * @throws ObjectSetException TODO.
 */
private Map<String,Object> readObject() throws ResourceException {
  try {
    Map<String,Object> object=objectSet.read(id);
    Status status=conditions.getStatus(getMethod(),true,getTag(object),null);
    if (status.isError()) {
      throw new ResourceException(status);
    }
    return object;
  }
 catch (  ObjectSetException ose) {
    throw new ResourceException(ose);
  }
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @returns TODO.
 * @throws ObjectSetException TODO.
 */
private Map<String,Object> readObject() throws ResourceException {
  try {
    Map<String,Object> object=objectSet.read(id);
    Status status=conditions.getStatus(getMethod(),true,getTag(object),null);
    if (status != null && status.isError()) {
      throw new ResourceException(status);
    }
    return object;
  }
 catch (  ObjectSetException ose) {
    throw new ResourceException(ose);
  }
}
Program: 13337
Project: 13337
Buggy source:
@Override protected void service(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException {
  if (adapter == null) {
    throw new ServletException("String_Node_Str");
  }
  adapter.service(req,res);
}

Fixed version (ground truth):
@Override protected void service(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException {
  if (adapter == null) {
    throw new ServletException("String_Node_Str");
  }
  InvokeContext.getContext().pushActivityId(UUID.randomUUID().toString());
  try {
    adapter.service(req,res);
  }
  finally {
    InvokeContext.getContext().popActivityId();
  }
}
Program: 13338
Project: 13338
Buggy source:
@Deactivate protected void deactivate(ComponentContext context){
  this.context=null;
  mappings.clear();
}

Fixed version (ground truth):
@Deactivate protected void deactivate(ComponentContext context){
  mappings.clear();
  this.context=null;
}
Program: 13339
Project: 13339
Buggy source:
/** 
 * Returns a new script object for the provided script configuration object.
 * @param config configuration object for script.
 * @return a new script instance, or {@code null} if {@code config} is {@code null}.
 * @throws JsonNodeException if the script configuration object or source is malformed.
 */
public static Script newInstance(JsonNode config) throws JsonNodeException {
  if (config == null) {
    return null;
  }
  for (  ScriptFactory factory : FACTORIES) {
    Script script=factory.newInstance(config);
    if (script != null) {
      return script;
    }
  }
  JsonNode name=config.get("String_Node_Str");
  throw new JsonNodeException(name,"String_Node_Str" + name.asString() + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Returns a new script object for the provided script configuration object.
 * @param config configuration object for script.
 * @return a new script instance, or {@code null} if {@code config} is {@code null}.
 * @throws JsonNodeException if the script configuration object or source is malformed.
 */
public static Script newInstance(JsonNode config) throws JsonNodeException {
  if (config == null || config.isNull()) {
    return null;
  }
  for (  ScriptFactory factory : FACTORIES) {
    Script script=factory.newInstance(config);
    if (script != null) {
      return script;
    }
  }
  JsonNode type=config.get("String_Node_Str");
  throw new JsonNodeException(type,"String_Node_Str" + type.asString() + "String_Node_Str");
}
Program: 13340
Project: 13340
Buggy source:
/** 
 * TODO: Description.
 * @param targetId TODO.
 * @throws SynchronizationException TODO.
 */
private void updateTargetObject(JsonNode target) throws SynchronizationException {
  try {
    service.getRouter().update(target.get("String_Node_Str").required().asString(),target.get("String_Node_Str").asString(),target.asMap());
  }
 catch (  JsonNodeException jne) {
    throw new SynchronizationException(jne);
  }
catch (  ObjectSetException ose) {
    throw new SynchronizationException(ose);
  }
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @param targetId TODO.
 * @throws SynchronizationException TODO.
 */
private void updateTargetObject(JsonNode target) throws SynchronizationException {
  try {
    service.getRouter().update(targetObjectSet + '/' + target.get("String_Node_Str").required().asString(),target.get("String_Node_Str").asString(),target.asMap());
  }
 catch (  JsonNodeException jne) {
    throw new SynchronizationException(jne);
  }
catch (  ObjectSetException ose) {
    LOGGER.debug("String_Node_Str",ose);
    throw new SynchronizationException(ose);
  }
}
Program: 13341
Project: 13341
Buggy source:
/** 
 * TODO: Description.
 * @param targetId TODO.
 * @throws SynchronizationException TODO.
 */
private void createTargetObject(JsonNode target) throws SynchronizationException {
  StringBuilder sb=new StringBuilder();
  sb.append(targetObjectSet);
  if (target.get("String_Node_Str").isString()) {
    sb.append('/').append(target.get("String_Node_Str").asString());
  }
  try {
    service.getRouter().create(sb.toString(),target.asMap());
  }
 catch (  JsonNodeException jne) {
    throw new SynchronizationException(jne);
  }
catch (  ObjectSetException ose) {
    throw new SynchronizationException(ose);
  }
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @param targetId TODO.
 * @throws SynchronizationException TODO.
 */
private void createTargetObject(JsonNode target) throws SynchronizationException {
  StringBuilder sb=new StringBuilder();
  sb.append(targetObjectSet);
  if (target.get("String_Node_Str").isString()) {
    sb.append('/').append(target.get("String_Node_Str").asString());
  }
  try {
    service.getRouter().create(sb.toString(),target.asMap());
  }
 catch (  JsonNodeException jne) {
    throw new SynchronizationException(jne);
  }
catch (  ObjectSetException ose) {
    LOGGER.debug("String_Node_Str",ose);
    throw new SynchronizationException(ose);
  }
}
Program: 13342
Project: 13342
Buggy source:
/** 
 * TODO: Description.
 * @param objectSet TODO.
 * @param id TODO.
 * @throws NullPointerException if {@code targetId} is {@code null}.
 * @throws SynchronizationException TODO.
 */
private JsonNode readObject(String objectSet,String id) throws SynchronizationException {
  if (id == null) {
    throw new NullPointerException();
  }
  try {
    return new JsonNode(service.getRouter().read(objectSet + '/' + id));
  }
 catch (  NotFoundException nfe) {
    return null;
  }
catch (  ObjectSetException ose) {
    throw new SynchronizationException(ose);
  }
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @param objectSet TODO.
 * @param id TODO.
 * @throws NullPointerException if {@code targetId} is {@code null}.
 * @throws SynchronizationException TODO.
 */
private JsonNode readObject(String objectSet,String id) throws SynchronizationException {
  if (id == null) {
    throw new NullPointerException();
  }
  try {
    return new JsonNode(service.getRouter().read(objectSet + '/' + id));
  }
 catch (  NotFoundException nfe) {
    return null;
  }
catch (  ObjectSetException ose) {
    LOGGER.debug("String_Node_Str",ose);
    throw new SynchronizationException(ose);
  }
}
Program: 13343
Project: 13343
Buggy source:
/** 
 * TODO: Description.
 * @param target TODO.
 * @throws SynchronizationException TODO.
 */
private void deleteTargetObject(JsonNode target) throws SynchronizationException {
  if (target.get("String_Node_Str").isString()) {
    try {
      service.getRouter().delete(targetObjectSet + '/' + target.get("String_Node_Str").asString(),target.get("String_Node_Str").asString());
    }
 catch (    JsonNodeException jne) {
      throw new SynchronizationException(jne);
    }
catch (    NotFoundException nfe) {
    }
catch (    ObjectSetException ose) {
      throw new SynchronizationException(ose);
    }
  }
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @param target TODO.
 * @throws SynchronizationException TODO.
 */
private void deleteTargetObject(JsonNode target) throws SynchronizationException {
  if (target.get("String_Node_Str").isString()) {
    try {
      service.getRouter().delete(targetObjectSet + '/' + target.get("String_Node_Str").asString(),target.get("String_Node_Str").asString());
    }
 catch (    JsonNodeException jne) {
      throw new SynchronizationException(jne);
    }
catch (    NotFoundException nfe) {
    }
catch (    ObjectSetException ose) {
      LOGGER.debug("String_Node_Str",ose);
      throw new SynchronizationException(ose);
    }
  }
}
Program: 13344
Project: 13344
Buggy source:
/** 
 * TODO: Description.
 * @throws SynchronizationException TODO.
 */
private void assessSituation() throws SynchronizationException {
  situation=null;
  if (!isTargetValid()) {
    return;
  }
  String targetId=(targetObject != null ? targetObject.get("String_Node_Str").asString() : null);
  if (targetId != null) {
    linkObject.getLinkForTarget(targetId);
  }
  if (reconId != null && reconId.equals(linkObject.reconId)) {
    situation=null;
  }
 else   if (linkObject._id == null || linkObject.sourceId == null) {
    situation=Situation.UNQUALIFIED;
  }
 else {
    sourceObject=readObject(sourceObjectSet,linkObject.sourceId);
    if (sourceObject == null || !isSourceValid()) {
      situation=Situation.UNQUALIFIED;
    }
 else {
      situation=Situation.CONFIRMED;
    }
  }
}

Fixed version (ground truth):
/** 
 * TODO: Description.
 * @throws SynchronizationException TODO.
 */
private void assessSituation() throws SynchronizationException {
  situation=null;
  if (!isTargetValid()) {
    return;
  }
  String targetId=(targetObject != null ? targetObject.get("String_Node_Str").asString() : null);
  if (targetId != null) {
    linkObject.getLinkForTarget(targetId);
  }
  if (reconId != null && reconId.equals(linkObject.reconId)) {
    return;
  }
 else   if (linkObject._id == null || linkObject.sourceId == null) {
    situation=Situation.UNQUALIFIED;
  }
 else {
    sourceObject=readObject(sourceObjectSet,linkObject.sourceId);
    if (sourceObject == null || !isSourceValid()) {
      situation=Situation.UNQUALIFIED;
    }
 else {
      situation=Situation.CONFIRMED;
    }
  }
}
Program: 13345
Project: 13345
Buggy source:
@Override public Map<String,Object> read(String id) throws ObjectSetException {
  Map<String,Object> object=service.getRepository().read(repoId(id));
  onRetrieve(object);
  execScript(onRead,object);
  return object;
}

Fixed version (ground truth):
@Override public Map<String,Object> read(String id) throws ObjectSetException {
  LOGGER.debug("String_Node_Str",name,id);
  Map<String,Object> object=service.getRepository().read(repoId(id));
  onRetrieve(object);
  execScript(onRead,object);
  return object;
}
Program: 13346
Project: 13346
Buggy source:
/** 
 * Constructs a new managed object set.
 * @param config configuration object to use to initialize managed object set.
 * @throws JsonNodeException if the configuration is malformed.
 */
public ManagedObjectSet(ManagedObjectService service,JsonNode config) throws JsonNodeException {
  this.service=service;
  name=config.get("String_Node_Str").required().asString();
  schema=config.get("String_Node_Str").expect(Map.class);
  onCreate=Scripts.newInstance(config.get("String_Node_Str"));
  onRead=Scripts.newInstance(config.get("String_Node_Str"));
  onUpdate=Scripts.newInstance(config.get("String_Node_Str"));
  onDelete=Scripts.newInstance(config.get("String_Node_Str"));
  onValidate=Scripts.newInstance(config.get("String_Node_Str"));
  for (  JsonNode node : config.get("String_Node_Str").expect(List.class)) {
    properties.add(new ManagedObjectProperty(node));
  }
}

Fixed version (ground truth):
/** 
 * Constructs a new managed object set.
 * @param config configuration object to use to initialize managed object set.
 * @throws JsonNodeException if the configuration is malformed.
 */
public ManagedObjectSet(ManagedObjectService service,JsonNode config) throws JsonNodeException {
  this.service=service;
  name=config.get("String_Node_Str").required().asString();
  schema=config.get("String_Node_Str").expect(Map.class);
  onCreate=Scripts.newInstance(config.get("String_Node_Str"));
  onRead=Scripts.newInstance(config.get("String_Node_Str"));
  onUpdate=Scripts.newInstance(config.get("String_Node_Str"));
  onDelete=Scripts.newInstance(config.get("String_Node_Str"));
  onValidate=Scripts.newInstance(config.get("String_Node_Str"));
  for (  JsonNode node : config.get("String_Node_Str").expect(List.class)) {
    properties.add(new ManagedObjectProperty(node));
  }
  LOGGER.debug("String_Node_Str",name);
}
Program: 13347
Project: 13347
Buggy source:
@Override public Map<String,Object> query(String id,Map<String,Object> params) throws ObjectSetException {
  return service.getRepository().query(repoId(id),params);
}

Fixed version (ground truth):
@Override public Map<String,Object> query(String id,Map<String,Object> params) throws ObjectSetException {
  LOGGER.debug("String_Node_Str",name,id);
  return service.getRepository().query(repoId(id),params);
}
Program: 13348
Project: 13348
Buggy source:
@Override public void update(String id,String rev,Map<String,Object> object) throws ObjectSetException {
  Map<String,Object> oldObject=service.getRepository().read(repoId(id));
  if (onUpdate != null) {
    HashMap<String,Object> scope=new HashMap<String,Object>();
    scope.put("String_Node_Str",oldObject);
    scope.put("String_Node_Str",object);
    try {
      onUpdate.exec(scope);
    }
 catch (    ScriptThrownException ste) {
      throw new ForbiddenException(ste.getValue().toString());
    }
catch (    ScriptException se) {
      throw new InternalServerErrorException(se.getMessage());
    }
  }
  onStore(object);
  service.getRepository().update(repoId(id),rev,object);
  try {
    for (    SynchronizationListener listener : listeners) {
      listener.onUpdate(routeId(id),oldObject,object);
    }
  }
 catch (  SynchronizationException se) {
    throw new InternalServerErrorException(se);
  }
}

Fixed version (ground truth):
@Override public void update(String id,String rev,Map<String,Object> object) throws ObjectSetException {
  LOGGER.debug("String_Node_Str","String_Node_Str" + name + "String_Node_Str"+ id+ "String_Node_Str"+ rev);
  Map<String,Object> oldObject=service.getRepository().read(repoId(id));
  if (onUpdate != null) {
    HashMap<String,Object> scope=new HashMap<String,Object>();
    scope.put("String_Node_Str",oldObject);
    scope.put("String_Node_Str",object);
    try {
      onUpdate.exec(scope);
    }
 catch (    ScriptThrownException ste) {
      throw new ForbiddenException(ste.getValue().toString());
    }
catch (    ScriptException se) {
      throw new InternalServerErrorException(se.getMessage());
    }
  }
  onStore(object);
  service.getRepository().update(repoId(id),rev,object);
  try {
    for (    SynchronizationListener listener : listeners) {
      listener.onUpdate(routeId(id),oldObject,object);
    }
  }
 catch (  SynchronizationException se) {
    throw new InternalServerErrorException(se);
  }
}
Program: 13349
Project: 13349
Buggy source:
@Override public void delete(String id,String rev) throws ObjectSetException {
  if (onDelete != null) {
    Map<String,Object> object=service.getRepository().read(repoId(id));
    execScript(onDelete,object);
  }
  service.getRepository().delete(repoId(id),rev);
  try {
    for (    SynchronizationListener listener : listeners) {
      listener.onDelete(routeId(id));
    }
  }
 catch (  SynchronizationException se) {
    throw new InternalServerErrorException(se);
  }
}

Fixed version (ground truth):
@Override public void delete(String id,String rev) throws ObjectSetException {
  LOGGER.debug("String_Node_Str","String_Node_Str" + name + "String_Node_Str"+ id+ "String_Node_Str"+ rev);
  if (onDelete != null) {
    Map<String,Object> object=service.getRepository().read(repoId(id));
    execScript(onDelete,object);
  }
  service.getRepository().delete(repoId(id),rev);
  try {
    for (    SynchronizationListener listener : listeners) {
      listener.onDelete(routeId(id));
    }
  }
 catch (  SynchronizationException se) {
    throw new InternalServerErrorException(se);
  }
}
Program: 13350
Project: 13350
Buggy source:
@Override public void create(String id,Map<String,Object> object) throws ObjectSetException {
  execScript(onCreate,object);
  onStore(object);
  if (object.containsKey("String_Node_Str")) {
    id=object.get("String_Node_Str").toString();
  }
  if (id == null) {
    id=UUID.randomUUID().toString();
    object.put("String_Node_Str",id);
  }
  service.getRepository().create(repoId(id),object);
  try {
    for (    SynchronizationListener listener : listeners) {
      listener.onCreate(routeId(id),object);
    }
  }
 catch (  SynchronizationException se) {
    throw new InternalServerErrorException(se);
  }
}

Fixed version (ground truth):
@Override public void create(String id,Map<String,Object> object) throws ObjectSetException {
  LOGGER.debug("String_Node_Str",name,id);
  execScript(onCreate,object);
  onStore(object);
  if (object.containsKey("String_Node_Str")) {
    id=object.get("String_Node_Str").toString();
  }
  if (id == null) {
    id=UUID.randomUUID().toString();
    object.put("String_Node_Str",id);
  }
  service.getRepository().create(repoId(id),object);
  try {
    for (    SynchronizationListener listener : listeners) {
      listener.onCreate(routeId(id),object);
    }
  }
 catch (  SynchronizationException se) {
    throw new InternalServerErrorException(se);
  }
}
Program: 13351
Project: 13351
Buggy source:
/** 
 * TODO: Description. <p> This method exects a   {@code "sourceQuery"} defined with a parameter of{@code "sourceId"}.
 * @param targetId TODO.
 * @throws SynchronizationException TODO.
 */
void getLinkForTarget(String targetId) throws SynchronizationException {
  clear();
  if (targetId != null) {
    JsonNode query=new JsonNode(new HashMap<String,Object>());
    query.put(QueryConstants.QUERY_ID,"String_Node_Str");
    query.put("String_Node_Str","String_Node_Str");
    getLink(query);
  }
}

Fixed version (ground truth):
/** 
 * TODO: Description. <p> This method exects a   {@code "sourceQuery"} defined with a parameter of{@code "sourceId"}.
 * @param targetId TODO.
 * @throws SynchronizationException TODO.
 */
void getLinkForTarget(String targetId) throws SynchronizationException {
  clear();
  if (targetId != null) {
    JsonNode query=new JsonNode(new HashMap<String,Object>());
    query.put(QueryConstants.QUERY_ID,"String_Node_Str");
    query.put("String_Node_Str",targetId);
    getLink(query);
  }
}
Program: 13353
Project: 13353
Buggy source:
protected void initialiseLocalManager(ConnectorInfoManagerFactory factory,String connectorsArea){
  System.out.println("String_Node_Str" + connectorsArea);
  if (null != connectorsArea) {
    TRACE.info("String_Node_Str" + connectorsArea + "String_Node_Str");
    File dir=new File(connectorsArea);
    if (!dir.exists()) {
      String absolutePath=dir.getAbsolutePath();
      System.out.println("String_Node_Str" + absolutePath);
      TRACE.error("String_Node_Str" + absolutePath + "String_Node_Str");
    }
 else {
      try {
        System.out.println("String_Node_Str" + dir.getAbsoluteFile().toURI().toURL());
        URL[] bundleUrls=getConnectorURLs(dir.getAbsoluteFile().toURI().toURL());
        factory.getLocalManager(bundleUrls);
      }
 catch (      MalformedURLException e) {
        TRACE.error("String_Node_Str",e);
      }
    }
  }
 else {
    throw new ComponentException("String_Node_Str");
  }
}

Fixed version (ground truth):
protected void initialiseLocalManager(ConnectorInfoManagerFactory factory,String connectorsArea){
  if (null != connectorsArea) {
    try {
      String connectorsDir=URLDecoder.decode(connectorsArea,"String_Node_Str");
      TRACE.info("String_Node_Str" + connectorsDir + "String_Node_Str");
      File dir=new File(connectorsDir);
      if (!dir.exists()) {
        String absolutePath=dir.getAbsolutePath();
        TRACE.error("String_Node_Str" + absolutePath + "String_Node_Str");
      }
 else {
        try {
          URL[] bundleUrls=getConnectorURLs(dir.getAbsoluteFile().toURI().toURL());
          factory.getLocalManager(bundleUrls);
        }
 catch (        MalformedURLException e) {
          TRACE.error("String_Node_Str",e);
        }
      }
    }
 catch (    UnsupportedEncodingException e) {
      throw new UndeclaredThrowableException(e);
    }
  }
 else {
    throw new ComponentException("String_Node_Str");
  }
}
Program: 13355
Project: 13355
Buggy source:
protected void unbind(ConnectorInfoProvider connectorInfoProvider){
  connectorInfoProvider=null;
  TRACE.info("String_Node_Str");
}

Fixed version (ground truth):
protected void unbind(ConnectorInfoProvider connectorInfoProvider){
  this.connectorInfoProvider=null;
  TRACE.info("String_Node_Str");
}
Program: 13356
Project: 13356
Buggy source:
@Test public void testCreateSystemConfiguration() throws URISyntaxException {
  ConnectorInfo xmlConnectorInfo=null;
  ConnectorKey key=new ConnectorKey("String_Node_Str","String_Node_Str","String_Node_Str");
  for (  ConnectorInfo info : testableConnectorInfoProvider.getAllConnectorInfo()) {
    if (key.equals(info.getConnectorKey())) {
      xmlConnectorInfo=info;
      break;
    }
  }
  Assert.assertNotNull(xmlConnectorInfo);
  APIConfiguration configuration=xmlConnectorInfo.createDefaultAPIConfiguration();
  URL xmlRoot=OpenICFProvisionerServiceXMLConnectorTest.class.getResource("String_Node_Str");
  Assert.assertNotNull(xmlRoot);
  URI xsdIcfFilePath=xmlRoot.toURI().resolve("String_Node_Str");
  configuration.getConfigurationProperties().setPropertyValue("String_Node_Str",xsdIcfFilePath.getPath());
  URI xsdFilePath=xmlRoot.toURI().resolve("String_Node_Str");
  configuration.getConfigurationProperties().setPropertyValue("String_Node_Str",xsdFilePath.getPath());
  URI xmlFilePath=xmlRoot.toURI().resolve("String_Node_Str");
  configuration.getConfigurationProperties().setPropertyValue("String_Node_Str",xmlFilePath.getPath());
  try {
    ObjectMapper mapper=new ObjectMapper();
    URL root=ObjectClassInfoHelperTest.class.getResource("String_Node_Str");
    mapper.writeValue(new File((new URL(root,"String_Node_Str")).toURI()),testableConnectorInfoProvider.createSystemConfiguration(configuration,true));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Test public void testCreateSystemConfiguration() throws URISyntaxException {
  ConnectorInfo xmlConnectorInfo=null;
  ConnectorKey key=new ConnectorKey("String_Node_Str","String_Node_Str","String_Node_Str");
  for (  ConnectorInfo info : testableConnectorInfoProvider.getAllConnectorInfo()) {
    if (key.equals(info.getConnectorKey())) {
      xmlConnectorInfo=info;
      break;
    }
  }
  Assert.assertNotNull(xmlConnectorInfo);
  APIConfiguration configuration=xmlConnectorInfo.createDefaultAPIConfiguration();
  URL xmlRoot=OpenICFProvisionerServiceXMLConnectorTest.class.getResource("String_Node_Str");
  Assert.assertNotNull(xmlRoot);
  URI xsdIcfFilePath=xmlRoot.toURI().resolve("String_Node_Str");
  configuration.getConfigurationProperties().setPropertyValue("String_Node_Str",new File(xsdIcfFilePath));
  URI xsdFilePath=xmlRoot.toURI().resolve("String_Node_Str");
  configuration.getConfigurationProperties().setPropertyValue("String_Node_Str",new File(xsdFilePath));
  URI xmlFilePath=xmlRoot.toURI().resolve("String_Node_Str");
  configuration.getConfigurationProperties().setPropertyValue("String_Node_Str",new File(xmlFilePath));
  try {
    ObjectMapper mapper=new ObjectMapper();
    URL root=ObjectClassInfoHelperTest.class.getResource("String_Node_Str");
    mapper.writeValue(new File((new URL(root,"String_Node_Str")).toURI()),testableConnectorInfoProvider.createSystemConfiguration(configuration,true));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 13357
Project: 13357
Buggy source:
@BeforeTest public void beforeTest() throws Exception {
  String configurationFile="String_Node_Str" + OpenICFProvisionerServiceXMLConnectorTest.class.getCanonicalName() + "String_Node_Str";
  InputStream inputStream=TestLocalConnectorInfoProviderStub.class.getResourceAsStream(configurationFile);
  Assert.assertNotNull(inputStream,"String_Node_Str" + configurationFile);
  ObjectMapper mapper=new ObjectMapper();
  JsonNode jsonConfiguration=new JsonNode(mapper.readValue(inputStream,Map.class));
  APIConfiguration config=new APIConfigurationImpl();
  builder=new OperationHelperBuilder("String_Node_Str",jsonConfiguration,config);
}

Fixed version (ground truth):
@BeforeTest public void beforeTest() throws Exception {
  String configurationFile="String_Node_Str" + OpenICFProvisionerServiceXMLConnectorTest.class.getCanonicalName() + "String_Node_Str";
  InputStream inputStream=OperationHelperImplTest.class.getResourceAsStream(configurationFile);
  Assert.assertNotNull(inputStream,"String_Node_Str" + configurationFile);
  ObjectMapper mapper=new ObjectMapper();
  JsonNode jsonConfiguration=new JsonNode(mapper.readValue(inputStream,Map.class));
  APIConfiguration config=new APIConfigurationImpl();
  builder=new OperationHelperBuilder("String_Node_Str",jsonConfiguration,config);
}
Program: 13358
Project: 13358
Buggy source:
public void setViewSize(int width,int height){
  viewSize.onNext(new PointD(width,height));
  lastViewSize=new PointD(width,height);
}

Fixed version (ground truth):
public void setViewSize(int width,int height){
  viewSize.onNext(new PointD(width,height));
}
Program: 13359
Project: 13359
Buggy source:
public MapTileDrawable(int zoom,int x,int y,double screenX,double screenY){
  super(zoom,x,y);
  this.screenX=screenX;
  this.screenY=screenY;
}

Fixed version (ground truth):
public MapTileDrawable(int zoom,int x,int y,double size,double screenX,double screenY){
  super(zoom,x,y);
  this.size=size;
  this.screenX=screenX;
  this.screenY=screenY;
}
Program: 13360
Project: 13360
Buggy source:
public LatLngCalculator(final CoordinateProjection coordinateProjection,final Observable<PointD> pixelDelta,final Observable<LatLng> latLng){
  final Subject<LatLng,LatLng> latLngSubject=BehaviorSubject.create();
  pixelDelta.subscribe(new Action1<PointD>(){
    @Override public void call(    PointD pointD){
      Log.v(TAG,"String_Node_Str" + pointD + "String_Node_Str");
      final double cx=mapState.offset.x + mapState.viewSize.x / 2.0;
      final double cy=mapState.offset.y + mapState.viewSize.y / 2.0;
      final PointD newPoint=new PointD(cx - pointD.x,cy - pointD.y);
      final LatLng newLatLng=coordinateProjection.fromPointToLatLng(newPoint,mapState.zoomLevel);
      latLngSubject.onNext(newLatLng);
    }
  }
);
  latLng.subscribe(new Action1<LatLng>(){
    @Override public void call(    LatLng latLng){
      LatLngCalculator.this.lastLatLng=latLng;
      latLngSubject.onNext(latLng);
    }
  }
);
  observable=latLngSubject;
}

Fixed version (ground truth):
public LatLngCalculator(final CoordinateProjection coordinateProjection,final Observable<PointD> pixelDelta,final Observable<LatLng> latLng){
  final Subject<LatLng,LatLng> latLngSubject=BehaviorSubject.create();
  pixelDelta.subscribe(new Action1<PointD>(){
    @Override public void call(    final PointD pixedDelta){
      Log.v(TAG,"String_Node_Str" + pixedDelta + "String_Node_Str");
      final double cx=mapState.viewSize.x / 2.0 - mapState.offset.x;
      final double cy=mapState.viewSize.y / 2.0 - mapState.offset.y;
      final PointD newPoint=new PointD(cx - pixedDelta.x,cy - pixedDelta.y);
      final LatLng newLatLng=coordinateProjection.fromPointToLatLng(newPoint,mapState.zoomLevel);
      latLngSubject.onNext(newLatLng);
    }
  }
);
  latLng.subscribe(new Action1<LatLng>(){
    @Override public void call(    LatLng latLng){
      LatLngCalculator.this.lastLatLng=latLng;
      latLngSubject.onNext(latLng);
    }
  }
);
  observable=latLngSubject;
}
Program: 13361
Project: 13361
Buggy source:
static private Collection<MapTileDrawable> calculateMapTiles(final double tileSizePx,final Integer zoomLevel,final PointD viewSize,final PointD offset){
  final int firstTileX=(int)Math.floor(-offset.x / tileSizePx);
  final int firstTileY=(int)Math.floor(-offset.y / tileSizePx);
  final int numX=(int)Math.ceil(viewSize.x / tileSizePx);
  final int numY=(int)Math.ceil(viewSize.y / tileSizePx);
  final List<MapTileDrawable> mapTileList=new ArrayList<MapTileDrawable>();
  for (int i=firstTileX; i <= firstTileX + numX; i++) {
    for (int n=firstTileY; n <= firstTileY + numY; n++) {
      final MapTileDrawable mapTile=new MapTileDrawable(zoomLevel,i,n,i * tileSizePx + offset.x,n * tileSizePx + offset.y);
      mapTileList.add(mapTile);
    }
  }
  return mapTileList;
}

Fixed version (ground truth):
static private Collection<MapTileDrawable> calculateMapTiles(final double tileSizePx,final Integer zoomLevel,final PointD viewSize,final PointD offset){
  final int firstTileX=(int)Math.floor(-offset.x / tileSizePx);
  final int firstTileY=(int)Math.floor(-offset.y / tileSizePx);
  final int numX=(int)Math.ceil(viewSize.x / tileSizePx);
  final int numY=(int)Math.ceil(viewSize.y / tileSizePx);
  final List<MapTileDrawable> mapTileList=new ArrayList<MapTileDrawable>();
  for (int i=firstTileX; i <= firstTileX + numX; i++) {
    for (int n=firstTileY; n <= firstTileY + numY; n++) {
      final MapTileDrawable mapTile=new MapTileDrawable(zoomLevel,i,n,tileSizePx,i * tileSizePx + offset.x,n * tileSizePx + offset.y);
      mapTileList.add(mapTile);
    }
  }
  return mapTileList;
}
Program: 13362
Project: 13362
Buggy source:
@Override public boolean onTouch(View v,MotionEvent event){
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    lastTouch=new PointD(event.getX(),event.getY());
  break;
case MotionEvent.ACTION_MOVE:
if (lastTouch != null) {
  deltaStream.onNext(new PointD(event.getX() - lastTouch.x,event.getY() - lastTouch.y));
  lastTouch=new PointD(event.getX(),event.getY());
}
break;
case MotionEvent.ACTION_UP:
lastTouch=null;
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouch(View v,MotionEvent event){
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    lastTouch=new PointD(event.getX(),event.getY());
  break;
case MotionEvent.ACTION_MOVE:
if (lastTouch != null) {
  final PointD delta=new PointD(event.getX() - lastTouch.x,event.getY() - lastTouch.y);
  deltaStream.onNext(delta);
  lastTouch=new PointD(event.getX(),event.getY());
}
break;
case MotionEvent.ACTION_UP:
lastTouch=null;
break;
}
return true;
}
Program: 13363
Project: 13363
Buggy source:
private void init(){
  paint=new Paint(Paint.ANTI_ALIAS_FLAG);
  this.setBackgroundColor(Color.LTGRAY);
  rectPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  rectPaint.setColor(Color.RED);
  rectPaint.setStyle(Paint.Style.STROKE);
}

Fixed version (ground truth):
private void init(){
  paint=new Paint(Paint.ANTI_ALIAS_FLAG);
  this.setBackgroundColor(Color.LTGRAY);
  rectPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  rectPaint.setColor(Color.RED);
  rectPaint.setStyle(Paint.Style.STROKE);
  textPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  textPaint.setColor(Color.BLACK);
  textPaint.setTextSize(20);
  textPaint.setTextAlign(Paint.Align.LEFT);
}