nus-yam/ex-repair huggingface dataset:
Program: 163065
Project: 163065
Buggy source:
@SuppressWarnings("String_Node_Str") private static <T>BytesMarshaller<T> chooseDefaultMarshaller(@NotNull Class<T> tClass){
  if (Byteable.class.isAssignableFrom(tClass))   return new ByteableMarshaller(tClass);
  if (BytesMarshallable.class.isAssignableFrom(tClass))   return new BytesMarshallableMarshaller(tClass);
  if (Externalizable.class.isAssignableFrom(tClass))   return new ExternalizableMarshaller(tClass);
  if (tClass == CharSequence.class)   return (BytesMarshaller<T>)CharSequenceMarshaller.INSTANCE;
  if (tClass == String.class)   return (BytesMarshaller<T>)StringMarshaller.INSTANCE;
  if (tClass == Integer.class)   return (BytesMarshaller<T>)IntegerMarshaller.INSTANCE;
  if (tClass == Long.class)   return (BytesMarshaller<T>)LongMarshaller.INSTANCE;
  if (tClass == Double.class)   return (BytesMarshaller<T>)DoubleMarshaller.INSTANCE;
  return SerializableMarshaller.INSTANCE;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static <T>BytesMarshaller<T> chooseDefaultMarshaller(@NotNull Class<T> tClass){
  Class<T> classForMarshaller=marshallerUseFactory(tClass) && tClass.isInterface() ? DataValueClasses.directClassFor(tClass) : tClass;
  if (Byteable.class.isAssignableFrom(tClass))   return new ByteableMarshaller(classForMarshaller);
  if (BytesMarshallable.class.isAssignableFrom(tClass))   return new BytesMarshallableMarshaller(classForMarshaller);
  if (Externalizable.class.isAssignableFrom(tClass))   return new ExternalizableMarshaller(classForMarshaller);
  if (tClass == CharSequence.class)   return (BytesMarshaller<T>)CharSequenceMarshaller.INSTANCE;
  if (tClass == String.class)   return (BytesMarshaller<T>)StringMarshaller.INSTANCE;
  if (tClass == Integer.class)   return (BytesMarshaller<T>)IntegerMarshaller.INSTANCE;
  if (tClass == Long.class)   return (BytesMarshaller<T>)LongMarshaller.INSTANCE;
  if (tClass == Double.class)   return (BytesMarshaller<T>)DoubleMarshaller.INSTANCE;
  return SerializableMarshaller.INSTANCE;
}
Program: 163066
Project: 163066
Buggy source:
ChronicleMapBuilder(Class<K> keyClass,Class<V> valueClass){
  this.keyClass=keyClass;
  this.valueClass=valueClass;
  Class<K> keyClassForMarshaller=marshallerUseFactory(keyClass) && keyClass.isInterface() ? DataValueClasses.directClassFor(keyClass) : keyClass;
  keyMarshaller=chooseDefaultMarshaller(keyClassForMarshaller);
  Class<V> valueClassForMarshaller=marshallerUseFactory(valueClass) && valueClass.isInterface() ? DataValueClasses.directClassFor(valueClass) : valueClass;
  valueMarshaller=chooseDefaultMarshaller(valueClassForMarshaller);
  valueFactory=marshallerUseFactory(valueClass) ? new AllocateInstanceObjectFactory(valueClass.isInterface() ? DataValueClasses.directClassFor(valueClass) : valueClass) : NullObjectFactory.INSTANCE;
}

Fixed version (ground truth):
ChronicleMapBuilder(Class<K> keyClass,Class<V> valueClass){
  this.keyClass=keyClass;
  this.valueClass=valueClass;
  keyMarshaller=chooseDefaultMarshaller(keyClass);
  valueMarshaller=chooseDefaultMarshaller(valueClass);
  valueFactory=marshallerUseFactory(valueClass) ? new AllocateInstanceObjectFactory(valueClass.isInterface() ? DataValueClasses.directClassFor(valueClass) : valueClass) : NullObjectFactory.INSTANCE;
}
Program: 163067
Project: 163067
Buggy source:
@Before public void setup() throws IOException {
{
    final TcpReplicationConfig tcpReplicationConfig=TcpReplicationConfig.of(8086,new InetSocketAddress("String_Node_Str",8087)).heartBeatInterval(1,SECONDS);
    clusterA=new ReplicatingClusterBuilder((byte)1,1024).tcpReplication(tcpReplicationConfig).create();
    map1a=ChronicleMapBuilder.of(Integer.class,CharSequence.class).entries(1000).addReplicator(clusterA.channelReplicator((short)1)).create(getPersistenceFile());
    map2a=ChronicleMapBuilder.of(Integer.class,CharSequence.class).entries(1000).addReplicator(clusterA.channelReplicator((short)2)).create(getPersistenceFile());
  }
{
    final TcpReplicationConfig tcpReplicationConfig=TcpReplicationConfig.of(8087).heartBeatInterval(1,SECONDS);
    clusterB=new ReplicatingClusterBuilder((byte)2,1024).tcpReplication(tcpReplicationConfig).create();
    map1b=ChronicleMapBuilder.of(Integer.class,CharSequence.class).entries(1000).addReplicator(clusterB.channelReplicator((short)1)).create(getPersistenceFile());
    map2b=ChronicleMapBuilder.of(Integer.class,CharSequence.class).entries(1000).addReplicator(clusterB.channelReplicator((short)2)).create(getPersistenceFile());
  }
}

Fixed version (ground truth):
@Before public void setup() throws IOException {
{
    final TcpReplicationConfig tcpReplicationConfig=TcpReplicationConfig.of(8086,new InetSocketAddress("String_Node_Str",8087)).heartBeatInterval(1,SECONDS);
    clusterA=new ReplicatingClusterBuilder((byte)1,1024).tcpReplication(tcpReplicationConfig).create();
    map1a=ChronicleMapBuilder.of(Integer.class,CharSequence.class).entries(1000).addReplicator(clusterA.channelReplicator((short)1)).create(getPersistenceFile());
    map2a=ChronicleMapBuilder.of(Integer.class,CharSequence.class).entries(1000).addReplicator(clusterA.channelReplicator((short)2)).create(getPersistenceFile());
  }
{
    final TcpReplicationConfig tcpReplicationConfig=TcpReplicationConfig.of(8087,new InetSocketAddress("String_Node_Str",8086)).heartBeatInterval(1,SECONDS);
    clusterB=new ReplicatingClusterBuilder((byte)2,1024).tcpReplication(tcpReplicationConfig).create();
    map1b=ChronicleMapBuilder.of(Integer.class,CharSequence.class).entries(1000).addReplicator(clusterB.channelReplicator((short)1)).create(getPersistenceFile());
    map2b=ChronicleMapBuilder.of(Integer.class,CharSequence.class).entries(1000).addReplicator(clusterB.channelReplicator((short)2)).create(getPersistenceFile());
  }
}
Program: 163068
Project: 163068
Buggy source:
@Before public void setup() throws IOException {
{
    final TcpReplicationConfig tcpReplicationConfig=TcpReplicationConfig.of(8086,new InetSocketAddress("String_Node_Str",8087)).heartBeatInterval(1,SECONDS);
    clusterA=new ReplicatingClusterBuilder((byte)1,1024).tcpReplication(tcpReplicationConfig).create();
    map1a=ChronicleMapBuilder.of(Integer.class,CharSequence.class).entries(1000).addReplicator(clusterA.channelReplicator((short)1)).create(getPersistenceFile());
  }
{
    final TcpReplicationConfig replicationConfig=TcpReplicationConfig.of(8087).heartBeatInterval(1,SECONDS);
    clusterB=new ReplicatingClusterBuilder((byte)2,1024).tcpReplication(replicationConfig).create();
    map1b=ChronicleMapBuilder.of(Integer.class,CharSequence.class).addReplicator(clusterB.channelReplicator((short)1)).entries(1000).create(getPersistenceFile());
  }
}

Fixed version (ground truth):
@Before public void setup() throws IOException {
{
    final TcpReplicationConfig tcpReplicationConfig=TcpReplicationConfig.of(8086,new InetSocketAddress("String_Node_Str",8087)).heartBeatInterval(1,SECONDS);
    clusterA=new ReplicatingClusterBuilder((byte)1,1024).tcpReplication(tcpReplicationConfig).create();
    map1a=ChronicleMapBuilder.of(Integer.class,CharSequence.class).entries(1000).addReplicator(clusterA.channelReplicator((short)1)).create(getPersistenceFile());
  }
{
    final TcpReplicationConfig tcpReplicationConfig=TcpReplicationConfig.of(8087,new InetSocketAddress("String_Node_Str",8086)).heartBeatInterval(1,SECONDS);
    clusterB=new ReplicatingClusterBuilder((byte)2,1024).tcpReplication(tcpReplicationConfig).create();
    map1b=ChronicleMapBuilder.of(Integer.class,CharSequence.class).addReplicator(clusterB.channelReplicator((short)1)).entries(1000).create(getPersistenceFile());
  }
}
Program: 163069
Project: 163069
Buggy source:
SharedHashMapBuilder<K,V> toBuilder() throws IOException {
  SharedHashMapBuilder builder=clone();
  for (int i=0; i < 10; i++) {
    if (file.exists() && file.length() > 0) {
      readFile(file,builder);
      break;
    }
    if (file.createNewFile() || file.length() == 0) {
      newFile(file);
      break;
    }
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      throw new IOException(e);
    }
  }
  if (builder == null || !file.exists())   throw new FileNotFoundException("String_Node_Str" + file);
  return builder;
}

