nus-yam/ex-repair huggingface dataset:
Program: 168719
Project: 168719
Buggy source:
@Override public Collection<Measurements> find(String tenantId,String name,Map<String,String> dimensions,DateTime startTime,@Nullable DateTime endTime) throws Exception {
  String dimsPart=Utils.WhereClauseBuilder.buildDimsPart(dimensions);
  String timePart=Utils.WhereClauseBuilder.buildTimePart(startTime,endTime);
  String query=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",Utils.SQLSanitizer.sanitize(name),Utils.SQLSanitizer.sanitize(tenantId),timePart,dimsPart);
  logger.debug("String_Node_Str",query);
  List<Serie> result=this.influxDB.Query(this.config.influxDB.getName(),query,TimeUnit.MILLISECONDS);
  Measurements measurements=new Measurements();
  measurements.setName(name);
  measurements.setDimensions(dimensions);
  List<Object[]> valObjArryList=new LinkedList<>();
  for (  Serie serie : result) {
    Object[][] valObjArry=serie.getPoints();
    for (int i=0; i < valObjArry.length; i++) {
      Object[] objArry=new Object[3];
      objArry[0]=valObjArry[i][1];
      objArry[1]=DATETIME_FORMATTER.print((long)valObjArry[i][0]);
      objArry[2]=valObjArry[i][2];
      valObjArryList.add(objArry);
    }
  }
  measurements.setMeasurements(valObjArryList);
  return Arrays.asList(measurements);
}

Fixed version (ground truth):
@Override public Collection<Measurements> find(String tenantId,String name,Map<String,String> dimensions,DateTime startTime,@Nullable DateTime endTime) throws Exception {
  String dimsPart=Utils.WhereClauseBuilder.buildDimsPart(dimensions);
  String timePart=Utils.WhereClauseBuilder.buildTimePart(startTime,endTime);
  String query=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",Utils.SQLSanitizer.sanitize(name),Utils.SQLSanitizer.sanitize(tenantId),timePart,dimsPart);
  logger.debug("String_Node_Str",query);
  List<Serie> result=this.influxDB.Query(this.config.influxDB.getName(),query,TimeUnit.MILLISECONDS);
  Measurements measurements=new Measurements();
  measurements.setName(name);
  measurements.setDimensions(dimensions);
  List<Object[]> valObjArryList=new LinkedList<>();
  for (  Serie serie : result) {
    Object[][] valObjArry=serie.getPoints();
    for (int i=0; i < valObjArry.length; i++) {
      Object[] objArry=new Object[3];
      objArry[0]=valObjArry[i][1];
      Double timeDouble=(Double)valObjArry[i][0];
      objArry[1]=DATETIME_FORMATTER.print(timeDouble.longValue());
      objArry[2]=valObjArry[i][2];
      valObjArryList.add(objArry);
    }
  }
  measurements.setMeasurements(valObjArryList);
  return Arrays.asList(measurements);
}
Program: 168721
Project: 168721
Buggy source:
/** 
 * @throws WebApplicationException if the {@code statistics} empty or invalid.
 */
public static List<String> parseValidateAndNormalizeStatistics(Iterable<String> statistics){
  List<String> validStats=new ArrayList<String>(5);
  for (  String statistic : statistics) {
    String statisticLower=statistic.toLowerCase();
    if (!VALID_STATISTICS.contains(statistic))     throw Exceptions.unprocessableEntity("String_Node_Str",statistic);
    validStats.add(statisticLower);
  }
  if (validStats.isEmpty())   throw Exceptions.unprocessableEntity("String_Node_Str");
  return validStats;
}

Fixed version (ground truth):
/** 
 * @throws WebApplicationException if the {@code statistics} empty or invalid.
 */
public static List<String> parseValidateAndNormalizeStatistics(Iterable<String> statistics){
  List<String> validStats=new ArrayList<String>(5);
  for (  String statistic : statistics) {
    String statisticLower=statistic.toLowerCase();
    if (!VALID_STATISTICS.contains(statisticLower))     throw Exceptions.unprocessableEntity("String_Node_Str",statistic);
    validStats.add(statisticLower);
  }
  if (validStats.isEmpty())   throw Exceptions.unprocessableEntity("String_Node_Str");
  return validStats;
}
Program: 168722
Project: 168722
Buggy source:
/** 
 * This method makes the assumption that in a json string value the "[", "]", "{", and "}" characters will never be present, e.g "{\"a\": \"{ \"}" will not work.<br/> If they are the wrong index will be returned.<br/> In practice these characters are rarely present inside json strings.
 * @param data char array
 * @param offset
 * @param end
 * @param openChar either '[' or '{'
 * @param closingChar either ']' or '}'
 * @return the next index after the closingChar
 */
public static final int indexOfEndOfObject(char[] data,int offset,int end,char openChar,char closingChar){
  int i;
  int level=0;
  char ch;
  for (i=offset; i < end; i++) {
    ch=data[i];
    if (ch == openChar)     level++;
 else     if (ch == closingChar) {
      if (level == 0)       return i + 1;
 else       level--;
    }
  }
  return i;
}

Fixed version (ground truth):
/** 
 * To use switch we need to duplicate this function into indexOfEndOfObject and indexOfEndOfList
 * @param data   char array
 * @param offset
 * @param end
 * @return the next index after the closingChar
 */
public static final int indexOfEndOfObject(char[] data,int offset,int end){
  int i;
  int level=0;
  boolean inString=false;
  for (i=offset; i < end; i++) {
switch (data[i]) {
case '{':
      level++;
    break;
case '"':
  i=endOfString(data,i + 1,end);
break;
case '}':
if (level == 0) return i + 1;
 else level--;
break;
}
}
return i;
}
Program: 168724
Project: 168724
Buggy source:
public static final void copy(char[] src,int srcPos,char[] dest,int destPos,int length){
  System.arraycopy(src,srcPos,dest,destPos,length);
}

