nus-yam/ex-repair huggingface dataset:
Program: 20143
Project: 20143
Buggy source:
/** 
 * Implicitly create two queues then delete them one at a time.
 */
public void testDeleteQueuesWithDetail() throws BurrowException {
  String messageId="String_Node_Str";
  String messageBody="String_Node_Str";
  String queueIds[]={"String_Node_Str","String_Node_Str"};
  Queue queues[]={account.Queue(queueIds[0]),account.Queue(queueIds[1])};
  boolean[] seenQueues;
  try {
    backend.execute(account.deleteQueues());
  }
 catch (  CommandException ce) {
  }
  backend.execute(queues[0].createMessage(messageId,messageBody));
  backend.execute(queues[1].createMessage(messageId,messageBody));
  seenQueues=scanQueues(backend.execute(account.getQueues()),queueIds);
  assertTrue(seenQueues[0]);
  assertTrue(seenQueues[1]);
  seenQueues=scanQueues(backend.execute(account.deleteQueues().withLimit(1).withDetail("String_Node_Str")),queueIds);
  assertTrue(seenQueues[0] || seenQueues[1]);
  assertFalse(seenQueues[0] && seenQueues[1]);
  seenQueues=scanQueues(backend.execute(account.deleteQueues().withLimit(1).withDetail("String_Node_Str")),queueIds);
  assertTrue(seenQueues[0] || seenQueues[1]);
  assertFalse(seenQueues[0] && seenQueues[1]);
}

Fixed version (ground truth):
/** 
 * Implicitly create two queues then delete them one at a time.
 */
public void testDeleteQueuesWithDetail() throws BurrowException {
  String messageId="String_Node_Str";
  String messageBody="String_Node_Str";
  String queueIds[]={"String_Node_Str","String_Node_Str"};
  Queue queues[]={account.Queue(queueIds[0]),account.Queue(queueIds[1])};
  boolean[] seenQueues;
  try {
    backend.execute(account.deleteQueues());
  }
 catch (  AccountNotFoundException e) {
  }
  backend.execute(queues[0].createMessage(messageId,messageBody));
  backend.execute(queues[1].createMessage(messageId,messageBody));
  seenQueues=scanQueues(backend.execute(account.getQueues()),queueIds);
  assertTrue("String_Node_Str",seenQueues[0]);
  assertTrue("String_Node_Str",seenQueues[1]);
  seenQueues=scanQueues(backend.execute(account.deleteQueues().withLimit(1).withDetail("String_Node_Str")),queueIds);
  assertTrue("String_Node_Str",seenQueues[0] || seenQueues[1]);
  assertFalse("String_Node_Str",seenQueues[0] && seenQueues[1]);
  seenQueues=scanQueues(backend.execute(account.deleteQueues().withLimit(1).withDetail("String_Node_Str")),queueIds);
  assertTrue(seenQueues[0] || seenQueues[1]);
  assertFalse(seenQueues[0] && seenQueues[1]);
}
Program: 20144
Project: 20144
Buggy source:
/** 
 * Create a message, verify the queue exists, then delete all messages in the queue and verify it goes away.
 */
public void testGetQueuesDeleteMessages() throws BurrowException {
  String messageId="String_Node_Str";
  String messageBody="String_Node_Str";
  String queueIds[]={queue.getId()};
  boolean[] seen;
  try {
    backend.execute(queue.createMessage(messageId,messageBody));
    seen=scanQueues(backend.execute(account.getQueues()),queueIds);
    assertTrue(seen[0]);
  }
 catch (  CommandException ce) {
    fail("String_Node_Str");
  }
  try {
    backend.execute(queue.deleteMessages().withMatchHidden(true));
    List<Queue> queues=backend.execute(account.getQueues());
    seen=scanQueues(queues,queueIds);
    assertFalse(seen[0]);
  }
 catch (  CommandException ce) {
  }
}

Fixed version (ground truth):
/** 
 * Create a message, verify the queue exists, then delete all messages in the queue and verify it goes away.
 */
public void testGetQueuesDeleteMessages() throws BurrowException {
  String messageId="String_Node_Str";
  String messageBody="String_Node_Str";
  String queueIds[]={queue.getId()};
  boolean[] seen;
  backend.execute(queue.createMessage(messageId,messageBody));
  seen=scanQueues(backend.execute(account.getQueues()),queueIds);
  assertTrue(seen[0]);
  try {
    backend.execute(queue.deleteMessages().withMatchHidden(true));
    List<Queue> queues=backend.execute(account.getQueues());
    seen=scanQueues(queues,queueIds);
    assertFalse(seen[0]);
  }
 catch (  AccountNotFoundException e) {
  }
}
Program: 20145
Project: 20145
Buggy source:
/** 
 * Create then delete a message, then verify that a second delete fails.
 */
public void testCreateDeleteMessage() throws BurrowException {
  String id="String_Node_Str";
  String body="String_Node_Str";
  try {
    backend.execute(queue.createMessage(id,body));
    backend.execute(queue.deleteMessage(id));
  }
 catch (  CommandException ce) {
    fail("String_Node_Str");
  }
  try {
    backend.execute(queue.deleteMessage(id));
    fail("String_Node_Str");
  }
 catch (  CommandException ce) {
  }
}

Fixed version (ground truth):
/** 
 * Create then delete a message, then verify that a second delete fails.
 */
public void testCreateDeleteMessage() throws BurrowException {
  String id="String_Node_Str";
  String body="String_Node_Str";
  backend.execute(queue.createMessage(id,body));
  backend.execute(queue.deleteMessage(id));
  try {
    backend.execute(queue.deleteMessage(id));
    fail("String_Node_Str");
  }
 catch (  MessageNotFoundException e) {
  }
}
Program: 20146
Project: 20146
Buggy source:
/** 
 * Implicitly create two queues, then delete all queues on the account.
 */
public void testDeleteQueues() throws BurrowException {
  String messageId="String_Node_Str";
  String queueIds[]={"String_Node_Str","String_Node_Str"};
  Queue queues[]={account.Queue(queueIds[0]),account.Queue(queueIds[1])};
  String body="String_Node_Str";
  boolean[] seenQueues;
  try {
    backend.execute(queues[0].createMessage(messageId,body));
    backend.execute(queues[1].createMessage(messageId,body));
    seenQueues=scanQueues(backend.execute(account.getQueues()),queueIds);
    assertTrue(seenQueues[0]);
    assertTrue(seenQueues[1]);
    backend.execute(account.deleteQueues());
  }
 catch (  CommandException ce) {
    fail("String_Node_Str");
  }
  try {
    backend.execute(account.getQueues());
    fail("String_Node_Str");
  }
 catch (  CommandException e) {
  }
}