Fixed version (ground truth):
SharedHashMapBuilder<K,V> toBuilder() throws IOException {
  SharedHashMapBuilder builder=clone();
  if (file != null) {
    for (int i=0; i < 10; i++) {
      if (file.exists() && file.length() > 0) {
        readFile(file,builder);
        break;
      }
      if (file.createNewFile() || file.length() == 0) {
        newFile(file);
        break;
      }
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException e) {
        throw new IOException(e);
      }
    }
    if (builder == null || !file.exists())     throw new FileNotFoundException("String_Node_Str" + file);
  }
  return builder;
}
Program: 163070
Project: 163070
Buggy source:
/** 
 * this is used to iterate over all the modification iterators
 * @return
 */
int assignedModIterBitSetSizeInBytes(){
  return (int)align64((long)Math.ceil(127 + RESERVED_MOD_ITER / 8));
}

Fixed version (ground truth):
private int assignedModIterBitSetSizeInBytes(){
  return (int)align64((127 + RESERVED_MOD_ITER) / 8);
}
Program: 163071
Project: 163071
Buggy source:
@Override public void onDraw(Canvas canvas){
  if (image == null)   return;
  if (image.getHeight() == 0 || image.getWidth() == 0)   return;
  int oldCanvasSize=canvasSize;
  canvasSize=canvas.getWidth();
  if (canvas.getHeight() < canvasSize)   canvasSize=canvas.getHeight();
  if (oldCanvasSize != canvasSize)   refreshBitmapShader();
  paint.setShader(shader);
  int outerWidth=0;
  int center=canvasSize / 2;
  if (hasSelector && isSelected) {
    outerWidth=selectorStrokeWidth;
    center=(canvasSize - (outerWidth * 2)) / 2;
    paint.setColorFilter(selectorFilter);
    canvas.drawCircle(center + outerWidth,center + outerWidth,((canvasSize - (outerWidth * 2)) / 2) + outerWidth - 4.0f,paintSelectorBorder);
  }
 else   if (hasBorder) {
    outerWidth=borderWidth;
    center=(canvasSize - (outerWidth * 2)) / 2;
    paint.setColorFilter(null);
    canvas.drawCircle(center + outerWidth,center + outerWidth,((canvasSize - (outerWidth * 2)) / 2) + outerWidth - 4.0f,paintBorder);
  }
 else   paint.setColorFilter(null);
  canvas.drawCircle(center + outerWidth,center + outerWidth,((canvasSize - (outerWidth * 2)) / 2) - 4.0f,paint);
}

Fixed version (ground truth):
@Override public void onDraw(Canvas canvas){
  if (image == null)   return;
  if (image.getHeight() == 0 || image.getWidth() == 0)   return;
  int oldCanvasSize=canvasSize;
  canvasSize=getWidth() < getHeight() ? getWidth() : getHeight();
  if (oldCanvasSize != canvasSize)   refreshBitmapShader();
  paint.setShader(shader);
  int outerWidth=0;
  int center=canvasSize / 2;
  if (hasSelector && isSelected) {
    outerWidth=selectorStrokeWidth;
    center=(canvasSize - (outerWidth * 2)) / 2;
    paint.setColorFilter(selectorFilter);
    canvas.drawCircle(center + outerWidth,center + outerWidth,((canvasSize - (outerWidth * 2)) / 2) + outerWidth - 4.0f,paintSelectorBorder);
  }
 else   if (hasBorder) {
    outerWidth=borderWidth;
    center=(canvasSize - (outerWidth * 2)) / 2;
    paint.setColorFilter(null);
    canvas.drawCircle(center + outerWidth,center + outerWidth,((canvasSize - (outerWidth * 2)) / 2) + outerWidth - 4.0f,paintBorder);
  }
 else   paint.setColorFilter(null);
  canvas.drawCircle(center + outerWidth,center + outerWidth,((canvasSize - (outerWidth * 2)) / 2) - 4.0f,paint);
}
Program: 163074
Project: 163074
Buggy source:
@Override public boolean processDeclarations(@NotNull PsiScopeProcessor processor,@NotNull ResolveState state,PsiElement lastParent,@NotNull PsiElement place){
  return ElixirPsiImplUtil.processDeclarationsInPreviousSibling(this,processor,state,lastParent,place);
}

