Program: 19919
Project: 19919
Buggy source:
@PUT @Produces(APPLICATION_JSON_UTF8) @Consumes(APPLICATION_JSON_UTF8) @Path("String_Node_Str") public Response updateTopicViewParent(@PathParam("String_Node_Str") final String databaseId,@PathParam("String_Node_Str") final String topicId,@PathParam("String_Node_Str") final String viewId,@PathParam("String_Node_Str") final String parentTopicId,@PathParam("String_Node_Str") final String parentViewId,@PathParam("String_Node_Str") final String parentFieldId,TopicView topicView) throws Exception {
  Presto session=createPresto(databaseId);
  try {
    boolean readOnly=false;
    PrestoContext context=PrestoContext.create(session,Links.deskull(topicId),viewId,readOnly);
    if (context.isMissingTopic()) {
      return Response.status(Status.NOT_FOUND).build();
    }
    TopicView result=session.updateTopic(context,topicView);
    session.commit();
    if (context.isNewTopic()) {
      String newTopicId=result.getTopicId();
      if (newTopicId == null) {
        return Response.ok(result).build();
      }
    }
    PrestoContext parentContext=PrestoContext.create(session,Links.deskull(parentTopicId),parentViewId,readOnly);
    if (parentContext.isNewTopic()) {
      return Response.ok(result).build();
    }
 else {
      FieldData fieldData=session.createFieldDataForParent(parentContext,parentFieldId,session,readOnly,context,result);
      return addFieldValues(databaseId,parentTopicId,parentViewId,parentFieldId,fieldData);
    }
  }
 catch (  Exception e) {
    session.abort();
    throw e;
  }
 finally {
    session.close();
  }
}

Fixed version (ground truth):
@PUT @Produces(APPLICATION_JSON_UTF8) @Consumes(APPLICATION_JSON_UTF8) @Path("String_Node_Str") public Response updateTopicViewParent(@PathParam("String_Node_Str") final String databaseId,@PathParam("String_Node_Str") final String topicId,@PathParam("String_Node_Str") final String viewId,@PathParam("String_Node_Str") final String parentTopicId,@PathParam("String_Node_Str") final String parentViewId,@PathParam("String_Node_Str") final String parentFieldId,TopicView topicView) throws Exception {
  Presto session=createPresto(databaseId);
  try {
    boolean readOnly=false;
    PrestoContext parentContext=PrestoContext.create(session,Links.deskull(parentTopicId),parentViewId,readOnly);
    PrestoDataProvider dataProvider=session.getDataProvider();
    PrestoSchemaProvider schemaProvider=session.getSchemaProvider();
    PrestoTopic parentTopic=dataProvider.getTopicById(parentTopicId);
    String parentTypeId=parentTopic.getTypeId();
    PrestoType parentType=schemaProvider.getTypeById(parentTypeId);
    PrestoView parentView=parentType.getViewById(parentViewId);
    PrestoFieldUsage parentField=parentType.getFieldById(parentFieldId,parentView);
    PrestoContext context=PrestoContext.createSubContext(session,parentContext,parentField,topicId,viewId,readOnly);
    if (context.isMissingTopic()) {
      return Response.status(Status.NOT_FOUND).build();
    }
    TopicView result=session.updateTopic(context,topicView);
    session.commit();
    if (context.isNewTopic()) {
      String newTopicId=result.getTopicId();
      if (newTopicId == null) {
        return Response.ok(result).build();
      }
    }
    if (parentContext.isNewTopic()) {
      return Response.ok(result).build();
    }
 else {
      FieldData fieldData=session.createFieldDataForParent(parentContext,parentFieldId,session,readOnly,context,result);
      return addFieldValues(databaseId,parentTopicId,parentViewId,parentFieldId,fieldData);
    }
  }
 catch (  Exception e) {
    session.abort();
    throw e;
  }
 finally {
    session.close();
  }
}