Fixed version (ground truth):
public static final void copy(char[] src,int srcPos,char[] dest,int destPos,int length){
  if (length != 0)   System.arraycopy(src,srcPos,dest,destPos,length);
}
Program: 168726
Project: 168726
Buggy source:
/** 
 * Called when the activity is paused. The gesture detector is stopped so that gestures are no longer recognized. 
 */
@Override public void onPause(){
  super.onPause();
  if (!mOpenCVInitiated)   return;
  mGestureSensor.stop();
}

Fixed version (ground truth):
/** 
 * Called when the activity is paused. The gesture detector is stopped so that the camera is no longer working to recognize gestures. 
 */
@Override public void onPause(){
  super.onPause();
  if (!mOpenCVInitiated)   return;
  mGestureSensor.stop();
}
Program: 168728
Project: 168728
Buggy source:
public void registerDependencies(){
  if (onPredicate != null) {
    onPredicate.accept(new VisitorAdapter(){
      @Override public void visit(      PathExpression pathExpr){
        if (pathExpr.getBaseNode() != JoinNode.this && pathExpr.getBaseNode() != null) {
          dependencies.add((JoinNode)pathExpr.getBaseNode());
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void registerDependencies(){
  if (onPredicate != null) {
    onPredicate.accept(new VisitorAdapter(){
      @Override public void visit(      PathExpression pathExpr){
        JoinNode baseNode=(JoinNode)pathExpr.getBaseNode();
        if (baseNode != null && baseNode != JoinNode.this && (baseNode.getQualificationExpression() == null || baseNode.parent != JoinNode.this)) {
          dependencies.add(baseNode);
        }
      }
    }
);
  }
}
Program: 168729
Project: 168729
Buggy source:
@Override public void visit(PathExpression pathExpr){
  if (pathExpr.getBaseNode() != JoinNode.this && pathExpr.getBaseNode() != null) {
    dependencies.add((JoinNode)pathExpr.getBaseNode());
  }
}

Fixed version (ground truth):
@Override public void visit(PathExpression pathExpr){
  JoinNode baseNode=(JoinNode)pathExpr.getBaseNode();
  if (baseNode != null && baseNode != JoinNode.this && (baseNode.getQualificationExpression() == null || baseNode.parent != JoinNode.this)) {
    dependencies.add(baseNode);
  }
}
Program: 168730
Project: 168730
Buggy source:
@Column(unique=true,name="String_Node_Str") public String getIsbn(){
  return isbn;
}

Fixed version (ground truth):
@Column(unique=true,name="String_Node_Str",length=50,nullable=false) public String getIsbn(){
  return isbn;
}
Program: 168731
Project: 168731
Buggy source:
@Override public <Y>FullQueryBuilder<Y,?> copy(Class<Y> resultClass){
  prepareAndCheck();
  MainQuery mainQuery=cbf.createMainQuery(getEntityManager());
  CriteriaBuilderImpl<Y> newBuilder=new CriteriaBuilderImpl<Y>(mainQuery,true,resultClass,null);
  newBuilder.fromClassExplicitlySet=true;
  mainQuery.cteManager.applyFrom(this.mainQuery.cteManager);
  newBuilder.aliasManager.applyFrom(aliasManager);
  newBuilder.joinManager.applyFrom(joinManager);
  newBuilder.whereManager.applyFrom(whereManager);
  newBuilder.havingManager.applyFrom(havingManager);
  newBuilder.groupByManager.applyFrom(groupByManager);
  newBuilder.orderByManager.applyFrom(orderByManager);
  newBuilder.setFirstResult(firstResult);
  newBuilder.setMaxResults(maxResults);
  newBuilder.selectManager.setDefaultSelect(selectManager.getSelectInfos());
  return newBuilder;
}

Fixed version (ground truth):
@Override public <Y>FullQueryBuilder<Y,?> copy(Class<Y> resultClass){
  prepareAndCheck();
  MainQuery mainQuery=cbf.createMainQuery(getEntityManager());
  CriteriaBuilderImpl<Y> newBuilder=new CriteriaBuilderImpl<Y>(mainQuery,true,resultClass,null);
  newBuilder.fromClassExplicitlySet=true;
  newBuilder.parameterManager.applyFrom(parameterManager);
  mainQuery.cteManager.applyFrom(this.mainQuery.cteManager);
  newBuilder.aliasManager.applyFrom(aliasManager);
  newBuilder.joinManager.applyFrom(joinManager);
  newBuilder.whereManager.applyFrom(whereManager);
  newBuilder.havingManager.applyFrom(havingManager);
  newBuilder.groupByManager.applyFrom(groupByManager);
  newBuilder.orderByManager.applyFrom(orderByManager);
  newBuilder.setFirstResult(firstResult);
  newBuilder.setMaxResults(maxResults);
  newBuilder.selectManager.setDefaultSelect(selectManager.getSelectInfos());
  return newBuilder;
}
Program: 168732
Project: 168732
Buggy source:
@Override public Expression createScalarExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,ExpressionCache.SCALAR_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public Expression createScalarExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,SCALAR_EXPRESSION_SUPPLIER);
}
Program: 168733
Project: 168733
Buggy source:
@Override public Expression createSimpleExpression(final String expression,final boolean allowQuantifiedPredicates,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,expression,allowQuantifiedPredicates,macroConfiguration,ExpressionCache.SIMPLE_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public Expression createSimpleExpression(final String expression,final boolean allowQuantifiedPredicates,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,expression,allowQuantifiedPredicates,macroConfiguration,SIMPLE_EXPRESSION_SUPPLIER);
}
Program: 168734
Project: 168734
Buggy source:
@Override public PathExpression createPathExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,ExpressionCache.PATH_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public PathExpression createPathExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,PATH_EXPRESSION_SUPPLIER);
}
Program: 168735
Project: 168735
Buggy source:
@Override public Expression createArithmeticExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,ExpressionCache.ARITHMETIC_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public Expression createArithmeticExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,ARITHMETIC_EXPRESSION_SUPPLIER);
}
Program: 168736
Project: 168736
Buggy source:
@Override public Expression createOrderByExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,ExpressionCache.ORDER_BY_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public Expression createOrderByExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,ORDER_BY_EXPRESSION_SUPPLIER);
}
Program: 168737
Project: 168737
Buggy source:
@Override public List<Expression> createInItemExpressions(final String[] parameterOrLiteralExpressions,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  if (parameterOrLiteralExpressions == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (parameterOrLiteralExpressions.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<Expression> inItemExpressions=new ArrayList<Expression>();
  if (parameterOrLiteralExpressions.length == 1) {
    inItemExpressions.add(createInItemOrPathExpression(parameterOrLiteralExpressions[0],macroConfiguration,usedMacros));
  }
 else {
    for (    final String parameterOrLiteralExpression : parameterOrLiteralExpressions) {
      inItemExpressions.add(createInItemExpression(parameterOrLiteralExpression,macroConfiguration,usedMacros));
    }
  }
  return inItemExpressions;
}

Fixed version (ground truth):
@Override public List<Expression> createInItemExpressions(final String[] parameterOrLiteralExpressions,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  if (parameterOrLiteralExpressions == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (parameterOrLiteralExpressions.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<Expression> inItemExpressions=new ArrayList<>();
  if (parameterOrLiteralExpressions.length == 1) {
    inItemExpressions.add(createInItemOrPathExpression(parameterOrLiteralExpressions[0],macroConfiguration,usedMacros));
  }
 else {
    for (    final String parameterOrLiteralExpression : parameterOrLiteralExpressions) {
      inItemExpressions.add(createInItemExpression(parameterOrLiteralExpression,macroConfiguration,usedMacros));
    }
  }
  return inItemExpressions;
}
Program: 168738
Project: 168738
Buggy source:
@Override public Expression createJoinPathExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,ExpressionCache.JOIN_PATH_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public Expression createJoinPathExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,JOIN_PATH_EXPRESSION_SUPPLIER);
}
Program: 168739
Project: 168739
Buggy source:
@Override public Expression createInItemOrPathExpression(final String parameterOrLiteralExpression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,parameterOrLiteralExpression,false,macroConfiguration,ExpressionCache.IN_ITEM_OR_PATH_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public Expression createInItemOrPathExpression(final String parameterOrLiteralExpression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,parameterOrLiteralExpression,false,macroConfiguration,IN_ITEM_OR_PATH_EXPRESSION_SUPPLIER);
}
Program: 168740
Project: 168740
Buggy source:
@Override public Expression createInItemExpression(final String parameterOrLiteralExpression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,parameterOrLiteralExpression,false,macroConfiguration,ExpressionCache.IN_ITEM_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public Expression createInItemExpression(final String parameterOrLiteralExpression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,parameterOrLiteralExpression,false,macroConfiguration,IN_ITEM_EXPRESSION_SUPPLIER);
}
Program: 168741
Project: 168741
Buggy source:
@Override public Expression createCaseOperandExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,ExpressionCache.CASE_OPERAND_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public Expression createCaseOperandExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,CASE_OPERAND_EXPRESSION_SUPPLIER);
}
Program: 168742
Project: 168742
Buggy source:
@Override public Expression createStringExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,ExpressionCache.STRING_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public Expression createStringExpression(final String expression,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,expression,false,macroConfiguration,STRING_EXPRESSION_SUPPLIER);
}
Program: 168743
Project: 168743
Buggy source:
@Override public Predicate createBooleanExpression(final String expression,final boolean allowQuantifiedPredicates,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return expressionCache.getOrDefault("String_Node_Str",delegate,expression,allowQuantifiedPredicates,macroConfiguration,ExpressionCache.BOOLEAN_EXPRESSION_SUPPLIER);
}