Fixed version (ground truth):
@Override public boolean processDeclarations(@NotNull PsiScopeProcessor processor,@NotNull ResolveState state,PsiElement lastParent,@NotNull PsiElement place){
  boolean keepProcessing=ElixirPsiImplUtil.processDeclarationsInPreviousSibling(this,processor,state,lastParent,place);
  if (keepProcessing) {
    processor.execute(this,state);
  }
  return keepProcessing;
}
Program: 163076
Project: 163076
Buggy source:
protected boolean execute(@NotNull Call element,@NotNull final ResolveState state){
  boolean keepProcessing=true;
  if (org.elixir_lang.structure_view.element.CallDefinitionClause.is(element)) {
    keepProcessing=executeOnCallDefinitionClause(element,state);
  }
 else   if (Import.is(element)) {
    final ResolveState importState=state.put(IMPORT_CALL,element);
    try {
      Import.callDefinitionClauseCallWhile(element,new Function<Call,Boolean>(){
        @Override public Boolean fun(        Call callDefinitionClause){
          return executeOnCallDefinitionClause(callDefinitionClause,importState);
        }
      }
);
    }
 catch (    StackOverflowError stackOverflowError) {
      Logger.error(CallDefinitionClause.class,"String_Node_Str",element);
    }
  }
 else   if (Module.is(element)) {
    Call[] childCalls=macroChildCalls(element);
    if (childCalls != null) {
      for (      Call childCall : childCalls) {
        if (!execute(childCall,state)) {
          break;
        }
      }
    }
    keepProcessing=keepProcessing();
  }
  return keepProcessing;
}

Fixed version (ground truth):
private boolean execute(@NotNull Call element,@NotNull final ResolveState state){
  boolean keepProcessing=true;
  if (org.elixir_lang.structure_view.element.CallDefinitionClause.is(element)) {
    keepProcessing=executeOnCallDefinitionClause(element,state);
  }
 else   if (Import.is(element)) {
    final ResolveState importState=state.put(IMPORT_CALL,element);
    try {
      Import.callDefinitionClauseCallWhile(element,new Function<Call,Boolean>(){
        @Override public Boolean fun(        Call callDefinitionClause){
          return executeOnCallDefinitionClause(callDefinitionClause,importState);
        }
      }
);
    }
 catch (    StackOverflowError stackOverflowError) {
      Logger.error(CallDefinitionClause.class,"String_Node_Str",element);
    }
  }
 else   if (Module.is(element)) {
    Call[] childCalls=macroChildCalls(element);
    if (childCalls != null) {
      for (      Call childCall : childCalls) {
        if (!execute(childCall,state)) {
          break;
        }
      }
    }
    keepProcessing=keepProcessing();
    if (keepProcessing) {
      keepProcessing=implicitImports(element,state);
    }
  }
  return keepProcessing;
}
Program: 163077
Project: 163077
Buggy source:
@Override public Boolean fun(Call callDefinitionClause){
  return executeOnCallDefinitionClause(callDefinitionClause,importState);
}

Fixed version (ground truth):
@Override public Boolean fun(Call callDefinitionClause){
  return executeOnCallDefinitionClause(callDefinitionClause,modularCanonicalNameState);
}
Program: 163078
Project: 163078
Buggy source:
@Nullable public static List<LookupElement> lookupElementList(@NotNull PsiElement entrance){
  Variants variants=new Variants();
  Parameter parameter=Parameter.putParameterized(new Parameter(entrance));
  Call entranceCallDefinitionClause=null;
  if (parameter.isCallDefinitionClauseName()) {
    entranceCallDefinitionClause=(Call)parameter.parameterized;
  }
  ResolveState resolveState=ResolveState.initial().put(ENTRANCE,entrance).put(ENTRANCE_CALL_DEFINITION_CLAUSE,entranceCallDefinitionClause);
  PsiTreeUtil.treeWalkUp(variants,entrance,entrance.getContainingFile(),resolveState);
  List<LookupElement> lookupElementList=new ArrayList<LookupElement>();
  lookupElementList.addAll(variants.getLookupElementCollection());
  variants.addProjectNameElementsTo(lookupElementList,entrance,entranceCallDefinitionClause);
  return lookupElementList;
}

Fixed version (ground truth):
@Nullable public static List<LookupElement> lookupElementList(@NotNull PsiElement entrance){
  Variants variants=new Variants();
  Parameter parameter=Parameter.putParameterized(new Parameter(entrance));
  Call entranceCallDefinitionClause=null;
  if (parameter.isCallDefinitionClauseName()) {
    entranceCallDefinitionClause=(Call)parameter.parameterized;
  }
  ResolveState resolveState=ResolveState.initial().put(ENTRANCE,entrance).put(ENTRANCE_CALL_DEFINITION_CLAUSE,entranceCallDefinitionClause);
  PsiTreeUtil.treeWalkUp(variants,entrance,entrance.getContainingFile(),resolveState);
  List<LookupElement> lookupElementList=new ArrayList<LookupElement>();
  lookupElementList.addAll(variants.getLookupElementCollection());
  return lookupElementList;
}
Program: 163079
Project: 163079
Buggy source:
/** 
 * Called on every   {@link Call} where {@link org.elixir_lang.structure_view.element.CallDefinitionClause#is} is{@code true} when checking tree with {@link #execute(Call,ResolveState)}
 * @param element
 * @param state
 * @return {@code true} to keep searching up tree; {@code false} to stop searching.
 */