Fixed version (ground truth):
/** 
 * Implicitly create two queues, then delete all queues on the account.
 */
public void testDeleteQueues() throws BurrowException {
  String messageId="String_Node_Str";
  String queueIds[]={"String_Node_Str","String_Node_Str"};
  Queue queues[]={account.Queue(queueIds[0]),account.Queue(queueIds[1])};
  String body="String_Node_Str";
  boolean[] seenQueues;
  backend.execute(queues[0].createMessage(messageId,body));
  backend.execute(queues[1].createMessage(messageId,body));
  seenQueues=scanQueues(backend.execute(account.getQueues()),queueIds);
  assertTrue("String_Node_Str",seenQueues[0]);
  assertTrue("String_Node_Str",seenQueues[1]);
  backend.execute(account.deleteQueues());
  try {
    backend.execute(account.getQueues());
    fail("String_Node_Str");
  }
 catch (  AccountNotFoundException e) {
  }
}
Program: 20147
Project: 20147
Buggy source:
/** 
 * Create and delete a hidden message.
 */
public void testCreateDeleteMessageWithMatchHidden() throws BurrowException {
  String id="String_Node_Str";
  String body="String_Node_Str";
  try {
    backend.execute(queue.createMessage(id,body).withHide((100L)));
    backend.execute(queue.deleteMessage(id).withMatchHidden(true));
  }
 catch (  CommandException ce) {
    fail("String_Node_Str");
  }
  try {
    backend.execute(queue.deleteMessage(id).withMatchHidden(true));
    fail("String_Node_Str");
  }
 catch (  CommandException ce) {
  }
}

Fixed version (ground truth):
/** 
 * Create and delete a hidden message.
 */
public void testCreateDeleteMessageWithMatchHidden() throws BurrowException {
  String id="String_Node_Str";
  String body="String_Node_Str";
  backend.execute(queue.createMessage(id,body).withHide((100L)));
  backend.execute(queue.deleteMessage(id).withMatchHidden(true));
  try {
    backend.execute(queue.deleteMessage(id).withMatchHidden(true));
    fail("String_Node_Str");
  }
 catch (  MessageNotFoundException e) {
  }
}
Program: 20148
Project: 20148
Buggy source:
/** 
 * Get a message that does not exist.
 */
public void testGetAMessageThatDoesNotExist() throws BurrowException {
  String id="String_Node_Str";
  try {
    backend.execute(queue.getMessage(id));
    fail("String_Node_Str");
  }
 catch (  CommandException ce) {
  }
}

Fixed version (ground truth):
/** 
 * Get a message that does not exist.
 */
public void testGetAMessageThatDoesNotExist() throws BurrowException {
  String id="String_Node_Str";
  try {
    backend.execute(queue.getMessage(id));
    fail("String_Node_Str");
  }
 catch (  MessageNotFoundException e) {
  }
}
Program: 20149
Project: 20149
Buggy source:
synchronized List<Message> get(String marker,Long limit,Boolean matchHidden,Long wait){
  clean();
  List<Message> messages=new ArrayList<Message>();
  Iterator<Entry<String,MessageRecord>> iter;
  if (marker != null)   iter=queue.newIteratorFrom(marker);
 else   iter=queue.newIterator();
  if (limit == null)   limit=-1l;
  if (matchHidden == null)   matchHidden=false;
  while ((limit != 0) && (iter.hasNext())) {
    MessageRecord msg=iter.next().getValue();
    if (matchHidden || (msg.getHide() == 0)) {
      messages.add(msg);
      limit--;
    }
  }
  return messages;
}

Fixed version (ground truth):
synchronized List<Message> get(String marker,Long limit,Boolean matchHidden,Long wait,Long hide){
  clean();
  List<Message> messages=new ArrayList<Message>();
  Iterator<Entry<String,MessageRecord>> iter;
  if (marker != null)   iter=queue.newIteratorFrom(marker);
 else   iter=queue.newIterator();
  if (limit == null)   limit=-1l;
  if (matchHidden == null)   matchHidden=false;
  while ((limit != 0) && (iter.hasNext())) {
    MessageRecord msg=iter.next().getValue();
    if (matchHidden || (msg.getHide() == 0)) {
      messages.add(msg);
      if (hide != null)       msg.hide=limit--;
    }
  }
  return messages;
}
Program: 20150
Project: 20150
Buggy source:
public GetMessage withDetail(String detail){
  return new GetMessage(queue,id,matchHidden,detail,wait);
}

Fixed version (ground truth):
public GetMessage withDetail(String detail){
  return new GetMessage(queue,id,matchHidden,detail,wait,hide);
}
Program: 20151
Project: 20151
Buggy source:
public GetMessage withWait(long wait){
  return new GetMessage(queue,id,matchHidden,detail,wait);
}

Fixed version (ground truth):
public GetMessage withWait(long wait){
  return new GetMessage(queue,id,matchHidden,detail,wait,hide);
}
Program: 20152
Project: 20152
Buggy source:
public GetMessage withMatchHidden(boolean matchHidden){
  return new GetMessage(queue,id,matchHidden,detail,wait);
}

Fixed version (ground truth):
public GetMessage withMatchHidden(boolean matchHidden){
  return new GetMessage(queue,id,matchHidden,detail,wait,hide);
}
Program: 20153
Project: 20153
Buggy source:
private GetMessage(Queue queue,String id,Boolean matchHidden,String detail,Long wait){
  this.queue=queue;
  this.id=id;
  this.matchHidden=matchHidden;
  this.detail=detail;
  this.wait=wait;
}

Fixed version (ground truth):
private GetMessage(Queue queue,String id,Boolean matchHidden,String detail,Long wait,Long hide){
  this.queue=queue;
  this.id=id;
  this.matchHidden=matchHidden;
  this.detail=detail;
  this.wait=wait;
  this.hide=hide;
}
Program: 20155
Project: 20155
Buggy source:
/** 
 * Given a   {@link ValuedNodeSetList} that fails the verification tests,finds a minimal subset subset that still fails but none of its subsets fail. For debugging purposes only.
 */