Fixed version (ground truth):
@Override public Predicate createBooleanExpression(final String expression,final boolean allowQuantifiedPredicates,final MacroConfiguration macroConfiguration,Set<String> usedMacros){
  return getOrDefault("String_Node_Str",delegate,expression,allowQuantifiedPredicates,macroConfiguration,BOOLEAN_EXPRESSION_SUPPLIER);
}
Program: 168744
Project: 168744
Buggy source:
public Expression get(ExpressionFactory expressionFactory,String expression,boolean allowQuantifiedPredicates,MacroConfiguration macroConfiguration,Set<String> usedMacros);

Fixed version (ground truth):
public T get(String cacheName,String expression);
Program: 168747
Project: 168747
Buggy source:
@Override public Collection<Object> getAddedObjects(C collection){
  return (Collection<Object>)elements;
}

Fixed version (ground truth):
@Override public Collection<Object> getAddedObjects(C collection){
  List<Object> objects=new ArrayList<>(elements.size());
  for (  Object element : elements) {
    if (!collection.contains(element)) {
      objects.add(element);
    }
  }
  return objects;
}
Program: 168748
Project: 168748
Buggy source:
@Override public Collection<Object> getAddedObjects(C collection){
  return Collections.<Object>singleton(element);
}

Fixed version (ground truth):
@Override public Collection<Object> getAddedObjects(C collection){
  if (collection.contains(element)) {
    return Collections.emptyList();
  }
  return Collections.<Object>singleton(element);
}
Program: 168749
Project: 168749
Buggy source:
@Override public Collection<Object> getAddedObjects(C collection){
  return (Collection<Object>)elements;
}

Fixed version (ground truth):
@Override public Collection<Object> getAddedObjects(C collection){
  List<Object> objects=new ArrayList<>(elements.size());
  for (  Object element : elements) {
    if (!collection.contains(element)) {
      objects.add(element);
    }
  }
  return objects;
}
Program: 168750
Project: 168750
Buggy source:
@Override protected void populateResult(Map<Object,TuplePromise> correlationValues,Object defaultKey,List<Object> list){
  if (batchSize == 1) {
    correlationValues.get(defaultKey).onResult(createCollection(list),this);
    return;
  }
  Map<Object,Collection<Object>> collections=new HashMap<Object,Collection<Object>>(list.size());
  for (int i=0; i < list.size(); i++) {
    Object[] element=(Object[])list.get(i);
    Collection<Object> result=collections.get(element[0]);
    if (result == null) {
      result=(Collection<Object>)createDefaultResult();
      collections.put(element[0],result);
    }
    if (element[1] != null) {
      result.add(element[1]);
    }
  }
  for (  Map.Entry<Object,Collection<Object>> entry : collections.entrySet()) {
    correlationValues.get(entry.getKey()).onResult(entry.getValue(),this);
  }
}