@Override protected boolean executeOnCallDefinitionClause(Call element,ResolveState state){
  Call entranceCallDefinitionClause=state.get(ENTRANCE_CALL_DEFINITION_CLAUSE);
  if (entranceCallDefinitionClause == null || !element.isEquivalentTo(entranceCallDefinitionClause)) {
    addToLookupElementByPsiElement(element);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Called on every   {@link Call} where {@link org.elixir_lang.structure_view.element.CallDefinitionClause#is} is{@code true} when checking tree with {@link #execute(Call,ResolveState)}
 * @return {@code true} to keep searching up tree; {@code false} to stop searching.
 */
@Override protected boolean executeOnCallDefinitionClause(Call element,ResolveState state){
  Call entranceCallDefinitionClause=state.get(ENTRANCE_CALL_DEFINITION_CLAUSE);
  if (entranceCallDefinitionClause == null || !element.isEquivalentTo(entranceCallDefinitionClause)) {
    addToLookupElementByPsiElement(element);
  }
  return true;
}
Program: 163080
Project: 163080
Buggy source:
private static File putFile(@NotNull String fileName,@NotNull File directory) throws IOException {
  URL moduleUrl=ResourceUtil.getResource(ElixirModules.class,"String_Node_Str",fileName);
  if (moduleUrl == null) {
    throw new IOException("String_Node_Str" + fileName);
  }
  try (BufferedInputStream inputStream=new BufferedInputStream(URLUtil.openStream(moduleUrl))){
    File file=new File(directory,fileName);
    try (BufferedOutputStream outputStream=new BufferedOutputStream(new FileOutputStream(file))){
      FileUtil.copy(inputStream,outputStream);
      return file;
    }
   }
 }

Fixed version (ground truth):
private static File putFile(@NotNull String fileName,@NotNull File directory) throws IOException {
  URL moduleUrl=ResourceUtil.getResource(ElixirModules.class,"String_Node_Str",fileName);
  if (moduleUrl == null) {
    throw new IOException("String_Node_Str" + fileName);
  }
  BufferedInputStream inputStream=new BufferedInputStream(URLUtil.openStream(moduleUrl));
  File file=new File(directory,fileName);
  BufferedOutputStream outputStream=new BufferedOutputStream(new FileOutputStream(file));
  try {
    FileUtil.copy(inputStream,outputStream);
    return file;
  }
  finally {
    inputStream.close();
    outputStream.close();
  }
}
Program: 163081
Project: 163081
Buggy source:
@Nullable @Override public BracePair findPair(boolean left,HighlighterIterator iterator,CharSequence fileText,FileType fileType){
  BracePair pair=super.findPair(left,iterator,fileText,fileType);
  if (pair == DO_END) {
    iterator.advance();
    IElementType tokenType=iterator.getTokenType();
    if (tokenType == ElixirTypes.KEYWORD_PAIR_COLON) {
      pair=null;
    }
    iterator.retreat();
  }
  return pair;
}

Fixed version (ground truth):
@Nullable @Override public BracePair findPair(boolean left,HighlighterIterator iterator,CharSequence fileText,FileType fileType){
  BracePair pair=super.findPair(left,iterator,fileText,fileType);
  if (pair == DO_END || pair == FN_END) {
    iterator.advance();
    IElementType tokenType=iterator.getTokenType();
    if (tokenType == ElixirTypes.KEYWORD_PAIR_COLON) {
      pair=null;
    }
    iterator.retreat();
  }
  return pair;
}
Program: 163082
Project: 163082
Buggy source:
@Nullable @Override public Result applyFilter(@NotNull String line,int entireLength){
  Matcher matcher=myPattern.matcher(line);
  if (!matcher.find()) {
    return null;
  }
  String filePath=matcher.group(myFileMatchGroup);
  int fileLine=matchGroupToNumber(matcher,myLineMatchGroup);
  int fileColumn=matchGroupToNumber(matcher,myColumnMatchGroup);
  int highlightStartOffset=entireLength - line.length() + matcher.start(0);
  int highlightEndOffset=highlightStartOffset + matcher.end(0) - matcher.start(0);
  VirtualFile absolutePath=resolveAbsolutePath(filePath);
  HyperlinkInfo hyperlinkInfo=absolutePath != null ? new OpenFileHyperlinkInfo(myProject,absolutePath,fileLine,fileColumn) : null;
  return new Result(highlightStartOffset,highlightEndOffset,hyperlinkInfo);
}

Fixed version (ground truth):
@Nullable @Override public Result applyFilter(@NotNull String line,int entireLength){
  Matcher matcher=myPattern.matcher(line);
  if (!matcher.find()) {
    return null;
  }
  String filePath=matcher.group(myFileMatchGroup);
  int fileLine=matchGroupToNumber(matcher,myLineMatchGroup);
  int fileColumn=matchGroupToNumber(matcher,myColumnMatchGroup);
  int highlightStartOffset=entireLength - line.length() + matcher.start(0) + 1;
  int highlightEndOffset=highlightStartOffset + matcher.end(0) - matcher.start(0) - 1;
  VirtualFile absolutePath=resolveAbsolutePath(filePath);
  HyperlinkInfo hyperlinkInfo=absolutePath != null ? new OpenFileHyperlinkInfo(myProject,absolutePath,fileLine,fileColumn) : null;
  return new Result(highlightStartOffset,highlightEndOffset,hyperlinkInfo);
}
Program: 163084
Project: 163084
Buggy source:
@Contract(pure=true) @NotNull @Override PsiReference getReference();

Fixed version (ground truth):
@Contract(pure=true) @Nullable @Override PsiReference getReference();
Program: 163085
Project: 163085
Buggy source:
@Contract(pure=true) @NotNull public static Operator operator(Prefix prefix){
}

Fixed version (ground truth):
@Contract(pure=true) @NotNull public static Operator operator(Prefix prefix){
  PsiElement[] children=prefix.getChildren();
  if (children.length != 2) {
    error(Prefix.class,"String_Node_Str" + children.length,prefix);
  }
  return (Operator)children[0];
}
Program: 163086
Project: 163086
Buggy source:
@Contract(pure=true) @NotNull public static Operator operator(Prefix prefix){
}

Fixed version (ground truth):
@Contract(pure=true) @NotNull public static Operator operator(Prefix prefix){
  PsiElement[] children=prefix.getChildren();
  if (children.length != 2) {
    error(Prefix.class,"String_Node_Str" + children.length,prefix);
  }
  return (Operator)children[0];
}
Program: 163087
Project: 163087
Buggy source:
@Contract(pure=true) @NotNull public static Quotable leftOperand(Infix infix){
  PsiElement[] children=infix.getChildren();
  if (children.length != 3) {
    error(Infix.class,"String_Node_Str" + children.length,infix);
  }
  return (Quotable)children[0];
}

Fixed version (ground truth):
@Contract(pure=true) @NotNull public static Quotable leftOperand(Infix infix){
  PsiElement[] children=infix.getChildren();
  if (children.length < 2 || 3 < children.length) {
    error(Infix.class,"String_Node_Str" + children.length,infix);
  }
  return (Quotable)children[0];
}
Program: 163088
Project: 163088
Buggy source:
public static boolean relativeIdentifier(PsiBuilder b,int l){
  if (!recursion_guard_(b,l,"String_Node_Str"))   return false;
  boolean r;
  Marker m=enter_section_(b,l,_NONE_,"String_Node_Str");
  r=consumeToken(b,IDENTIFIER);
  if (!r)   r=consumeToken(b,AND_OPERATOR);
  if (!r)   r=consumeToken(b,ARROW_OPERATOR);
  if (!r)   r=consumeToken(b,AT_OPERATOR);
  if (!r)   r=consumeToken(b,CAPTURE_OPERATOR);
  if (!r)   r=consumeToken(b,COMPARISON_OPERATOR);
  if (!r)   r=consumeToken(b,DO);
  if (!r)   r=relativeIdentifier_7(b,l + 1);
  if (!r)   r=consumeToken(b,HAT_OPERATOR);
  if (!r)   r=consumeToken(b,IN_MATCH_OPERATOR);
  if (!r)   r=consumeToken(b,IN_OPERATOR);
  if (!r)   r=consumeToken(b,MATCH_OPERATOR);
  if (!r)   r=consumeToken(b,MULTIPLICATION_OPERATOR);
  if (!r)   r=consumeToken(b,OR_OPERATOR);
  if (!r)   r=consumeToken(b,PIPE_OPERATOR);
  if (!r)   r=consumeToken(b,RELATIONAL_OPERATOR);
  if (!r)   r=consumeToken(b,STAB_OPERATOR);
  if (!r)   r=consumeToken(b,STRUCT_OPERATOR);
  if (!r)   r=consumeToken(b,TWO_OPERATOR);
  if (!r)   r=consumeToken(b,UNARY_OPERATOR);
  if (!r)   r=consumeToken(b,WHEN_OPERATOR);
  if (!r)   r=atomKeyword(b,l + 1);
  if (!r)   r=charListLine(b,l + 1);
  if (!r)   r=stringLine(b,l + 1);
  exit_section_(b,l,m,RELATIVE_IDENTIFIER,r,false,null);
  return r;
}

Fixed version (ground truth):
public static boolean relativeIdentifier(PsiBuilder b,int l){
  if (!recursion_guard_(b,l,"String_Node_Str"))   return false;
  boolean r;
  Marker m=enter_section_(b,l,_NONE_,"String_Node_Str");
  r=consumeToken(b,IDENTIFIER);
  if (!r)   r=consumeToken(b,AFTER);
  if (!r)   r=consumeToken(b,AND_OPERATOR);
  if (!r)   r=consumeToken(b,ARROW_OPERATOR);
  if (!r)   r=consumeToken(b,AT_OPERATOR);
  if (!r)   r=consumeToken(b,CAPTURE_OPERATOR);
  if (!r)   r=consumeToken(b,COMPARISON_OPERATOR);
  if (!r)   r=consumeToken(b,DO);
  if (!r)   r=relativeIdentifier_8(b,l + 1);
  if (!r)   r=consumeToken(b,HAT_OPERATOR);
  if (!r)   r=consumeToken(b,IN_MATCH_OPERATOR);
  if (!r)   r=consumeToken(b,IN_OPERATOR);
  if (!r)   r=consumeToken(b,MATCH_OPERATOR);
  if (!r)   r=consumeToken(b,MULTIPLICATION_OPERATOR);
  if (!r)   r=consumeToken(b,OR_OPERATOR);
  if (!r)   r=consumeToken(b,PIPE_OPERATOR);
  if (!r)   r=consumeToken(b,RELATIONAL_OPERATOR);
  if (!r)   r=consumeToken(b,STAB_OPERATOR);
  if (!r)   r=consumeToken(b,STRUCT_OPERATOR);
  if (!r)   r=consumeToken(b,TWO_OPERATOR);
  if (!r)   r=consumeToken(b,UNARY_OPERATOR);
  if (!r)   r=consumeToken(b,WHEN_OPERATOR);
  if (!r)   r=atomKeyword(b,l + 1);
  if (!r)   r=charListLine(b,l + 1);
  if (!r)   r=stringLine(b,l + 1);
  exit_section_(b,l,m,RELATIVE_IDENTIFIER,r,false,null);
  return r;
}
Program: 163089
Project: 163089
Buggy source:
@Override public void onError(int response,@Nonnull Exception e){
}

Fixed version (ground truth):
@Override public void onError(int response,@Nonnull Exception e){
  if (response == ResponseCodes.ITEM_NOT_OWNED) {
    onConsumed();
  }
 else {
    super.onError(response,e);
  }
}
Program: 163090
Project: 163090
Buggy source:
@Override public void onSuccess(@Nonnull Object result){
  inventory.load().whenLoaded(new InventoryLoadedListener());
  Toast.makeText(getActivity(),R.string.msg_item_consumed,Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
@Override public void onSuccess(@Nonnull Object result){
  onConsumed();
}
Program: 163092
Project: 163092
Buggy source:
public FacebookSocialNetwork(Fragment fragment,Context context,ArrayList<String> permissions){
  super(fragment,context);
  String applicationID=Utility.getMetadataApplicationId(fragment.getActivity());
  if (applicationID == null) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  this.permissions=permissions;
}

Fixed version (ground truth):
public FacebookSocialNetwork(Fragment fragment,Context context,ArrayList<String> permissions){
  super(fragment,context);
  String applicationID=Utility.getMetadataApplicationId(context);
  if (applicationID == null) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  this.permissions=permissions;
}
Program: 163094
Project: 163094
Buggy source:
@Override protected String doInBackground(Void... params){
  String scope="String_Node_Str" + Scopes.PLUS_LOGIN;
  String token;
  try {
    token=GoogleAuthUtil.getToken(mSocialNetworkManager.getActivity(),Plus.AccountApi.getAccountName(googleApiClient),scope);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return e.getMessage();
  }
  return token;
}

Fixed version (ground truth):
@Override protected String doInBackground(Activity... params){
  String scope="String_Node_Str" + Scopes.PLUS_LOGIN;
  String token;
  try {
    token=GoogleAuthUtil.getToken(params[0],Plus.AccountApi.getAccountName(googleApiClient),scope);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return e.getMessage();
  }
  return token;
}
Program: 163095
Project: 163095
Buggy source:
/** 
 * Request Google plus share dialog
 * @param bundle bundle containing information that should be shared(Bundle constants in {@link com.github.gorbin.asne.core.SocialNetwork})
 * @param onPostingCompleteListener listener for posting request
 */
@Override public void requestPostDialog(Bundle bundle,OnPostingCompleteListener onPostingCompleteListener){
  super.requestPostDialog(bundle,onPostingCompleteListener);
  PlusShare.Builder plusShare=new PlusShare.Builder(mSocialNetworkManager.getActivity()).setType("String_Node_Str");
  if (bundle != null) {
    if (bundle.containsKey(BUNDLE_MESSAGE)) {
      plusShare.setText(bundle.getString(BUNDLE_MESSAGE));
    }
    if (bundle.containsKey(BUNDLE_LINK)) {
      plusShare.setContentUrl(Uri.parse(bundle.getString(BUNDLE_LINK)));
    }
  }
  Intent shareIntent=plusShare.getIntent();
  mSocialNetworkManager.getActivity().startActivityForResult(shareIntent,0);
}

Fixed version (ground truth):
/** 
 * Request Google plus share dialog
 * @param bundle bundle containing information that should be shared(Bundle constants in {@link com.github.gorbin.asne.core.SocialNetwork})
 * @param onPostingCompleteListener listener for posting request
 */
@Override public void requestPostDialog(Bundle bundle,OnPostingCompleteListener onPostingCompleteListener){
  super.requestPostDialog(bundle,onPostingCompleteListener);
  PlusShare.Builder plusShare=new PlusShare.Builder(mActivity).setType("String_Node_Str");
  if (bundle != null) {
    if (bundle.containsKey(BUNDLE_MESSAGE)) {
      plusShare.setText(bundle.getString(BUNDLE_MESSAGE));
    }
    if (bundle.containsKey(BUNDLE_LINK)) {
      plusShare.setContentUrl(Uri.parse(bundle.getString(BUNDLE_LINK)));
    }
  }
  Intent shareIntent=plusShare.getIntent();
  mActivity.startActivityForResult(shareIntent,0);
}
Program: 163096
Project: 163096
Buggy source:
@Override protected void onPostExecute(String token){
  if (token != null) {
    ((OnRequestAccessTokenCompleteListener)mLocalListeners.get(REQUEST_ACCESS_TOKEN)).onRequestAccessTokenComplete(getID(),new AccessToken(token,null));
  }
 else {
    mLocalListeners.get(REQUEST_LOGIN).onError(getID(),REQUEST_ACCESS_TOKEN,token,null);
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(String token){
  if (token != null) {
    ((OnRequestAccessTokenCompleteListener)mLocalListeners.get(REQUEST_ACCESS_TOKEN)).onRequestAccessTokenComplete(getID(),new AccessToken(token,null));
  }
 else {
    mLocalListeners.get(REQUEST_ACCESS_TOKEN).onError(getID(),REQUEST_ACCESS_TOKEN,token,null);
  }
}
Program: 163097
Project: 163097
Buggy source:
/** 
 * Overrided for Google plus
 * @param savedInstanceState If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied in onSaveInstanceState(Bundle). Note: Otherwise it is null.
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Plus.PlusOptions plusOptions=new Plus.PlusOptions.Builder().addActivityTypes(MomentUtil.ACTIONS).build();
  googleApiClient=new GoogleApiClient.Builder(mSocialNetworkManager.getActivity()).addApi(Plus.API,plusOptions).addScope(Plus.SCOPE_PLUS_LOGIN).addScope(Plus.SCOPE_PLUS_PROFILE).addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();
}

Fixed version (ground truth):
/** 
 * Overrided for Google plus
 * @param savedInstanceState If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied in onSaveInstanceState(Bundle). Note: Otherwise it is null.
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mActivity=mSocialNetworkManager.getActivity();
  Plus.PlusOptions plusOptions=new Plus.PlusOptions.Builder().addActivityTypes(MomentUtil.ACTIONS).build();
  googleApiClient=new GoogleApiClient.Builder(mActivity).addApi(Plus.API,plusOptions).addScope(Plus.SCOPE_PLUS_LOGIN).addScope(Plus.SCOPE_PLUS_PROFILE).addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();
}
Program: 163098
Project: 163098
Buggy source:
/** 
 * Request   {@link com.github.gorbin.asne.core.AccessToken} of Google plus social network that you can get from onRequestAccessTokenCompleteListener
 * @param onRequestAccessTokenCompleteListener listener for {@link com.github.gorbin.asne.core.AccessToken} request
 */
@Override public void requestAccessToken(OnRequestAccessTokenCompleteListener onRequestAccessTokenCompleteListener){
  super.requestAccessToken(onRequestAccessTokenCompleteListener);
  AsyncTask<Void,Void,String> task=new AsyncTask<Void,Void,String>(){
    @Override protected String doInBackground(    Void... params){
      String scope="String_Node_Str" + Scopes.PLUS_LOGIN;
      String token;
      try {
        token=GoogleAuthUtil.getToken(mSocialNetworkManager.getActivity(),Plus.AccountApi.getAccountName(googleApiClient),scope);
      }
 catch (      Exception e) {
        e.printStackTrace();
        return e.getMessage();
      }
      return token;
    }
    @Override protected void onPostExecute(    String token){
      if (token != null) {
        ((OnRequestAccessTokenCompleteListener)mLocalListeners.get(REQUEST_ACCESS_TOKEN)).onRequestAccessTokenComplete(getID(),new AccessToken(token,null));
      }
 else {
        mLocalListeners.get(REQUEST_LOGIN).onError(getID(),REQUEST_ACCESS_TOKEN,token,null);
      }
    }
  }
;
  task.execute();
}

Fixed version (ground truth):
/** 
 * Request   {@link com.github.gorbin.asne.core.AccessToken} of Google plus social network that you can get from onRequestAccessTokenCompleteListener
 * @param onRequestAccessTokenCompleteListener listener for {@link com.github.gorbin.asne.core.AccessToken} request
 */
@Override public void requestAccessToken(OnRequestAccessTokenCompleteListener onRequestAccessTokenCompleteListener){
  super.requestAccessToken(onRequestAccessTokenCompleteListener);
  AsyncTask<Activity,Void,String> task=new AsyncTask<Activity,Void,String>(){
    @Override protected String doInBackground(    Activity... params){
      String scope="String_Node_Str" + Scopes.PLUS_LOGIN;
      String token;
      try {
        token=GoogleAuthUtil.getToken(params[0],Plus.AccountApi.getAccountName(googleApiClient),scope);
      }
 catch (      Exception e) {
        e.printStackTrace();
        return e.getMessage();
      }
      return token;
    }
    @Override protected void onPostExecute(    String token){
      if (token != null) {
        ((OnRequestAccessTokenCompleteListener)mLocalListeners.get(REQUEST_ACCESS_TOKEN)).onRequestAccessTokenComplete(getID(),new AccessToken(token,null));
      }
 else {
        mLocalListeners.get(REQUEST_ACCESS_TOKEN).onError(getID(),REQUEST_ACCESS_TOKEN,token,null);
      }
    }
  }
;
  task.execute(mActivity);
}
Program: 163099
Project: 163099
Buggy source:
/** 
 * Make login request - authorize in Google plus social network
 * @param onLoginCompleteListener listener for login complete
 */
@Override public void requestLogin(OnLoginCompleteListener onLoginCompleteListener){
  super.requestLogin(onLoginCompleteListener);
  mConnectRequested=true;
  try {
    mConnectionResult.startResolutionForResult(mSocialNetworkManager.getActivity(),REQUEST_AUTH);
  }
 catch (  Exception e) {
    if (!googleApiClient.isConnecting()) {
      googleApiClient.connect();
    }
  }
}

Fixed version (ground truth):
/** 
 * Make login request - authorize in Google plus social network
 * @param onLoginCompleteListener listener for login complete
 */
@Override public void requestLogin(OnLoginCompleteListener onLoginCompleteListener){
  super.requestLogin(onLoginCompleteListener);
  mConnectRequested=true;
  try {
    mConnectionResult.startResolutionForResult(mActivity,REQUEST_AUTH);
  }
 catch (  Exception e) {
    if (!googleApiClient.isConnecting()) {
      googleApiClient.connect();
    }
  }
}
Program: 163100
Project: 163100
Buggy source:
@Override protected void onDraw(Canvas canvas){
  updateWheelStateIfReq();
  if (mWheelDrawable != null) {
    drawWheel(canvas);
  }
  if (mAdapter != null && mAdapterItemCount > 0) {
    drawWheelItems(canvas);
  }
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  updateWheelStateIfReq();
  if (mWheelDrawable != null && mWheelBounds != null) {
    drawWheel(canvas);
  }
  if (mAdapter != null && mAdapterItemCount > 0) {
    drawWheelItems(canvas);
  }
}
Program: 163101
Project: 163101
Buggy source:
private void initOrientationListener(){
  orientationListener=new OrientationEventListener(activity){
    @Override public void onOrientationChanged(    int orientation){
      if (orientation == ORIENTATION_UNKNOWN) {
        return;
      }
      Camera.CameraInfo info=new Camera.CameraInfo();
      Camera.getCameraInfo(0,info);
      orientation=(orientation + 45) / 90 * 90;
      int rotation=(info.orientation + orientation) % 360;
synchronized (parameters) {
        parameters.setRotation(rotation);
        camera.setParameters(parameters);
        currOrientation=rotation;
      }
    }
  }
;
}

Fixed version (ground truth):
private void initOrientationListener(){
  orientationListener=new OrientationEventListener(activity){
    @Override public void onOrientationChanged(    int orientation){
      if (camera != null && orientation != ORIENTATION_UNKNOWN) {
        int newOutputOrientation=getCameraPictureRotation(orientation);
        if (newOutputOrientation != outputOrientation) {
          outputOrientation=newOutputOrientation;
          Camera.Parameters params=camera.getParameters();
          params.setRotation(outputOrientation);
          try {
            camera.setParameters(params);
          }
 catch (          Exception e) {
            Timber.e(e,"String_Node_Str");
          }
        }
      }
    }
  }
;
}
Program: 163102
Project: 163102
Buggy source:
@Override public void onOrientationChanged(int orientation){
  if (orientation == ORIENTATION_UNKNOWN) {
    return;
  }
  Camera.CameraInfo info=new Camera.CameraInfo();
  Camera.getCameraInfo(0,info);
  orientation=(orientation + 45) / 90 * 90;
  int rotation=(info.orientation + orientation) % 360;
synchronized (parameters) {
    parameters.setRotation(rotation);
    camera.setParameters(parameters);
    currOrientation=rotation;
  }
}

Fixed version (ground truth):
@Override public void onOrientationChanged(int orientation){
  if (camera != null && orientation != ORIENTATION_UNKNOWN) {
    int newOutputOrientation=getCameraPictureRotation(orientation);
    if (newOutputOrientation != outputOrientation) {
      outputOrientation=newOutputOrientation;
      Camera.Parameters params=camera.getParameters();
      params.setRotation(outputOrientation);
      try {
        camera.setParameters(params);
      }
 catch (      Exception e) {
        Timber.e(e,"String_Node_Str");
      }
    }
  }
}
Program: 163103
Project: 163103
Buggy source:
private int getCameraId(boolean useFrontCamera){
  int count=Camera.getNumberOfCameras();
  int result=-1;
  if (count > 0) {
    result=0;
    Camera.CameraInfo info=new Camera.CameraInfo();
    for (int i=0; i < count; i++) {
      Camera.getCameraInfo(i,info);
      if (info.facing == Camera.CameraInfo.CAMERA_FACING_BACK && !useFrontCamera) {
        result=i;
        break;
      }
 else       if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT && useFrontCamera) {
        result=i;
        break;
      }
    }
  }
  return result;
}

Fixed version (ground truth):
private int getCameraId(boolean useFrontCamera){
  int count=Camera.getNumberOfCameras();
  int result=-1;
  if (count > 0) {
    result=0;
    Camera.CameraInfo info=new Camera.CameraInfo();
    for (int i=0; i < count; i++) {
      Camera.getCameraInfo(i,info);
      if (info.facing == Camera.CameraInfo.CAMERA_FACING_BACK && !useFrontCamera) {
        result=i;
        break;
      }
 else       if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT && useFrontCamera) {
        result=i;
        break;
      }
    }
  }
  cameraId=result;
  return result;
}
Program: 163104
Project: 163104
Buggy source:
/** 
 * @param width Screen width
 * @param height Screen height
 * @param ratio Required ratio
 */
private void setPreviewContainerSize(int width,int height,Ratio ratio){
  height=(width / ratio.h) * ratio.w;
  previewContainer.setLayoutParams(new RelativeLayout.LayoutParams(width,height));
}

Fixed version (ground truth):
/** 
 * @param width  Screen width
 * @param height Screen height
 * @param ratio  Required ratio
 */
private void setPreviewContainerSize(int width,int height,Ratio ratio){
  height=(width / ratio.h) * ratio.w;
  previewContainer.setLayoutParams(new RelativeLayout.LayoutParams(width,height));
}
Program: 163105
Project: 163105
Buggy source:
public void openCamera(View view){
  Intent intent=new Intent(this,CameraActivity.class);
  intent.putExtra(CameraActivity.PATH,Const.FOLDERS.PATH);
  intent.putExtra(CameraActivity.OPEN_PHOTO_PREVIEW,true);
  intent.putExtra(CameraActivity.LAYOUT_ID,R.layout.fragment_camera_custom);
  intent.putExtra(CameraActivity.USE_FRONT_CAMERA,false);
  startActivity(intent);
}

Fixed version (ground truth):
public void openCamera(View view){
  Intent intent=new Intent(this,CameraActivity.class);
  intent.putExtra(CameraActivity.PATH,Const.FOLDERS.PATH);
  intent.putExtra(CameraActivity.OPEN_PHOTO_PREVIEW,true);
  intent.putExtra(CameraActivity.LAYOUT_ID,R.layout.fragment_camera_custom);
  intent.putExtra(CameraActivity.USE_FRONT_CAMERA,true);
  startActivity(intent);
}
Program: 163106
Project: 163106
Buggy source:
protected void addToWindow(){
  WindowManager.LayoutParams params=new WindowManager.LayoutParams(iconWidth > 0 ? iconWidth : WindowManager.LayoutParams.WRAP_CONTENT,iconHeight > 0 ? iconHeight : WindowManager.LayoutParams.WRAP_CONTENT,WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,PixelFormat.TRANSPARENT);
  params.gravity=Gravity.TOP | Gravity.START;
  windowManager.addView(iconView,layoutParams=params);
  addedToWindow=true;
}

Fixed version (ground truth):
protected void addToWindow(){
  WindowManager.LayoutParams params=new WindowManager.LayoutParams(iconWidth > 0 ? iconWidth : WindowManager.LayoutParams.WRAP_CONTENT,iconHeight > 0 ? iconHeight : WindowManager.LayoutParams.WRAP_CONTENT,WindowManagerHelper.getOverlayFlag(),WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,PixelFormat.TRANSPARENT);
  params.gravity=Gravity.TOP | Gravity.START;
  windowManager.addView(iconView,layoutParams=params);
  addedToWindow=true;
}
Program: 163107
Project: 163107
Buggy source:
private void addToWindow(View layout){
  WindowManager.LayoutParams params=new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,PixelFormat.TRANSLUCENT);
  windowManager.addView(layout,params);
}

Fixed version (ground truth):
private void addToWindow(View layout){
  WindowManager.LayoutParams params=new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT,WindowManagerHelper.getOverlayFlag(),WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,PixelFormat.TRANSLUCENT);
  windowManager.addView(layout,params);
}
Program: 163108
Project: 163108
Buggy source:
protected void hide(){
  shadowFadeOut.startAnimation();
  hideAnim.startAnimation(new Animation.AnimationListener(){
    @Override public void onAnimationStart(    Animation animation){
    }
    @Override public void onAnimationEnd(    Animation animation){
      if (layout != null && layout.getParent() != null) {
        windowManager.removeView(layout);
        isShowing=false;
      }
    }
    @Override public void onAnimationRepeat(    Animation animation){
    }
  }
);
}

Fixed version (ground truth):
protected void hide(){
  shadowFadeOut.startAnimation();
  hideAnim.startAnimation(new Animation.AnimationListener(){
    @Override public void onAnimationStart(    Animation animation){
    }
    @Override public void onAnimationEnd(    Animation animation){
      if (layout != null && layout.getParent() != null) {
        isShowing=false;
        layout.post(new Runnable(){
          @Override public void run(){
            windowManager.removeView(layout);
          }
        }
);
      }
    }
    @Override public void onAnimationRepeat(    Animation animation){
    }
  }
);
}
Program: 163109
Project: 163109
Buggy source:
protected void show(){
  if (layout != null && layout.getParent() == null) {
    addToWindow(layout);
  }
  shadowFadeIn.startAnimation();
  showAnim.startAnimation(new Animation.AnimationListener(){
    @Override public void onAnimationStart(    Animation animation){
    }
    @Override public void onAnimationEnd(    Animation animation){
      isShowing=true;
    }
    @Override public void onAnimationRepeat(    Animation animation){
    }
  }
);
}

Fixed version (ground truth):
protected void show(){
  if (layout != null && layout.getParent() == null) {
    addToWindow(layout);
  }
  shadowFadeIn.startAnimation();
  showAnim.startAnimation(new Animation.AnimationListener(){
    @Override public void onAnimationStart(    Animation animation){
      isShowing=true;
    }
    @Override public void onAnimationEnd(    Animation animation){
    }
    @Override public void onAnimationRepeat(    Animation animation){
    }
  }
);
}
Program: 163110
Project: 163110
Buggy source:
@Override public void onAnimationEnd(Animation animation){
  if (layout != null && layout.getParent() != null) {
    windowManager.removeView(layout);
    isShowing=false;
  }
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animation animation){
  if (layout != null && layout.getParent() != null) {
    isShowing=false;
    layout.post(new Runnable(){
      @Override public void run(){
        windowManager.removeView(layout);
      }
    }
);
  }
}
Program: 163111
Project: 163111
Buggy source:
@Nullable private Bitmap makeBitmapMask(@Nullable Drawable drawable){
  if (drawable != null) {
    if (getMeasuredWidth() > 0 && getMeasuredHeight() > 0) {
      Bitmap mask=Bitmap.createBitmap(getMeasuredWidth(),getMeasuredHeight(),Bitmap.Config.ARGB_8888);
      Canvas canvas=new Canvas(mask);
      drawable.setBounds(0,0,getMeasuredWidth(),getMeasuredWidth());
      drawable.draw(canvas);
      return mask;
    }
 else {
      log("String_Node_Str");
      return null;
    }
  }
 else {
    log("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
@Nullable private Bitmap makeBitmapMask(@Nullable Drawable drawable){
  if (drawable != null) {
    if (getMeasuredWidth() > 0 && getMeasuredHeight() > 0) {
      Bitmap mask=Bitmap.createBitmap(getMeasuredWidth(),getMeasuredHeight(),Bitmap.Config.ARGB_8888);
      Canvas canvas=new Canvas(mask);
      drawable.setBounds(0,0,getMeasuredWidth(),getMeasuredHeight());
      drawable.draw(canvas);
      return mask;
    }
 else {
      log("String_Node_Str");
      return null;
    }
  }
 else {
    log("String_Node_Str");
  }
  return null;
}