public static ValuedNodeSetList getMinimalSubsetThatFails(ValuedNodeSetList nodeSets,SimilarityFunction<NodeSet> similarityFunc,double threshold){
  ValuedNodeSetList result;
  boolean changed=true;
  MultiPassNodeSetMerger merger=new MultiPassNodeSetMerger();
  merger.setDebugging(false);
  merger.setVerificationMode(VerificationMode.VERIFY);
  try {
    result=merger.mergeOverlapping(nodeSets,similarityFunc,threshold);
    return null;
  }
 catch (  RuntimeException ex) {
  }
  result=(ValuedNodeSetList)nodeSets.clone();
  while (changed && !result.isEmpty()) {
    Iterator<ValuedNodeSet> it;
    changed=false;
    it=result.iterator();
    while (it.hasNext()) {
      ValuedNodeSet nodeSet=it.next();
      boolean failing=false;
      ValuedNodeSetList nodeSetsCopy=(ValuedNodeSetList)result.clone();
      nodeSetsCopy.remove(nodeSet);
      try {
        merger.mergeOverlapping(nodeSetsCopy,similarityFunc,threshold);
      }
 catch (      RuntimeException ex) {
        failing=true;
      }
      if (failing) {
        it.remove();
        changed=true;
        break;
      }
    }
  }
  try {
    merger.mergeOverlapping(result,similarityFunc,threshold);
    System.err.println("String_Node_Str");
  }
 catch (  RuntimeException ex) {
    ex.printStackTrace();
    System.err.println("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Given a   {@link ValuedNodeSetList} that fails the verification tests,finds a minimal subset subset that still fails but none of its subsets fail. For debugging purposes only.
 */
public static ValuedNodeSetList getMinimalSubsetThatFails(ValuedNodeSetList nodeSets,SimilarityFunction<NodeSet> similarityFunc,double threshold){
  ValuedNodeSetList result;
  boolean changed=true;
  MultiPassNodeSetMerger merger=new MultiPassNodeSetMerger();
  merger.setDebugging(false);
  merger.setVerificationMode(VerificationMode.VERIFY);
  try {
    merger.mergeOverlapping(nodeSets,similarityFunc,threshold);
    return null;
  }
 catch (  RuntimeException ignored) {
  }
  result=(ValuedNodeSetList)nodeSets.clone();
  while (changed && !result.isEmpty()) {
    Iterator<ValuedNodeSet> it;
    changed=false;
    it=result.iterator();
    while (it.hasNext()) {
      ValuedNodeSet nodeSet=it.next();
      boolean failing=false;
      ValuedNodeSetList nodeSetsCopy=(ValuedNodeSetList)result.clone();
      nodeSetsCopy.remove(nodeSet);
      try {
        merger.mergeOverlapping(nodeSetsCopy,similarityFunc,threshold);
      }
 catch (      RuntimeException ex) {
        failing=true;
      }
      if (failing) {
        it.remove();
        changed=true;
        break;
      }
    }
  }
  try {
    merger.mergeOverlapping(result,similarityFunc,threshold);
    System.err.println("String_Node_Str");
  }
 catch (  RuntimeException ex) {
    ex.printStackTrace();
    System.err.println("String_Node_Str");
  }
  return result;
}
Program: 20156
Project: 20156
Buggy source:
/** 
 * Returns the global transitivity of the graph. Global transitivity is defined as three times the number of triangles (or, simply the number of closed triplets) divided by the number of connected triplets.
 * @return  the transitivity or null if the calculation was interrupted
 */
public Double getGlobalTransitivity(){
  long triangles=0;
  long triplets=0;
  int nodeCount=graph.getNodeCount();
  int i;
  shouldStop=false;
  for (i=0; i < nodeCount; i++) {
    if (shouldStop)     return null;
    int[] neis=graph.getAdjacentNodeIndicesArray(i,Directedness.ALL);
    for (    int j : neis) {
      if (j <= i)       continue;
      for (      int k : neis) {
        if (j < k && graph.areConnected(j,k))         triangles++;
      }
    }
    triplets+=(neis.length * (neis.length - 1)) / 2;
  }
  return (triplets == 0) ? 0 : (3.0 * triangles / triplets);
}

Fixed version (ground truth):
/** 
 * Returns the global transitivity of the graph. Global transitivity is defined as three times the number of triangles (or, simply the number of closed triplets) divided by the number of connected triplets.
 * @return  the transitivity or null if the calculation was interrupted
 */
public Double getGlobalTransitivity(){
  long triangles=0;
  long triplets=0;
  int nodeCount=graph.getNodeCount();
  int i;
  shouldStop=false;
  monitor.setPercentCompleted(0);
  for (i=0; i < nodeCount; i++) {
    if (shouldStop)     return null;
    int[] neis=graph.getAdjacentNodeIndicesArray(i,Directedness.ALL);
    for (    int j : neis) {
      if (j <= i)       continue;
      for (      int k : neis) {
        if (j < k && graph.areConnected(j,k))         triangles++;
      }
    }
    triplets+=(neis.length * (neis.length - 1)) / 2;
    monitor.setPercentCompleted((int)(i * 100.0 / nodeCount));
  }
  monitor.setPercentCompleted(100);
  return (triplets == 0) ? 0 : (3.0 * triangles / triplets);
}
Program: 20158
Project: 20158
Buggy source:
/** 
 * Reads a graph specified by an edge list representation from the given reader object.
 * @param reader  the reader being used
 */
public Graph readGraph(Reader reader) throws IOException {
  Graph result=new Graph();
  UniqueIDGenerator<String> nodeGen=new UniqueIDGenerator<String>(result);
  BufferedReader bufferedReader=new BufferedReader(reader);
  String line;
  String[] parts;
  int node1, node2;
  double weight;
  while ((line=bufferedReader.readLine()) != null) {
    if (line.length() == 0)     continue;
    if (line.charAt(0) == '#' || line.charAt(0) == '%')     continue;
    parts=line.split("String_Node_Str");
    if (parts.length == 1)     continue;
    node1=nodeGen.get(parts[0]);
    node2=nodeGen.get(parts[1]);
    if (parts.length >= 3)     weight=Double.parseDouble(parts[2]);
 else     weight=1.0;
    result.createEdge(node1,node2,weight);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Reads a graph specified by an edge list representation from the given reader object.
 * @param reader  the reader being used
 */
public Graph readGraph(Reader reader) throws IOException {
  Graph result=new Graph();
  UniqueIDGenerator<String> nodeGen=new UniqueIDGenerator<String>(result);
  BufferedReader bufferedReader=new BufferedReader(reader);
  String line;
  String[] parts;
  int node1, node2;
  double weight;
  while ((line=bufferedReader.readLine()) != null) {
    if (line.length() == 0)     continue;
    if (line.charAt(0) == '#' || line.charAt(0) == '%')     continue;
    parts=line.split("String_Node_Str");
    if (parts.length <= 1)     continue;
    node1=nodeGen.get(parts[0]);
    node2=nodeGen.get(parts[1]);
    if (parts.length >= 3)     weight=Double.parseDouble(parts[2]);
 else     weight=1.0;
    result.createEdge(node1,node2,weight);
  }
  return result;
}
Program: 20159
Project: 20159
Buggy source:
private void processLine(){
  currentNodeSet=new MutableNodeSet(graph);
  if (line == null && generateUnusedNodesAsSeeds) {
    Integer id=unusedNodes.pollFirst();
    if (id == null)     currentNodeSet=null;
 else     currentNodeSet.add(id);
    return;
  }
  boolean isConnected=false;
  while (!isConnected) {
    StringTokenizer st=new StringTokenizer(line);
    while (st.hasMoreTokens()) {
      String name=st.nextToken();
      int idx=namesToIndices.get(name);
      if (idx >= 0) {
        currentNodeSet.add(idx);
        unusedNodes.remove(idx);
      }
    }
    readNextLine();
    isConnected=currentNodeSet.size() > 0 && currentNodeSet.isConnected();
    if (!isConnected) {
      currentNodeSet.clear();
      if (line == null) {
        if (generateUnusedNodesAsSeeds) {
          Integer id=unusedNodes.pollFirst();
          currentNodeSet.add(id);
        }
 else         currentNodeSet=null;
        return;
      }
    }
  }
  if (isConnected)   return;
  currentNodeSet=null;
}

Fixed version (ground truth):
private void processLine(){
  currentNodeSet=new MutableNodeSet(graph);
  if (line == null) {
    if (generateUnusedNodesAsSeeds) {
      Integer id=unusedNodes.pollFirst();
      if (id == null)       currentNodeSet=null;
 else       currentNodeSet.add(id);
    }
 else {
      currentNodeSet=null;
    }
    return;
  }
  boolean isConnected=false;
  while (!isConnected) {
    StringTokenizer st=new StringTokenizer(line);
    while (st.hasMoreTokens()) {
      String name=st.nextToken();
      int idx=namesToIndices.get(name);
      if (idx >= 0) {
        currentNodeSet.add(idx);
        unusedNodes.remove(idx);
      }
    }
    readNextLine();
    isConnected=currentNodeSet.size() > 0 && currentNodeSet.isConnected();
    if (!isConnected) {
      currentNodeSet.clear();
      if (line == null) {
        if (generateUnusedNodesAsSeeds) {
          Integer id=unusedNodes.pollFirst();
          currentNodeSet.add(id);
        }
 else         currentNodeSet=null;
        return;
      }
    }
  }
  if (isConnected)   return;
  currentNodeSet=null;
}
Program: 20161
Project: 20161
Buggy source:
public int compareTo(NodeSetPair other){
  if (this.equals(other))   return 0;
  if (this.similarity < other.similarity)   return 1;
  if (this.similarity > other.similarity)   return -1;
  if (this.getLeft().equals(this.getRight()))   return 0;
  return System.identityHashCode(this.getLeft()) - System.identityHashCode(this.getRight());
}

Fixed version (ground truth):
public int compareTo(NodeSetPair other){
  if (this.equals(other))   return 0;
  if (this.similarity < other.similarity)   return 1;
  if (this.similarity > other.similarity)   return -1;
  return this.getLeft().compareTo(this.getRight());
}
Program: 20162
Project: 20162
Buggy source:
/** 
 * Obtains the algorithm parameters from the user using a standard ProCope dialog box
 * @return  the parameters
 */
protected ClusterONEAlgorithmParameters getAlgorithmParameters(){
  ClusterONEAlgorithmParametersDialog dialog=new ClusterONEAlgorithmParametersDialog();
  dialog.setLocationRelativeTo(null);
  if (!dialog.execute())   return null;
  return dialog.getParameters();
}

Fixed version (ground truth):
/** 
 * Obtains the algorithm parameters from the user using a standard ProCope dialog box
 * @return  the parameters
 */
protected ClusterONEAlgorithmParameters getAlgorithmParameters(){
  ClusterONEAlgorithmParametersDialog dialog=new ClusterONEAlgorithmParametersDialog();
  dialog.getParametersPanel().expandAll();
  dialog.pack();
  dialog.setLocationRelativeTo(null);
  if (!dialog.execute())   return null;
  return dialog.getParameters();
}
Program: 20164
Project: 20164
Buggy source:
@Override public Set<Multiset.Entry<E>> entrySet(){
  Set<Multiset.Entry<E>> result=new HashSet<Multiset.Entry<E>>();
  for (  Map.Entry<E,Integer> entry : data.entrySet())   result.add(new Entry(entry));
  return result;
}

Fixed version (ground truth):
public Set<Multiset.Entry<E>> entrySet(){
  Set<Multiset.Entry<E>> result=new HashSet<Multiset.Entry<E>>();
  for (  Map.Entry<E,Integer> entry : data.entrySet())   result.add(new Entry(entry));
  return result;
}
Program: 20165
Project: 20165
Buggy source:
@Override public int count(Object element){
  Integer count=data.get(element);
  if (count == null)   return 0;
  return count;
}

Fixed version (ground truth):
public int count(Object element){
  Integer count=data.get(element);
  if (count == null)   return 0;
  return count;
}
Program: 20166
Project: 20166
Buggy source:
@Override public Set<E> elementSet(){
  return data.keySet();
}

Fixed version (ground truth):
public Set<E> elementSet(){
  return data.keySet();
}
Program: 20167
Project: 20167
Buggy source:
@Override public int setCount(E element,int count){
  if (count < 0)   throw new IllegalArgumentException("String_Node_Str");
  int oldCount=this.count(element);
  if (count == 0)   data.remove(element);
 else   data.put(element,count);
  return oldCount;
}

Fixed version (ground truth):
public int setCount(E element,int count){
  if (count < 0)   throw new IllegalArgumentException("String_Node_Str");
  int oldCount=this.count(element);
  if (count == 0)   data.remove(element);
 else   data.put(element,count);
  return oldCount;
}
Program: 20169
Project: 20169
Buggy source:
/** 
 * Performs a haircut operation on the nodeset The haircut operation tries to eliminate vertices that connect only loosely to the rest of the nodeset. This is achieved by removing vertices whose internal weight is less than some percentage (e.g., 20%) of the average internal weight of the cluster.
 */
public void haircut(double threshold){
  if (this.size() == 0)   return;
  do {
    int minIdx=this.members.first();
    double minInWeight=this.inWeights[minIdx];
    double limit=2 * this.totalInternalEdgeWeight / this.size() * threshold;
    for (    int i : this.members) {
      if (this.inWeights[i] < minInWeight) {
        minInWeight=this.inWeights[i];
        minIdx=i;
      }
    }
    if (minInWeight < limit)     this.remove(minIdx);
 else     break;
  }
 while (true);
}

Fixed version (ground truth):
/** 
 * Performs a haircut operation on the nodeset The haircut operation tries to eliminate vertices that connect only loosely to the rest of the nodeset. This is achieved by removing vertices whose internal weight is less than some percentage (e.g., 20%) of the average internal weight of the cluster.
 */
public void haircut(double threshold){
  while (!this.members.isEmpty()) {
    int minIdx=this.members.first();
    double minInWeight=this.inWeights[minIdx];
    double limit=2 * this.totalInternalEdgeWeight / this.size() * threshold;
    for (    int i : this.members) {
      if (this.inWeights[i] < minInWeight) {
        minInWeight=this.inWeights[i];
        minIdx=i;
      }
    }
    if (minInWeight < limit)     this.remove(minIdx);
 else     break;
  }
}
Program: 20170
Project: 20170
Buggy source:
/** 
 * Prints the nodes in this set to a string
 */
public String toString(){
  StringArray names=new StringArray();
  for (  Integer member : this.members) {
    names.add(this.graph.getNodeName(member));
  }
  return StringUtils.join(names.iterator(),' ');
}

Fixed version (ground truth):
/** 
 * Prints the nodes in this set to a string
 */
public String toString(){
  return StringUtils.join(getMemberNames(),' ');
}
Program: 20172
Project: 20172
Buggy source:
@Override public Edge next(){
  Edge result=new Edge(this.graph,this.edgeIndex);
  this.edgeIndex++;
  return result;
}

Fixed version (ground truth):
public Edge next(){
  Edge result=new Edge(this.graph,this.edgeIndex);
  this.edgeIndex++;
  return result;
}
Program: 20173
Project: 20173
Buggy source:
@Override public boolean hasNext(){
  return this.edgeIndex < this.graph.getEdgeCount();
}

Fixed version (ground truth):
public boolean hasNext(){
  return this.edgeIndex < this.graph.getEdgeCount();
}
Program: 20174
Project: 20174
Buggy source:
@Override public void remove(){
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
public void remove(){
  throw new UnsupportedOperationException();
}
Program: 20175
Project: 20175
Buggy source:
@Override public Iterator<Edge> iterator(){
  return new EdgeIterator(this);
}

Fixed version (ground truth):
public Iterator<Edge> iterator(){
  return new EdgeIterator(this);
}
Program: 20176
Project: 20176
Buggy source:
public static boolean checkCC(String cardNumber){
  int sum=0;
  if (!StringUtils.isNumber(cardNumber)) {
    return false;
  }
  for (int i=0; i < cardNumber.length(); i++) {
    int k=Integer.parseInt(cardNumber.substring(i,i + 1));
    if (i % 2 == 0) {
      k*=2;
      if (k > 9) {
        k-=9;
      }
    }
    sum+=k;
  }
  return (sum % 10 == 0);
}

Fixed version (ground truth):
public static boolean checkCC(String cardNumber){
  int sum=0;
  int flip=0;
  if (!StringUtils.isNumber(cardNumber)) {
    return false;
  }
  for (int i=cardNumber.length() - 1; i >= 0; i--) {
    int k=Character.digit(cardNumber.charAt(i),10);
    flip++;
    if (flip % 2 == 0) {
      k*=2;
      if (k > 9) {
        k-=9;
      }
    }
    sum+=k;
  }
  return (sum % 10 == 0);
}
Program: 20177
Project: 20177
Buggy source:
public void readValues(DataRead dr) throws BasicException {
  m_sTicket=dr.getString(1);
  m_iLine=dr.getInt(2).intValue();
  productid=dr.getString(3);
  attsetinstid=dr.getString(4);
  multiply=dr.getDouble(5);
  price=dr.getDouble(6);
  tax=new TaxInfo(dr.getString(7),dr.getString(8),dr.getString(9),dr.getTimestamp(10),dr.getString(11),dr.getString(12),dr.getDouble(13),dr.getBoolean(14),dr.getInt(15));
  attributes=new Properties();
  try {
    byte[] img=dr.getBytes(15);
    if (img != null) {
      attributes.loadFromXML(new ByteArrayInputStream(img));
    }
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
public void readValues(DataRead dr) throws BasicException {
  m_sTicket=dr.getString(1);
  m_iLine=dr.getInt(2).intValue();
  productid=dr.getString(3);
  attsetinstid=dr.getString(4);
  multiply=dr.getDouble(5);
  price=dr.getDouble(6);
  tax=new TaxInfo(dr.getString(7),dr.getString(8),dr.getString(9),dr.getTimestamp(10),dr.getString(11),dr.getString(12),dr.getDouble(13),dr.getBoolean(14),dr.getInt(15));
  attributes=new Properties();
  try {
    byte[] img=dr.getBytes(16);
    if (img != null) {
      attributes.loadFromXML(new ByteArrayInputStream(img));
    }
  }
 catch (  IOException e) {
  }
}
Program: 20178
Project: 20178
Buggy source:
public String printName(){
  return m_sProdName;
}

Fixed version (ground truth):
public String printName(){
  return StringUtils.encodeXML(m_sProdName);
}
Program: 20179
Project: 20179
Buggy source:
public BigDecimal getTotalOfaTicket(String place){
  double total=0;
  for (  TicketLineInfo line : findTicket(place).getM_aLines()) {
    try {
      total+=line.getMultiply() * (line.getPrice() + line.getPrice() * line.getTax().getRate());
    }
 catch (    NullPointerException e) {
      total+=line.getMultiply() * line.getPrice();
    }
  }
  return BigDecimal.valueOf(total);
}

Fixed version (ground truth):
public BigDecimal getTotalOfaTicket(String place){
  double total=0;
  for (  TicketLineInfo line : findTicket(place).getM_aLines()) {
    total+=line.getMultiply() * line.getPrice();
  }
  return BigDecimal.valueOf(total);
}
Program: 20180
Project: 20180
Buggy source:
public void addLineToTicket(String ticketId,String productId){
  ticket=new TicketDAO();
  product=new ProductDAO();
  category=new CategoryDAO();
  tax=new TaxDAO();
  taxesLogic=new TaxesLogic(tax.getTaxList());
  TicketInfo obj=ticket.getTicket(ticketId);
  ProductInfo productObj=product.findProductById(productId);
  TicketLineInfo line=new TicketLineInfo(productObj,productObj.getPriceSell(),taxesLogic.getTaxInfo(productObj.getCategoryId()));
  obj.addLine(line);
  ticket.updateTicket(ticketId,obj);
  refreshTax(obj);
}

Fixed version (ground truth):
public void addLineToTicket(String ticketId,String productId){
  ticket=new TicketDAO();
  product=new ProductDAO();
  category=new CategoryDAO();
  tax=new TaxDAO();
  taxesLogic=new TaxesLogic(tax.getTaxList());
  TicketInfo obj=ticket.getTicket(ticketId);
  ProductInfo productObj=product.findProductById(productId);
  TicketLineInfo line=new TicketLineInfo(productObj,productObj.getPriceSell(),taxesLogic.getTaxInfo(productObj.getTaxcat()));
  obj.addLine(line);
  ticket.updateTicket(ticketId,obj);
  refreshTax(obj);
}
Program: 20181
Project: 20181
Buggy source:
public double getPrice(){
  return price;
}

Fixed version (ground truth):
public double getPrice(){
  try {
    return price + (price * getTax().getRate());
  }
 catch (  NullPointerException ex) {
    return price;
  }
}
Program: 20182
Project: 20182
Buggy source:
public double getValue(){
  return price * multiply;
}

Fixed version (ground truth):
public double getValue(){
  return getPrice() * multiply;
}
Program: 20183
Project: 20183
Buggy source:
public List<Place> findAllBusyTable(String floor){
  place=new PlaceDAO();
  return place.findAllBusyPlaceByFloor(floor);
}

Fixed version (ground truth):
public List<Place> findAllBusyTable(String floor){
  place=new PlaceDAO();
  return place.findAllBusyPlacesByFloor(floor);
}
Program: 20184
Project: 20184
Buggy source:
public String printHost(){
  return m_sHost;
}

Fixed version (ground truth):
public String printHost(){
  return StringUtils.encodeXML(m_sHost);
}
Program: 20186
Project: 20186
Buggy source:
void btnPrintActionPerformed(java.awt.event.ActionEvent evt){
  Thread thread=new Thread(new Runnable(){
    public void run(){
      try {
        btnPrint.setEnabled(false);
        JRViewer300.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        JasperPrintManager.printReport(jasperPrint,true);
      }
 catch (      Exception ex) {
        ex.printStackTrace();
        JOptionPane.showMessageDialog(JRViewer300.this,getBundleString("String_Node_Str"));
      }
 finally {
        JRViewer300.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        btnPrint.setEnabled(true);
      }
    }
  }
);
  thread.start();
}

Fixed version (ground truth):
void btnPrintActionPerformed(java.awt.event.ActionEvent evt){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      try {
        btnPrint.setEnabled(false);
        JRViewer300.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        JasperPrintManager.printReport(jasperPrint,true);
      }
 catch (      Exception ex) {
        ex.printStackTrace();
        JOptionPane.showMessageDialog(JRViewer300.this,getBundleString("String_Node_Str"));
      }
 finally {
        JRViewer300.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        btnPrint.setEnabled(true);
      }
    }
  }
);
}
Program: 20187
Project: 20187
Buggy source:
public void beginReceipt(){
  m_ticketcurrent=new BasicTicket();
}

Fixed version (ground truth):
public void beginReceipt(){
  m_ticketcurrent=new BasicTicketForScreen();
}
Program: 20188
Project: 20188
Buggy source:
public void printImage(BufferedImage image){
  PrintItem pi=new PrintItemImage(image,IMAGE_SCALE);
  m_aCommands.add(pi);
  m_iBodyHeight+=pi.getHeight();
}

Fixed version (ground truth):
public void printImage(BufferedImage image){
  PrintItem pi=new PrintItemImage(image,getImageScale());
  m_aCommands.add(pi);
  m_iBodyHeight+=pi.getHeight();
}
Program: 20189
Project: 20189
Buggy source:
public void printBarCode(String type,String position,String code){
  PrintItem pi=new PrintItemBarcode(type,position,code,IMAGE_SCALE);
  m_aCommands.add(pi);
  m_iBodyHeight+=pi.getHeight();
}

Fixed version (ground truth):
public void printBarCode(String type,String position,String code){
  PrintItem pi=new PrintItemBarcode(type,position,code,getImageScale());
  m_aCommands.add(pi);
  m_iBodyHeight+=pi.getHeight();
}
Program: 20190
Project: 20190
Buggy source:
public void beginLine(int iTextSize){
  pil=new PrintItemLine(iTextSize,BASEFONT,FONTHEIGHT);
}

Fixed version (ground truth):
public void beginLine(int iTextSize){
  pil=new PrintItemLine(iTextSize,getBaseFont(),getFontHeight());
}
Program: 20191
Project: 20191
Buggy source:
public String printReason(){
  return m_reason.toString();
}

Fixed version (ground truth):
public String printReason(){
  return StringUtils.encodeXML(m_reason.toString());
}
Program: 20192
Project: 20192
Buggy source:
public String printLocation(){
  return m_locationOri.toString();
}

Fixed version (ground truth):
public String printLocation(){
  return StringUtils.encodeXML(m_locationOri.toString());
}
Program: 20193
Project: 20193
Buggy source:
protected void internalWrite(byte[] data){
  try {
    if (m_out == null) {
      m_PortIdPrinter=CommPortIdentifier.getPortIdentifier(m_sPortPrinter);
      m_CommPortPrinter=m_PortIdPrinter.open("String_Node_Str",2000);
      m_out=m_CommPortPrinter.getOutputStream();
      if (m_PortIdPrinter.getPortType() == CommPortIdentifier.PORT_SERIAL) {
        ((SerialPort)m_CommPortPrinter).setSerialPortParams(9600,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
        ((SerialPort)m_CommPortPrinter).setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN);
      }
    }
    m_out.write(data);
  }
 catch (  NoSuchPortException e) {
    System.err.println(e);
  }
catch (  PortInUseException e) {
    System.err.println(e);
  }
catch (  UnsupportedCommOperationException e) {
    System.err.println(e);
  }
catch (  IOException e) {
    System.err.println(e);
  }
}

Fixed version (ground truth):
protected void internalWrite(byte[] data){
  try {
    if (m_out == null) {
      m_PortIdPrinter=CommPortIdentifier.getPortIdentifier(m_sPortPrinter);
      m_CommPortPrinter=m_PortIdPrinter.open("String_Node_Str",2000);
      m_out=m_CommPortPrinter.getOutputStream();
      if (m_PortIdPrinter.getPortType() == CommPortIdentifier.PORT_SERIAL) {
        ((SerialPort)m_CommPortPrinter).setSerialPortParams(9600,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
      }
    }
    m_out.write(data);
  }
 catch (  NoSuchPortException e) {
    System.err.println(e);
  }
catch (  PortInUseException e) {
    System.err.println(e);
  }
catch (  UnsupportedCommOperationException e) {
    System.err.println(e);
  }
catch (  IOException e) {
    System.err.println(e);
  }
}
Program: 20194
Project: 20194
Buggy source:
protected Connection getConnection() throws Exception {
  try {
    Class.forName(properties.getDriverName());
    return DriverManager.getConnection(properties.getUrl(),properties.getDBUser(),properties.getDBPassword());
  }
 catch (  SQLException sqlex) {
    sqlex.printStackTrace();
  }
catch (  Exception ex) {
    ex.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
protected Connection getConnection() throws Exception {
  try {
    Class.forName(properties.getDriverName());
    boolean ju=isPostgre();
    return DriverManager.getConnection(properties.getUrl(),properties.getDBUser(),properties.getDBPassword());
  }
 catch (  SQLException sqlex) {
    sqlex.printStackTrace();
  }
catch (  Exception ex) {
    ex.printStackTrace();
  }
  return null;
}
Program: 20195
Project: 20195
Buggy source:
public List<ProductInfo> findProductsByCategory(String categoryId){
  Connection con=null;
  PreparedStatement ps=null;
  ResultSet rs=null;
  List<ProductInfo> vos=null;
  String sqlStr="String_Node_Str" + "String_Node_Str";
  try {
    con=getConnection();
    ps=con.prepareStatement(sqlStr);
    ps.setString(1,categoryId);
    rs=ps.executeQuery();
    vos=transformSet(rs);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      if (ps != null) {
        ps.close();
      }
      if (con != null) {
        con.close();
      }
    }
 catch (    SQLException sqlee) {
      sqlee.printStackTrace();
    }
  }
  return vos;
}

Fixed version (ground truth):
public List<ProductInfo> findProductsByCategory(String categoryId){
  Connection con=null;
  PreparedStatement ps=null;
  ResultSet rs=null;
  List<ProductInfo> vos=null;
  String sqlStr=isPostgre() ? "String_Node_Str" + "String_Node_Str" : "String_Node_Str" + "String_Node_Str";
  try {
    con=getConnection();
    ps=con.prepareStatement(sqlStr);
    ps.setString(1,categoryId);
    rs=ps.executeQuery();
    vos=transformSet(rs);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      if (ps != null) {
        ps.close();
      }
      if (con != null) {
        con.close();
      }
    }
 catch (    SQLException sqlee) {
      sqlee.printStackTrace();
    }
  }
  return vos;
}
Program: 20196
Project: 20196
Buggy source:
protected void paintComponent(Graphics g){
  paintBorder(g);
  Graphics2D g2d=(Graphics2D)g;
  Insets i=getInsets();
  g2d.setPaint(new GradientPaint(getWidth() - i.left - i.right- 100,getHeight() - i.top - i.bottom- 100,getBackground(),getWidth() - i.left - i.right,getHeight() - i.top - i.bottom,new Color(0xf0f0f0),true));
  g2d.fillRect(i.left,i.top,getWidth() - i.left - i.right,getHeight() - i.top - i.bottom);
  g.setColor(getForeground());
  basict.draw(g2d,i.left + H_GAP,i.top + V_GAP,LINEWIDTH);
}

Fixed version (ground truth):
protected void paintComponent(Graphics g){
  paintBorder(g);
  Graphics2D g2d=(Graphics2D)g;
  if (desktophints != null) {
    g2d.addRenderingHints(desktophints);
  }
  Insets i=getInsets();
  g2d.setPaint(new GradientPaint(getWidth() - i.left - i.right- 100,getHeight() - i.top - i.bottom- 100,getBackground(),getWidth() - i.left - i.right,getHeight() - i.top - i.bottom,new Color(0xf0f0f0),true));
  g2d.fillRect(i.left,i.top,getWidth() - i.left - i.right,getHeight() - i.top - i.bottom);
  g.setColor(getForeground());
  basict.draw(g2d,i.left + H_GAP,i.top + V_GAP,LINEWIDTH);
}
Program: 20197
Project: 20197
Buggy source:
/** 
 * Creates new form JTicket 
 */
public JTicket(BasicTicket t){
  basict=t;
  initComponents();
}

Fixed version (ground truth):
/** 
 * Creates new form JTicket 
 */
public JTicket(BasicTicket t){
  basict=t;
  desktophints=(Map)Toolkit.getDefaultToolkit().getDesktopProperty("String_Node_Str");
  initComponents();
}
Program: 20198
Project: 20198
Buggy source:
public UserInfo findUser(String login,String password){
  Connection con=null;
  PreparedStatement ps=null;
  ResultSet rs=null;
  UserInfo user=null;
  String sqlStr="String_Node_Str";
  try {
    con=getConnection();
    ps=con.prepareStatement(sqlStr);
    ps.setString(1,login);
    ps.setString(2,StringUtils.hashString(password));
    rs=ps.executeQuery();
    user=map2VO(rs);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      if (ps != null) {
        ps.close();
      }
      if (con != null) {
        con.close();
      }
    }
 catch (    SQLException sqlee) {
      sqlee.printStackTrace();
    }
  }
  return user;
}

Fixed version (ground truth):
public UserInfo findUser(String login,String password){
  Connection con=null;
  PreparedStatement ps=null;
  ResultSet rs=null;
  UserInfo user=null;
  String sqlStr="String_Node_Str";
  try {
    con=getConnection();
    ps=con.prepareStatement(sqlStr);
    ps.setString(1,login);
    if (password.equals("String_Node_Str")) {
      ps.setString(2,null);
    }
 else {
      ps.setString(2,StringUtils.hashString(password));
    }
    rs=ps.executeQuery();
    user=map2VO(rs);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      if (ps != null) {
        ps.close();
      }
      if (con != null) {
        con.close();
      }
    }
 catch (    SQLException sqlee) {
      sqlee.printStackTrace();
    }
  }
  return user;
}
Program: 20199
Project: 20199
Buggy source:
public String printCardNumber(){
  if (m_sCardNumber.length() > 4) {
    return "String_Node_Str" + m_sCardNumber.substring(m_sCardNumber.length() - 4);
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
public String printCardNumber(){
  if (m_sCardNumber.length() > 4) {
    return m_sCardNumber.substring(0,m_sCardNumber.length() - 4).replaceAll("String_Node_Str","String_Node_Str") + m_sCardNumber.substring(m_sCardNumber.length() - 4);
  }
 else {
    return "String_Node_Str";
  }
}
Program: 20200
Project: 20200
Buggy source:
private String formatDouble(Double dvalue){
  String sNumber=dvalue.toString();
  if (sNumber.endsWith("String_Node_Str")) {
    sNumber=sNumber.substring(0,sNumber.length() - 2);
  }
  return sNumber;
}

Fixed version (ground truth):
private String formatDouble(Double value){
  String sNumber=Double.toString(DoubleUtils.fixDecimals(value));
  if (sNumber.endsWith("String_Node_Str")) {
    sNumber=sNumber.substring(0,sNumber.length() - 2);
  }
  return sNumber;
}
Program: 20201
Project: 20201
Buggy source:
public void writeValues(DataWrite dp) throws BasicException {
  dp.setString(1,m_sTicket);
  dp.setInt(2,new Integer(m_iLine));
  dp.setString(3,productid);
  dp.setDouble(4,new Double(multiply));
  dp.setDouble(5,new Double(price));
  dp.setString(6,tax.getId());
  try {
    ByteArrayOutputStream o=new ByteArrayOutputStream();
    attributes.storeToXML(o,AppLocal.APP_NAME,"String_Node_Str");
    dp.setBytes(7,o.toByteArray());
  }
 catch (  IOException e) {
    dp.setBytes(7,null);
  }
}

Fixed version (ground truth):
public void writeValues(DataWrite dp) throws BasicException {
  dp.setString(1,m_sTicket);
  dp.setInt(2,new Integer(m_iLine));
  dp.setString(3,productid);
  dp.setString(4,attsetinstid);
  dp.setDouble(5,new Double(multiply));
  dp.setDouble(6,new Double(price));
  dp.setString(7,tax.getId());
  try {
    ByteArrayOutputStream o=new ByteArrayOutputStream();
    attributes.storeToXML(o,AppLocal.APP_NAME,"String_Node_Str");
    dp.setBytes(8,o.toByteArray());
  }
 catch (  IOException e) {
    dp.setBytes(8,null);
  }
}
Program: 20202
Project: 20202
Buggy source:
public void readValues(DataRead dr) throws BasicException {
  m_sTicket=dr.getString(1);
  m_iLine=dr.getInt(2).intValue();
  productid=dr.getString(3);
  multiply=dr.getDouble(4);
  price=dr.getDouble(5);
  tax=new TaxInfo(dr.getString(6),dr.getString(7),dr.getString(8),dr.getString(9),dr.getString(10),dr.getDouble(11),dr.getBoolean(12),dr.getInt(13));
  attributes=new Properties();
  try {
    byte[] img=dr.getBytes(14);
    if (img != null) {
      attributes.loadFromXML(new ByteArrayInputStream(img));
    }
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
public void readValues(DataRead dr) throws BasicException {
  m_sTicket=dr.getString(1);
  m_iLine=dr.getInt(2).intValue();
  productid=dr.getString(3);
  attsetinstid=dr.getString(4);
  multiply=dr.getDouble(5);
  price=dr.getDouble(6);
  tax=new TaxInfo(dr.getString(7),dr.getString(8),dr.getString(9),dr.getString(10),dr.getString(11),dr.getDouble(12),dr.getBoolean(13),dr.getInt(14));
  attributes=new Properties();
  try {
    byte[] img=dr.getBytes(15);
    if (img != null) {
      attributes.loadFromXML(new ByteArrayInputStream(img));
    }
  }
 catch (  IOException e) {
  }
}
Program: 20205
Project: 20205
Buggy source:
/** 
 * This is the action called from the Struts framework.
 * @param mapping The ActionMapping used to select this instance.
 * @param form The optional ActionForm bean for this request.
 * @param request The HTTP Request we are processing.
 * @param response The HTTP Response we are processing.
 * @throws java.lang.Exception
 * @return
 */
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  DynaActionForm inputFormPlace=(DynaActionForm)form;
  RestaurantManager manager=new RestaurantManager();
  List<CategoryInfo> categories=new ArrayList<CategoryInfo>();
  categories=manager.findAllCategories();
  List products=new ArrayList<ProductInfoExt>();
  products=manager.findProductsByCategory(categories.get(0).getId());
  List subcategories=new ArrayList<CategoryInfo>();
  subcategories=manager.findAllSubcategories(categories.get(0).getId());
  request.setAttribute("String_Node_Str",products);
  request.getSession().setAttribute("String_Node_Str",(String)inputFormPlace.get("String_Node_Str"));
  request.setAttribute("String_Node_Str",manager.findPlaceNameById((String)inputFormPlace.get("String_Node_Str")));
  request.setAttribute("String_Node_Str",categories);
  request.setAttribute("String_Node_Str",request.getAttribute("String_Node_Str"));
  request.setAttribute("String_Node_Str",subcategories);
  return mapping.findForward(SUCCESS);
}

Fixed version (ground truth):
/** 
 * This is the action called from the Struts framework.
 * @param mapping The ActionMapping used to select this instance.
 * @param form The optional ActionForm bean for this request.
 * @param request The HTTP Request we are processing.
 * @param response The HTTP Response we are processing.
 * @throws java.lang.Exception
 * @return
 */
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  DynaActionForm inputFormPlace=(DynaActionForm)form;
  RestaurantManager manager=new RestaurantManager();
  List<CategoryInfo> categories=new ArrayList<CategoryInfo>();
  categories=manager.findAllCategories();
  List products=new ArrayList<ProductInfoExt>();
  products=manager.findProductsByCategory(categories.get(0).getId());
  List subcategories=new ArrayList<CategoryInfo>();
  subcategories=manager.findAllSubcategories(categories.get(0).getId());
  request.setAttribute("String_Node_Str",products);
  request.getSession().setAttribute("String_Node_Str",(String)inputFormPlace.get("String_Node_Str"));
  request.setAttribute("String_Node_Str",manager.findPlaceNameById((String)inputFormPlace.get("String_Node_Str")));
  request.setAttribute("String_Node_Str",categories);
  request.getSession().setAttribute("String_Node_Str",(String)inputFormPlace.get("String_Node_Str"));
  return mapping.findForward(SUCCESS);
}