Fixed version (ground truth):
@Override protected void populateResult(Map<Object,TuplePromise> correlationValues,Object defaultKey,List<Object> list){
  if (batchSize == 1) {
    correlationValues.get(defaultKey).onResult(createCollection(list),this);
    return;
  }
  Map<Object,Collection<Object>> collections=new HashMap<Object,Collection<Object>>(list.size());
  for (int i=0; i < list.size(); i++) {
    Object[] element=(Object[])list.get(i);
    Collection<Object> result=collections.get(element[0]);
    if (result == null) {
      result=(Collection<Object>)createDefaultResult();
      collections.put(element[0],result);
    }
    if (element[1] != null) {
      add(result,element[1]);
    }
  }
  for (  Map.Entry<Object,Collection<Object>> entry : collections.entrySet()) {
    correlationValues.get(entry.getKey()).onResult(entry.getValue(),this);
  }
}
Program: 168754
Project: 168754
Buggy source:
@Override public void flushQuery(UpdateContext context,String parameterPrefix,Query query,Object view,V value){
  if (!supportsQueryFlush()) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  if (elementFlushers != null) {
    for (    CollectionElementAttributeFlusher<E,V> elementFlusher : elementFlushers) {
      elementFlusher.flushQuery(context,null,null,view,value);
    }
  }
 else {
    RecordingCollection<Collection<?>,?> recordingCollection=(RecordingCollection<Collection<?>,?>)value;
    Map<Object,Object> added;
    Map<Object,Object> removed;
    if (recordingCollection.hasActions()) {
      Map<Object,Object>[] addedAndRemoved=getAddedAndRemovedElements(recordingCollection,(List<CollectionAction<Collection<?>>>)(List<?>)recordingCollection.resetActions(context));
      added=addedAndRemoved[0];
      removed=addedAndRemoved[1];
    }
 else {
      added=removed=new HashMap<>();
    }
    visitInverseElementFlushersForActions(context,recordingCollection,added,removed,new ElementFlusherQueryExecutor(context,null,view));
  }
}

Fixed version (ground truth):
@Override public void flushQuery(UpdateContext context,String parameterPrefix,Query query,Object view,V value){
  if (!supportsQueryFlush()) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  if (elementFlushers != null) {
    for (    CollectionElementAttributeFlusher<E,V> elementFlusher : elementFlushers) {
      elementFlusher.flushQuery(context,null,null,view,value);
    }
  }
 else {
    RecordingCollection<Collection<?>,?> recordingCollection=(RecordingCollection<Collection<?>,?>)value;
    Map<Object,Object> added;
    Map<Object,Object> removed;
    if (recordingCollection.hasActions()) {
      Map<Object,Object>[] addedAndRemoved=getAddedAndRemovedElements(recordingCollection,context);
      added=addedAndRemoved[0];
      removed=addedAndRemoved[1];
    }
 else {
      added=removed=new HashMap<>();
    }
    visitInverseElementFlushersForActions(context,recordingCollection,added,removed,new ElementFlusherQueryExecutor(context,null,view));
  }
}
Program: 168755
Project: 168755
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public FetchGraphNode<?> mergeWith(List<CollectionAttributeFlusher<E,V>> fetchGraphNodes){
  boolean fetchChanged=false;
  List<FetchGraphNode> nestedFlushers=new ArrayList<>(fetchGraphNodes.size());
  for (int i=0; i < fetchGraphNodes.size(); i++) {
    CollectionAttributeFlusher<E,V> node=fetchGraphNodes.get(i);
    fetchChanged|=this.fetch != node.fetch;
    if (node.nestedGraphNode != null) {
      if (node.nestedGraphNode instanceof CollectionElementFetchGraphNode) {
        nestedFlushers.add(((CollectionElementFetchGraphNode)node.nestedGraphNode).nestedGraphNode);
      }
 else {
        nestedFlushers.add(node.nestedGraphNode);
      }
    }
  }
  final boolean newFetch=fetchChanged || this.fetch;
  if (nestedFlushers.isEmpty()) {
    if (fetchChanged && this.fetch != newFetch) {
      return new AttributeFetchGraphNode(attributeName,mapping,newFetch,fetchGraphNodes.get(0));
    }
 else {
      return this;
    }
  }
  FetchGraphNode firstFlusher=nestedFlushers.get(0);
  FetchGraphNode<?> fetchGraphNode=firstFlusher.mergeWith((List)nestedFlushers);
  if (!fetchChanged && fetchGraphNode == firstFlusher) {
    return this;
  }
  return new AttributeFetchGraphNode(attributeName,mapping,newFetch,fetchGraphNode);
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public FetchGraphNode<?> mergeWith(List<CollectionAttributeFlusher<E,V>> fetchGraphNodes){
  boolean fetchChanged=false;
  List<FetchGraphNode> nestedFlushers=new ArrayList<>(fetchGraphNodes.size());
  for (int i=0; i < fetchGraphNodes.size(); i++) {
    CollectionAttributeFlusher<E,V> node=fetchGraphNodes.get(i);
    fetchChanged|=this.fetch != node.fetch;
    if (node.nestedGraphNode != null) {
      if (node.nestedGraphNode instanceof CollectionElementFetchGraphNode) {
        CollectionElementFetchGraphNode collectionElementFetchGraphNode=(CollectionElementFetchGraphNode)node.nestedGraphNode;
        if (collectionElementFetchGraphNode.nestedGraphNode != null) {
          nestedFlushers.add(collectionElementFetchGraphNode.nestedGraphNode);
        }
      }
 else {
        nestedFlushers.add(node.nestedGraphNode);
      }
    }
  }
  final boolean newFetch=fetchChanged || this.fetch;
  if (nestedFlushers.isEmpty()) {
    if (fetchChanged && this.fetch != newFetch) {
      return new AttributeFetchGraphNode(attributeName,mapping,newFetch,fetchGraphNodes.get(0));
    }
 else {
      return this;
    }
  }
  FetchGraphNode firstFlusher=nestedFlushers.get(0);
  FetchGraphNode<?> fetchGraphNode=firstFlusher.mergeWith((List)nestedFlushers);
  if (!fetchChanged && fetchGraphNode == firstFlusher) {
    return this;
  }
  return new AttributeFetchGraphNode(attributeName,mapping,newFetch,fetchGraphNode);
}
Program: 168757
Project: 168757
Buggy source:
private void deferredFlushEntity(UpdateContext context,Object entity,MutableStateTrackable updatableProxy,List<Integer> deferredFlushers){
  Object[] state=updatableProxy.$$_getMutableState();
  if (updatableProxy instanceof DirtyStateTrackable) {
    Object[] initialState=((DirtyStateTrackable)updatableProxy).$$_getInitialState();
    for (int i=0; i < deferredFlushers.size(); i++) {
      final int index=deferredFlushers.get(i);
      final DirtyAttributeFlusher<?,Object,Object> flusher=flushers[index];
      Object newInitialValue=flusher.cloneDeep(updatableProxy,initialState[index],state[index]);
      flusher.flushEntity(context,entity,updatableProxy,state[index],null);
      initialState[i]=flusher.getNewInitialValue(context,newInitialValue,state[index]);
    }
  }
 else {
    for (int i=0; i < deferredFlushers.size(); i++) {
      final int index=deferredFlushers.get(i);
      final DirtyAttributeFlusher<?,Object,Object> flusher=flushers[index];
      flusher.flushEntity(context,entity,updatableProxy,state[index],null);
    }
  }
}

Fixed version (ground truth):
private void deferredFlushEntity(UpdateContext context,Object entity,MutableStateTrackable updatableProxy,List<Integer> deferredFlushers){
  Object[] state=updatableProxy.$$_getMutableState();
  if (updatableProxy instanceof DirtyStateTrackable) {
    Object[] initialState=((DirtyStateTrackable)updatableProxy).$$_getInitialState();
    for (int i=0; i < deferredFlushers.size(); i++) {
      final int index=deferredFlushers.get(i);
      final DirtyAttributeFlusher<?,Object,Object> flusher=flushers[index];
      Object newInitialValue=flusher.cloneDeep(updatableProxy,initialState[index],state[index]);
      flusher.flushEntity(context,entity,updatableProxy,state[index],null);
      initialState[index]=flusher.getNewInitialValue(context,newInitialValue,state[index]);
    }
  }
 else {
    for (int i=0; i < deferredFlushers.size(); i++) {
      final int index=deferredFlushers.get(i);
      final DirtyAttributeFlusher<?,Object,Object> flusher=flushers[index];
      flusher.flushEntity(context,entity,updatableProxy,state[index],null);
    }
  }
}
Program: 168759
Project: 168759
Buggy source:
private String getIdAttribute(){
  return getIdAttribute(getDomainClass());
}

Fixed version (ground truth):
private String getIdAttribute(Class<?> entityClass){
  return cbf.getService(EntityMetamodel.class).getManagedType(ExtendedManagedType.class,entityClass).getIdAttribute().getName();
}
Program: 168760
Project: 168760
Buggy source:
public EntityViewAwareRepositoryImpl(JpaEntityInformation<E,?> entityInformation,EntityManager entityManager,CriteriaBuilderFactory cbf,EntityViewManager evm,Class<V> entityViewClass){
  this.entityInformation=entityInformation;
  this.entityManager=entityManager;
  this.cbf=cbf;
  this.evm=evm;
  this.entityViewClass=entityViewClass;
}

Fixed version (ground truth):
public EntityViewAwareRepositoryImpl(JpaEntityInformation<E,?> entityInformation,EntityManager entityManager,CriteriaBuilderFactory cbf,EntityViewManager evm,Class<V> entityViewClass){
  this.entityInformation=entityInformation;
  this.entityManager=entityManager;
  this.cbf=cbf;
  this.evm=evm;
  this.entityViewClass=entityViewClass;
  this.idAttributeName=getIdAttribute(getDomainClass());
}
Program: 168761
Project: 168761
Buggy source:
@Override public boolean exists(ID id){
  Assert.notNull(id,ID_MUST_NOT_BE_NULL);
  TypedQuery<Long> existsQuery=cbf.create(entityManager,Long.class).from(getDomainClass()).select("String_Node_Str").where(getIdAttribute()).eq(id).getQuery();
  applyRepositoryMethodMetadata(existsQuery,true);
  return existsQuery.getSingleResult() > 0;
}

Fixed version (ground truth):
@Override public boolean exists(ID id){
  Assert.notNull(id,ID_MUST_NOT_BE_NULL);
  TypedQuery<Object> existsQuery=cbf.create(entityManager,Object.class).from(getDomainClass()).select("String_Node_Str").where(idAttributeName).eq(id).setMaxResults(1).getQuery();
  applyRepositoryMethodMetadata(existsQuery,true);
  try {
    return !existsQuery.getResultList().isEmpty();
  }
 catch (  NoResultException e) {
    return false;
  }
}
Program: 168762
Project: 168762
Buggy source:
@Before public void setUpContext() throws Exception {
  testContextManager=new TestContextManager(getClass());
  testContextManager.prepareTestInstance(this);
  testContextManager.registerTestExecutionListeners(new DirtiesContextTestExecutionListener());
  cleanDatabase();
}

Fixed version (ground truth):
@Before public void setUpContext() throws Exception {
  cleanDatabase();
  this.em.getTransaction().rollback();
  this.em.close();
  this.emf.close();
  this.emf=null;
  this.em=null;
  this.cbf=null;
  this.jpaProvider=null;
  this.dbmsDialect=null;
  CustomLocalContainerEntityManagerFactoryBean.properties=createProperties("String_Node_Str");
  testContextManager=new TestContextManager(getClass());
  testContextManager.prepareTestInstance(this);
  testContextManager.registerTestExecutionListeners(new DirtiesContextTestExecutionListener());
}
Program: 168763
Project: 168763
Buggy source:
@Test @Category({NoMSSQL.class}) public void testFindAllBySpecPageable(){
  final Document d4=createDocument("String_Node_Str",null,2L,null);
  final Document d3=createDocument("String_Node_Str",null,3L,null);
  final Document d2=createDocument("String_Node_Str",null,2L,null);
  final Document d1=createDocument("String_Node_Str",null,1L,null);
  Page<DocumentAccessor> actual=DocumentAccessors.of(((DocumentRepository)documentRepository).findAll(new Specification<Document>(){
    @Override public Predicate toPredicate(    Root<Document> root,    CriteriaQuery<?> criteriaQuery,    CriteriaBuilder criteriaBuilder){
      return criteriaBuilder.gt(root.<Long>get("String_Node_Str"),1L);
    }
  }
,new PageRequest(1,2,Sort.Direction.ASC,"String_Node_Str","String_Node_Str")));
  List<Long> actualIds=getIdsFromViews(actual);
  assertEquals(1,actual.getNumberOfElements());
  assertTrue(actualIds.contains(d4.getId()));
}

Fixed version (ground truth):
@Test public void testFindAllBySpecPageable(){
  final Document d4=createDocument("String_Node_Str",null,2L,null);
  final Document d3=createDocument("String_Node_Str",null,3L,null);
  final Document d2=createDocument("String_Node_Str",null,2L,null);
  final Document d1=createDocument("String_Node_Str",null,1L,null);
  Page<DocumentAccessor> actual=DocumentAccessors.of(((DocumentRepository)documentRepository).findAll(new Specification<Document>(){
    @Override public Predicate toPredicate(    Root<Document> root,    CriteriaQuery<?> criteriaQuery,    CriteriaBuilder criteriaBuilder){
      return criteriaBuilder.gt(root.<Long>get("String_Node_Str"),1L);
    }
  }
,new PageRequest(1,2,Sort.Direction.ASC,"String_Node_Str","String_Node_Str")));
  List<Long> actualIds=getIdsFromViews(actual);
  assertEquals(1,actual.getNumberOfElements());
  assertTrue(actualIds.contains(d4.getId()));
}
Program: 168764
Project: 168764
Buggy source:
@Test @Category({NoMSSQL.class}) public void testFindSliceByAgeGreaterThanEqual(){
  final Document d1=createDocument("String_Node_Str",null,3L,null);
  final Document d2=createDocument("String_Node_Str",null,4L,null);
  final Document d3=createDocument("String_Node_Str",null,5L,null);
  Slice<DocumentAccessor> actual=DocumentAccessors.of(documentRepository.findSliceByAgeGreaterThanEqual(4L,new PageRequest(1,1,Sort.Direction.ASC,"String_Node_Str","String_Node_Str")));
  List<Long> actualIds=getIdsFromViews(actual);
  assertEquals(1,actual.getSize());
  assertFalse(actual.hasNext());
  assertTrue(actual.hasPrevious());
  assertTrue(actualIds.contains(d3.getId()));
}

Fixed version (ground truth):
@Test public void testFindSliceByAgeGreaterThanEqual(){
  final Document d1=createDocument("String_Node_Str",null,3L,null);
  final Document d2=createDocument("String_Node_Str",null,4L,null);
  final Document d3=createDocument("String_Node_Str",null,5L,null);
  Slice<DocumentAccessor> actual=DocumentAccessors.of(documentRepository.findSliceByAgeGreaterThanEqual(4L,new PageRequest(1,1,Sort.Direction.ASC,"String_Node_Str","String_Node_Str")));
  List<Long> actualIds=getIdsFromViews(actual);
  assertEquals(1,actual.getSize());
  assertFalse(actual.hasNext());
  assertTrue(actual.hasPrevious());
  assertTrue(actualIds.contains(d3.getId()));
}
Program: 168765
Project: 168765
Buggy source:
@Test @Category({NoMSSQL.class}) public void testFindByNameInPaginated(){
  Assume.assumeFalse(isEntityRepository() && isEclipseLink());
  final Document d1=createDocument("String_Node_Str");
  final Document d2=createDocument("String_Node_Str");
  final Document d3=createDocument("String_Node_Str");
  Page<DocumentAccessor> actual=DocumentAccessors.of(documentRepository.findByNameInOrderById(new PageRequest(0,1),d2.getName(),d3.getName()));
  List<Long> actualIds=getIdsFromViews(actual);
  assertEquals(2,actual.getTotalPages());
  assertEquals(0,actual.getNumber());
  assertEquals(1,actual.getNumberOfElements());
  assertEquals(1,actual.getSize());
  assertTrue(actualIds.contains(d2.getId()));
  actual=DocumentAccessors.of(documentRepository.findByNameInOrderById(actual.nextPageable(),d2.getName(),d3.getName()));
  actualIds=getIdsFromViews(actual);
  assertEquals(2,actual.getTotalPages());
  assertEquals(1,actual.getNumber());
  assertEquals(1,actual.getNumberOfElements());
  assertEquals(1,actual.getSize());
  assertTrue(actualIds.contains(d3.getId()));
}

Fixed version (ground truth):
@Test public void testFindByNameInPaginated(){
  Assume.assumeFalse(isEntityRepository() && isEclipseLink());
  final Document d1=createDocument("String_Node_Str");
  final Document d2=createDocument("String_Node_Str");
  final Document d3=createDocument("String_Node_Str");
  Page<DocumentAccessor> actual=DocumentAccessors.of(documentRepository.findByNameInOrderById(new PageRequest(0,1),d2.getName(),d3.getName()));
  List<Long> actualIds=getIdsFromViews(actual);
  assertEquals(2,actual.getTotalPages());
  assertEquals(0,actual.getNumber());
  assertEquals(1,actual.getNumberOfElements());
  assertEquals(1,actual.getSize());
  assertTrue(actualIds.contains(d2.getId()));
  actual=DocumentAccessors.of(documentRepository.findByNameInOrderById(actual.nextPageable(),d2.getName(),d3.getName()));
  actualIds=getIdsFromViews(actual);
  assertEquals(2,actual.getTotalPages());
  assertEquals(1,actual.getNumber());
  assertEquals(1,actual.getNumberOfElements());
  assertEquals(1,actual.getSize());
  assertTrue(actualIds.contains(d3.getId()));
}
Program: 168766
Project: 168766
Buggy source:
@Test @Category({NoMSSQL.class}) public void testFindFirstByOrderByNameAsc(){
  final Document d3=createDocument("String_Node_Str");
  final Document d2=createDocument("String_Node_Str");
  final Document d1=createDocument("String_Node_Str");
  DocumentAccessor actual=DocumentAccessors.of(documentRepository.findFirstByOrderByNameAsc());
  assertEquals(d1.getId(),actual.getId());
}

Fixed version (ground truth):
@Test public void testFindFirstByOrderByNameAsc(){
  final Document d3=createDocument("String_Node_Str");
  final Document d2=createDocument("String_Node_Str");
  final Document d1=createDocument("String_Node_Str");
  DocumentAccessor actual=DocumentAccessors.of(documentRepository.findFirstByOrderByNameAsc());
  assertEquals(d1.getId(),actual.getId());
}
Program: 168767
Project: 168767
Buggy source:
@Test @Category({NoMSSQL.class}) public void testFindByNameInKeysetPaginated(){
  Assume.assumeFalse(isEntityRepository() && isEclipseLink());
  final Document d1=createDocument("String_Node_Str");
  final Document d2=createDocument("String_Node_Str");
  final Document d3=createDocument("String_Node_Str");
  KeysetAwarePage<DocumentAccessor> actual=DocumentAccessors.of(documentRepository.findByNameIn(new KeysetPageRequest(null,new Sort("String_Node_Str"),0,1),d2.getName(),d3.getName()));
  List<Long> actualIds=getIdsFromViews(actual);
  assertEquals(2,actual.getTotalPages());
  assertEquals(0,actual.getNumber());
  assertEquals(1,actual.getNumberOfElements());
  assertEquals(1,actual.getSize());
  assertTrue(actualIds.contains(d2.getId()));
  actual=DocumentAccessors.of(documentRepository.findByNameIn(actual.nextPageable(),d2.getName(),d3.getName()));
  actualIds=getIdsFromViews(actual);
  assertEquals(2,actual.getTotalPages());
  assertEquals(1,actual.getNumber());
  assertEquals(1,actual.getNumberOfElements());
  assertEquals(1,actual.getSize());
  assertTrue(actualIds.contains(d3.getId()));
}

Fixed version (ground truth):
@Test public void testFindByNameInKeysetPaginated(){
  Assume.assumeFalse(isEntityRepository() && isEclipseLink());
  final Document d1=createDocument("String_Node_Str");
  final Document d2=createDocument("String_Node_Str");
  final Document d3=createDocument("String_Node_Str");
  KeysetAwarePage<DocumentAccessor> actual=DocumentAccessors.of(documentRepository.findByNameIn(new KeysetPageRequest(null,new Sort("String_Node_Str"),0,1),d2.getName(),d3.getName()));
  List<Long> actualIds=getIdsFromViews(actual);
  assertEquals(2,actual.getTotalPages());
  assertEquals(0,actual.getNumber());
  assertEquals(1,actual.getNumberOfElements());
  assertEquals(1,actual.getSize());
  assertTrue(actualIds.contains(d2.getId()));
  actual=DocumentAccessors.of(documentRepository.findByNameIn(actual.nextPageable(),d2.getName(),d3.getName()));
  actualIds=getIdsFromViews(actual);
  assertEquals(2,actual.getTotalPages());
  assertEquals(1,actual.getNumber());
  assertEquals(1,actual.getNumberOfElements());
  assertEquals(1,actual.getSize());
  assertTrue(actualIds.contains(d3.getId()));
}
Program: 168769
Project: 168769
Buggy source:
/** 
 * Registers the given converter for the given types.
 * @param entityModelType The entity model type
 * @param viewModelType The entity view model type
 * @param converter The type converter
 * @param < X > The entity model type
 * @param < Y > The entity view model type
 * @return this for method chaining
 * @since 1.2.0
 */
public <X,Y>EntityViewConfiguration registerTypeConverter(Class<X> entityModelType,Class<Y> viewModelType,TypeConverter<X,Y> converter);

Fixed version (ground truth):
/** 
 * Registers the given converter for the given types.
 * @param underlyingType The underlying type supported by the entity view type system
 * @param viewModelType The entity view model type
 * @param converter The type converter
 * @param < X > The underlying type
 * @param < Y > The entity view model type
 * @return this for method chaining
 * @since 1.2.0
 */
public <X,Y>EntityViewConfiguration registerTypeConverter(Class<X> underlyingType,Class<Y> viewModelType,TypeConverter<X,Y> converter);
Program: 168770
Project: 168770
Buggy source:
@Override public <X,Y>EntityViewConfiguration registerTypeConverter(Class<X> entityModelType,Class<Y> viewModelType,TypeConverter<X,Y> converter){
  userTypeRegistry.registerTypeConverter(entityModelType,viewModelType,converter);
  return this;
}

Fixed version (ground truth):
@Override public <X,Y>EntityViewConfiguration registerTypeConverter(Class<X> underlyingType,Class<Y> viewModelType,TypeConverter<X,Y> converter){
  userTypeRegistry.registerTypeConverter(underlyingType,viewModelType,converter);
  return this;
}
Program: 168771
Project: 168771
Buggy source:
public TargetTypeImpl(boolean hasCollectionJoin,Method leafMethod,Class<?> leafBaseClass,Class<?> leafBaseValueClass){
  this.hasCollectionJoin=hasCollectionJoin;
  this.leafMethod=leafMethod;
  this.leafBaseClass=leafBaseClass;
  this.leafBaseValueClass=leafBaseValueClass;
}

Fixed version (ground truth):
public TargetTypeImpl(boolean hasCollectionJoin,Method leafMethod,Class<?> leafBaseClass,Class<?> leafBaseKeyClass,Class<?> leafBaseValueClass){
  this.hasCollectionJoin=hasCollectionJoin;
  this.leafMethod=leafMethod;
  this.leafBaseClass=leafBaseClass;
  this.leafBaseKeyClass=leafBaseKeyClass;
  this.leafBaseValueClass=leafBaseValueClass;
}
Program: 168772
Project: 168772
Buggy source:
public List<TargetType> getPossibleTargets(){
  List<PathPosition> positions=pathPositions;
  int size=positions.size();
  if (size == 1 && positions.get(0).getMethod() == null && managedType.getJavaType().equals(positions.get(0).getRealCurrentClass())) {
    return Collections.emptyList();
  }
  List<TargetType> possibleTargets=new ArrayList<TargetType>(size);
  for (int i=0; i < size; i++) {
    PathPosition position=positions.get(i);
    possibleTargets.add(new TargetTypeImpl(position.hasCollectionJoin(),position.getMethod(),getBoxed(position.getRealCurrentClass()),getBoxed(position.getCurrentClass())));
  }
  return possibleTargets;
}

Fixed version (ground truth):
public List<TargetType> getPossibleTargets(){
  List<PathPosition> positions=pathPositions;
  int size=positions.size();
  if (size == 1 && positions.get(0).getMethod() == null && managedType.getJavaType().equals(positions.get(0).getRealCurrentClass())) {
    return Collections.emptyList();
  }
  List<TargetType> possibleTargets=new ArrayList<TargetType>(size);
  for (int i=0; i < size; i++) {
    PathPosition position=positions.get(i);
    possibleTargets.add(new TargetTypeImpl(position.hasCollectionJoin(),position.getMethod(),position.getRealCurrentClass(),position.getCurrentClass(),position.getCurrentClass()));
  }
  return possibleTargets;
}
Program: 168773
Project: 168773
Buggy source:
PathPosition copy(){
  return new PathPosition(currentClass,valueClass,method,hasCollectionJoin);
}

Fixed version (ground truth):
PathPosition copy(){
  return new PathPosition(currentClass,keyClass,valueClass,method,hasCollectionJoin);
}
Program: 168774
Project: 168774
Buggy source:
private PathPosition(Class<?> currentClass,Class<?> valueClass,Method method,boolean hasCollectionJoin){
  this.currentClass=currentClass;
  this.valueClass=valueClass;
  this.method=method;
  this.hasCollectionJoin=hasCollectionJoin;
}

Fixed version (ground truth):
private PathPosition(Class<?> currentClass,Class<?> keyClass,Class<?> valueClass,Method method,boolean hasCollectionJoin){
  this.currentClass=currentClass;
  this.keyClass=keyClass;
  this.valueClass=valueClass;
  this.method=method;
  this.hasCollectionJoin=hasCollectionJoin;
}
Program: 168775
Project: 168775
Buggy source:
void setCurrentClass(Class<?> currentClass){
  this.currentClass=currentClass;
  this.valueClass=null;
  this.hasCollectionJoin=false;
}

Fixed version (ground truth):
void setCurrentClass(Class<?> currentClass){
  this.currentClass=currentClass;
  this.keyClass=null;
  this.valueClass=null;
  this.hasCollectionJoin=false;
}
Program: 168779
Project: 168779
Buggy source:
private void update(UpdateContext context,Object entity,MutableStateTrackable updatableProxy){
  if (!rootUpdateAllowed && entity == null) {
    throw new IllegalArgumentException("String_Node_Str" + updatableProxy.getClass().getName() + "String_Node_Str");
  }
  @SuppressWarnings("String_Node_Str") DirtyAttributeFlusher<?,Object,Object> flusher=getNestedDirtyFlusher(context,updatableProxy,null);
  if (flusher == null) {
    return;
  }
  try {
    if (flushStrategy == FlushStrategy.ENTITY || !flusher.supportsQueryFlush()) {
      flusher.flushEntity(context,entity,updatableProxy,updatableProxy);
    }
 else {
      Query query=createUpdateQuery(context,updatableProxy,flusher);
      flusher.flushQuery(context,null,query,updatableProxy,updatableProxy);
      if (query != null) {
        int updated=query.executeUpdate();
        if (updated != 1) {
          throw new OptimisticLockException(entity,updatableProxy);
        }
      }
    }
  }
  finally {
    context.getInitialStateResetter().addUpdatedView(updatableProxy);
  }
}

Fixed version (ground truth):
private void update(UpdateContext context,Object entity,MutableStateTrackable updatableProxy){
  if (!rootUpdateAllowed && entity == null) {
    throw new IllegalArgumentException("String_Node_Str" + updatableProxy.getClass().getName() + "String_Node_Str");
  }
  @SuppressWarnings("String_Node_Str") DirtyAttributeFlusher<?,Object,Object> flusher=(DirtyAttributeFlusher<?,Object,Object>)(DirtyAttributeFlusher)getNestedDirtyFlusher(context,updatableProxy,(DirtyAttributeFlusher)null);
  if (flusher == null) {
    return;
  }
  try {
    if (flushStrategy == FlushStrategy.ENTITY || !flusher.supportsQueryFlush()) {
      flusher.flushEntity(context,entity,updatableProxy,updatableProxy);
    }
 else {
      Query query=createUpdateQuery(context,updatableProxy,flusher);
      flusher.flushQuery(context,null,query,updatableProxy,updatableProxy);
      if (query != null) {
        int updated=query.executeUpdate();
        if (updated != 1) {
          throw new OptimisticLockException(entity,updatableProxy);
        }
      }
    }
  }
  finally {
    context.getInitialStateResetter().addUpdatedView(updatableProxy);
  }
}