nus-yam/ex-repair huggingface dataset:
Program: 10220
Project: 10220
Buggy source:
public static String getMonitorPrefix(Class clazz){
  String retval="String_Node_Str";
  if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == Cache.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == Cache.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == ExampleBasedROLComponent.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else {
    retval="String_Node_Str";
  }
  return retval + clazz.getSimpleName() + "String_Node_Str";
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static String getMonitorPrefix(Class clazz){
  String retval="String_Node_Str";
  if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == Cache.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == Cache.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == ExampleBasedROLComponent.class) {
    retval="String_Node_Str";
  }
 else   if (clazz == SparqlQuery.class) {
    retval="String_Node_Str";
  }
 else {
    retval="String_Node_Str";
  }
  return retval + clazz.getSimpleName() + "String_Node_Str";
}
Program: 10221
Project: 10221
Buggy source:
@Deprecated public void initDBpediaSKOS(String concept,double percent,boolean useRelated,boolean useParallelClasses){
  SortedSet<String> keepForClean=new TreeSet<String>();
  keepForClean.addAll(this.posExamples);
  totalSKOSset.addAll(this.posExamples);
  rest.addAll(totalSKOSset);
  int poslimit=(int)Math.round(percent * totalSKOSset.size());
  int neglimit=(int)Math.round(poslimit);
  this.posExamples=SetManipulation.fuzzyShrink(this.posExamples,poslimit);
  rest.removeAll(this.posExamples);
  logger.debug("String_Node_Str" + posExamples.size());
  logger.debug("String_Node_Str" + totalSKOSset.size());
  logger.debug("String_Node_Str" + rest.size());
  if (useRelated) {
  }
  if (useParallelClasses) {
    int limit=this.posExamples.size();
  }
  negExamples.removeAll(keepForClean);
  logger.debug("String_Node_Str" + negExamples.size());
  this.negExamples=SetManipulation.fuzzyShrink(negExamples,neglimit);
  logger.debug("String_Node_Str" + posExamples.size());
  logger.debug("String_Node_Str" + negExamples.size());
  logger.debug("String_Node_Str" + concept);
}

Fixed version (ground truth):
@Deprecated public void initDBpediaSKOS(String concept,double percent,boolean useRelated,boolean useParallelClasses){
  SortedSet<String> keepForClean=new TreeSet<String>();
  keepForClean.addAll(this.posExamples);
  totalSKOSset.addAll(this.posExamples);
  rest.addAll(totalSKOSset);
  int poslimit=(int)Math.round(percent * totalSKOSset.size());
  int neglimit=(int)Math.round(poslimit);
  this.posExamples=SetManipulation.fuzzyShrink(this.posExamples,poslimit);
  rest.removeAll(this.posExamples);
  logger.debug("String_Node_Str" + posExamples.size());
  logger.debug("String_Node_Str" + totalSKOSset.size());
  logger.debug("String_Node_Str" + rest.size());
  if (useRelated) {
  }
  if (useParallelClasses) {
  }
  negExamples.removeAll(keepForClean);
  logger.debug("String_Node_Str" + negExamples.size());
  this.negExamples=SetManipulation.fuzzyShrink(negExamples,neglimit);
  logger.debug("String_Node_Str" + posExamples.size());
  logger.debug("String_Node_Str" + negExamples.size());
  logger.debug("String_Node_Str" + concept);
}
Program: 10222
Project: 10222
Buggy source:
public void printBestSolutions(int nrOfSolutions){
  if (!logger.getLevel().toString().equalsIgnoreCase("String_Node_Str"))   return;
  if (nrOfSolutions == 0)   nrOfSolutions=candidatesStable.size();
  int i=0;
  for (  ExampleBasedNode n : candidatesStable.descendingSet()) {
    logger.trace(n.getShortDescription(nrOfPositiveExamples,nrOfNegativeExamples,baseURI));
    if (i == nrOfSolutions)     return;
    i++;
  }
}

Fixed version (ground truth):
public void printBestSolutions(int nrOfSolutions){
  if (!logger.isTraceEnabled())   return;
  if (nrOfSolutions == 0)   nrOfSolutions=candidatesStable.size();
  int i=0;
  for (  ExampleBasedNode n : candidatesStable.descendingSet()) {
    logger.trace(n.getShortDescription(nrOfPositiveExamples,nrOfNegativeExamples,baseURI));
    if (i == nrOfSolutions)     return;
    i++;
  }
}
Program: 10225
Project: 10225
Buggy source:
@Override public void valueChanged(ListSelectionEvent e){
  if (!e.getValueIsAdjusting())   System.out.println(panel4.getResultList().getSelectedValue());
}

Fixed version (ground truth):
public void valueChanged(ListSelectionEvent e){
  if (!e.getValueIsAdjusting())   System.out.println(panel4.getResultList().getSelectedValue());
}
Program: 10231
Project: 10231
Buggy source:
public RhoDRDown(ReasoningService reasoningService,boolean applyAllFilter,boolean applyExistsFilter,boolean useAllConstructor,boolean useExistsConstructor,boolean useNegation,boolean useBooleanDatatypes,NamedClass startClass){
  this.rs=reasoningService;
  this.applyAllFilter=applyAllFilter;
  this.applyExistsFilter=applyExistsFilter;
  this.useAllConstructor=useAllConstructor;
  this.useExistsConstructor=useExistsConstructor;
  this.useNegation=useNegation;
  this.useBooleanDatatypes=useBooleanDatatypes;
  subHierarchy=rs.getSubsumptionHierarchy();
  for (  ObjectProperty op : rs.getAtomicRoles()) {
    opDomains.put(op,rs.getDomain(op));
    opRanges.put(op,rs.getRange(op));
  }
  for (  DatatypeProperty dp : rs.getDatatypeProperties()) {
    dpDomains.put(dp,rs.getDomain(dp));
  }
  for (  DatatypeProperty dp : rs.getDoubleDatatypeProperties()) {
    computeSplits(dp);
  }
  for (  ObjectProperty op : rs.getAtomicRoles()) {
    int maxFillers=0;
    Map<Individual,SortedSet<Individual>> opMembers=rs.getRoleMembers(op);
    for (    SortedSet<Individual> inds : opMembers.values()) {
      if (inds.size() > maxFillers)       maxFillers=inds.size();
    }
    maxNrOfFillers.put(op,maxFillers);
  }
  if (startClass != null)   this.startClass=startClass;
}

Fixed version (ground truth):
public RhoDRDown(ReasoningService reasoningService,boolean applyAllFilter,boolean applyExistsFilter,boolean useAllConstructor,boolean useExistsConstructor,boolean useNegation,boolean useBooleanDatatypes,NamedClass startClass){
  this.rs=reasoningService;
  this.applyAllFilter=applyAllFilter;
  this.applyExistsFilter=applyExistsFilter;
  this.useAllConstructor=useAllConstructor;
  this.useExistsConstructor=useExistsConstructor;
  this.useNegation=useNegation;
  this.useBooleanDatatypes=useBooleanDatatypes;
  subHierarchy=rs.getSubsumptionHierarchy();
  for (  ObjectProperty op : rs.getAtomicRoles()) {
    opDomains.put(op,rs.getDomain(op));
    opRanges.put(op,rs.getRange(op));
  }
  for (  DatatypeProperty dp : rs.getDatatypeProperties()) {
    dpDomains.put(dp,rs.getDomain(dp));
  }
  for (  DatatypeProperty dp : rs.getDoubleDatatypeProperties()) {
    computeSplits(dp);
  }
  if (useCardinalityRestrictions) {
    for (    ObjectProperty op : rs.getAtomicRoles()) {
      int maxFillers=0;
      Map<Individual,SortedSet<Individual>> opMembers=rs.getRoleMembers(op);
      for (      SortedSet<Individual> inds : opMembers.values()) {
        if (inds.size() > maxFillers)         maxFillers=inds.size();
        if (maxFillers >= cardinalityLimit) {
          maxFillers=cardinalityLimit;
          break;
        }
      }
      maxNrOfFillers.put(op,maxFillers);
    }
  }
  if (startClass != null)   this.startClass=startClass;
}
Program: 10235
Project: 10235
Buggy source:
private void computeM(NamedClass nc){
  long mComputationTimeStartNs=System.nanoTime();
  mA.put(nc,new TreeMap<Integer,SortedSet<Description>>());
  for (int i=1; i <= mMaxLength; i++) {
    mA.get(nc).put(i,new TreeSet<Description>(conceptComparator));
  }
  SortedSet<Description> m1=rs.getMoreSpecialConcepts(nc);
  mA.get(nc).put(1,m1);
  if (useNegation) {
    SortedSet<Description> m2tmp=rs.getMoreGeneralConcepts(new Nothing());
    SortedSet<Description> m2=new TreeSet<Description>(conceptComparator);
    for (    Description c : m2tmp) {
      if (c instanceof Thing)       m2.add(c);
 else {
        NamedClass a=(NamedClass)c;
        if (!isNotADisjoint(a,nc) && isNotAMeaningful(a,nc))         m2.add(new Negation(a));
      }
    }
    mA.get(nc).put(2,m2);
  }
  computeMg(nc);
  SortedSet<Description> m3=new TreeSet<Description>(conceptComparator);
  if (useExistsConstructor) {
    for (    ObjectProperty r : mgr.get(nc)) {
      m3.add(new ObjectSomeRestriction(r,new Thing()));
    }
  }
  if (useAllConstructor) {
    for (    ObjectProperty r : mgr.get(nc)) {
      m3.add(new ObjectAllRestriction(r,new Thing()));
    }
  }
  if (useBooleanDatatypes) {
    Set<DatatypeProperty> booleanDPs=mgbd.get(nc);
    for (    DatatypeProperty dp : booleanDPs) {
      m3.add(new BooleanValueRestriction(dp,true));
      m3.add(new BooleanValueRestriction(dp,false));
    }
  }
  mA.get(nc).put(3,m3);
  mComputationTimeNs+=System.nanoTime() - mComputationTimeStartNs;
}

Fixed version (ground truth):
private void computeM(NamedClass nc){
  long mComputationTimeStartNs=System.nanoTime();
  mA.put(nc,new TreeMap<Integer,SortedSet<Description>>());
  for (int i=1; i <= mMaxLength; i++) {
    mA.get(nc).put(i,new TreeSet<Description>(conceptComparator));
  }
  SortedSet<Description> m1=rs.getMoreSpecialConcepts(nc);
  mA.get(nc).put(1,m1);
  SortedSet<Description> m2=new TreeSet<Description>(conceptComparator);
  if (useNegation) {
    SortedSet<Description> m2tmp=rs.getMoreGeneralConcepts(new Nothing());
    for (    Description c : m2tmp) {
      if (c instanceof Thing)       m2.add(c);
 else {
        NamedClass a=(NamedClass)c;
        if (!isNotADisjoint(a,nc) && isNotAMeaningful(a,nc))         m2.add(new Negation(a));
      }
    }
  }
  computeMg(nc);
  if (useBooleanDatatypes) {
    Set<DatatypeProperty> booleanDPs=mgbd.get(nc);
    for (    DatatypeProperty dp : booleanDPs) {
      m2.add(new BooleanValueRestriction(dp,true));
      m2.add(new BooleanValueRestriction(dp,false));
    }
  }
  mA.get(nc).put(2,m2);
  SortedSet<Description> m3=new TreeSet<Description>(conceptComparator);
  if (useExistsConstructor) {
    for (    ObjectProperty r : mgr.get(nc)) {
      m3.add(new ObjectSomeRestriction(r,new Thing()));
    }
  }
  if (useAllConstructor) {
    for (    ObjectProperty r : mgr.get(nc)) {
      m3.add(new ObjectAllRestriction(r,new Thing()));
    }
  }
  mA.get(nc).put(3,m3);
  mComputationTimeNs+=System.nanoTime() - mComputationTimeStartNs;
}
Program: 10236
Project: 10236
Buggy source:
/** 
 * Takes a SPARQL query (which has not been evaluated yet) as argument and returns a result set. The result set is taken from this cache if the query is stored here. Otherwise the query is send and its result added to the cache and returned. Convenience method.
 * @param query The SPARQL query.
 * @return Jena result set.
 */
public ResultSet executeSparqlQuery(SparqlQuery query){
  String result=getCacheEntry(query.getQueryString());
  if (result != null) {
    return SparqlQuery.JSONtoResultSet(result);
  }
 else {
    query.send();
    ResultSet rs=query.getResultSet();
    if (rs != null) {
      String json=SparqlQuery.getAsJSON(rs);
      addToCache(query.getQueryString(),json);
      return SparqlQuery.JSONtoResultSet(json);
    }
    return rs;
  }
}

Fixed version (ground truth):
/** 
 * Takes a SPARQL query (which has not been evaluated yet) as argument and returns a result set. The result set is taken from this cache if the query is stored here. Otherwise the query is send and its result added to the cache and returned. Convenience method.
 * @param query The SPARQL query.
 * @return Jena result set.
 */
public String executeSparqlQuery(SparqlQuery query){
  String result=getCacheEntry(query.getQueryString());
  if (result != null) {
    return result;
  }
 else {
    query.send();
    String json=query.getResult();
    if (json != null) {
      addToCache(query.getQueryString(),json);
    }
 else     json="String_Node_Str";
    return json;
  }
}
Program: 10237
Project: 10237
Buggy source:
public boolean hasCompleted(){
  return (rs != null);
}

Fixed version (ground truth):
public boolean hasCompleted(){
  return (json != null);
}
Program: 10238
Project: 10238
Buggy source:
/** 
 * Sends a SPARQL query using the Jena library.
 */
public ResultSet send(){
  isRunning=true;
  logger.info(queryString);
  String service=endpoint.getURL().toString();
  logger.info(endpoint.getURL().toString());
  queryExecution=new QueryEngineHTTP(service,queryString);
  for (  String dgu : endpoint.getDefaultGraphURIs()) {
    queryExecution.addDefaultGraph(dgu);
  }
  for (  String ngu : endpoint.getNamedGraphURIs()) {
    queryExecution.addNamedGraph(ngu);
  }
  logger.info("String_Node_Str");
  try {
    HttpQuery.urlLimit=3 * 1024;
    rs=queryExecution.execSelect();
    logger.info(rs.getResultVars().toString());
  }
 catch (  Exception e) {
    sendException=new SparqlQueryException(e.getMessage());
    logger.info("String_Node_Str");
  }
  isRunning=false;
  return rs;
}

Fixed version (ground truth):
/** 
 * Sends a SPARQL query using the Jena library.
 */
public ResultSet send(){
  isRunning=true;
  ResultSet rs=null;
  logger.info(queryString);
  String service=endpoint.getURL().toString();
  logger.info(endpoint.getURL().toString());
  queryExecution=new QueryEngineHTTP(service,queryString);
  for (  String dgu : endpoint.getDefaultGraphURIs()) {
    queryExecution.addDefaultGraph(dgu);
  }
  for (  String ngu : endpoint.getNamedGraphURIs()) {
    queryExecution.addNamedGraph(ngu);
  }
  logger.info("String_Node_Str");
  try {
    HttpQuery.urlLimit=3 * 1024;
    rs=queryExecution.execSelect();
    json=SparqlQuery.getAsJSON(rs);
    logger.info(rs.getResultVars().toString());
  }
 catch (  Exception e) {
    sendException=new SparqlQueryException(e.getMessage());
    logger.info("String_Node_Str");
  }
  isRunning=false;
  return rs;
}
Program: 10239
Project: 10239
Buggy source:
public SparqlQueryThreaded(Cache cache,SparqlQuery query){
  this.cache=cache;
  this.query=query;
}

Fixed version (ground truth):
public SparqlQueryThreaded(Cache cache,SparqlQuery query){
  this.cache=cache;
  this.query=query;
  this.result=null;
}
Program: 10240
Project: 10240
Buggy source:
public void stop(){
  query.getExecution().abort();
  isRunning=false;
}

Fixed version (ground truth):
public void stop(){
  query.getExecution().abort();
  result=null;
}
Program: 10241
Project: 10241
Buggy source:
public boolean isRunning(){
  return isRunning;
}

Fixed version (ground truth):
public boolean isRunning(){
  return result == null;
}
Program: 10242
Project: 10242
Buggy source:
public ResultSet getResult(){
  return result;
}

Fixed version (ground truth):
public String getResult(){
  return result;
}
Program: 10243
Project: 10243
Buggy source:
public void send(){
  isRunning=true;
  result=cache.executeSparqlQuery(query);
  isRunning=false;
}

Fixed version (ground truth):
public void send(){
  result=cache.executeSparqlQuery(query);
}
Program: 10244
Project: 10244
Buggy source:
/** 
 * uses a cache and gets the result tuples for a resource u
 * @param uri the resource
 * @param sparqlQueryString
 * @param a the name of the first bound variable for xml parsing, normally predicate
 * @param b the name of the second bound variable for xml parsing, normally object
 * @return
 */
@SuppressWarnings({"String_Node_Str"}) public Set<StringTuple> getTupelForResource(URI uri){
  Set<StringTuple> s=new HashSet<StringTuple>();
  String a="String_Node_Str";
  String b="String_Node_Str";
  String sparqlQueryString=sparqlQueryMaker.makeSubjectQueryUsingFilters(uri.toString());
  SparqlQuery query=new SparqlQuery(sparqlQueryString,configuration.getSparqlEndpoint());
  ResultSet rs=cache.executeSparqlQuery(query);
  List<ResultBinding> l=ResultSetFormatter.toList(rs);
  p(l.toString());
  for (  ResultBinding resultBinding : l) {
    s.add(new StringTuple(resultBinding.get(a).toString(),resultBinding.get(b).toString()));
  }
  return s;
}

Fixed version (ground truth):
/** 
 * uses a cache and gets the result tuples for a resource u
 * @param uri the resource
 * @param sparqlQueryString
 * @param a the name of the first bound variable for xml parsing, normally predicate
 * @param b the name of the second bound variable for xml parsing, normally object
 * @return
 */
@SuppressWarnings({"String_Node_Str"}) public Set<StringTuple> getTupelForResource(URI uri){
  Set<StringTuple> s=new HashSet<StringTuple>();
  String a="String_Node_Str";
  String b="String_Node_Str";
  String sparqlQueryString=sparqlQueryMaker.makeSubjectQueryUsingFilters(uri.toString());
  SparqlQuery query=new SparqlQuery(sparqlQueryString,configuration.getSparqlEndpoint());
  ResultSet rs=SparqlQuery.JSONtoResultSet(cache.executeSparqlQuery(query));
  List<ResultBinding> l=ResultSetFormatter.toList(rs);
  p(l.toString());
  for (  ResultBinding resultBinding : l) {
    s.add(new StringTuple(resultBinding.get(a).toString(),resultBinding.get(b).toString()));
  }
  return s;
}
Program: 10245
Project: 10245
Buggy source:
@Override @SuppressWarnings({"String_Node_Str"}) public Set<StringTuple> getTupelForResource(URI uri){
  Set<StringTuple> s=new HashSet<StringTuple>();
  String a="String_Node_Str";
  String b="String_Node_Str";
  String sparqlQueryString="String_Node_Str" + "String_Node_Str" + "String_Node_Str" + uri.toString() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  SparqlQuery query=new SparqlQuery(sparqlQueryString,configuration.getSparqlEndpoint());
  ResultSet rs=cache.executeSparqlQuery(query);
  List<ResultBinding> l=ResultSetFormatter.toList(rs);
  for (  ResultBinding resultBinding : l) {
    s.add(new StringTuple(resultBinding.get(a).toString(),resultBinding.get(b).toString()));
  }
  return s;
}

Fixed version (ground truth):
@Override @SuppressWarnings({"String_Node_Str"}) public Set<StringTuple> getTupelForResource(URI uri){
  Set<StringTuple> s=new HashSet<StringTuple>();
  String a="String_Node_Str";
  String b="String_Node_Str";
  String sparqlQueryString="String_Node_Str" + "String_Node_Str" + "String_Node_Str" + uri.toString() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  SparqlQuery query=new SparqlQuery(sparqlQueryString,configuration.getSparqlEndpoint());
  ResultSet rs=SparqlQuery.JSONtoResultSet(cache.executeSparqlQuery(query));
  List<ResultBinding> l=ResultSetFormatter.toList(rs);
  for (  ResultBinding resultBinding : l) {
    s.add(new StringTuple(resultBinding.get(a).toString(),resultBinding.get(b).toString()));
  }
  return s;
}
Program: 10246
Project: 10246
Buggy source:
@WebMethod public String getAsJSON(int sessionID,int queryID) throws ClientNotKnownException, SparqlQueryException {
  ClientState state=getState(sessionID);
  SparqlQueryException exception=null;
  if ((exception=state.getQuery(queryID).getSparqlQuery().getException()) != null)   throw exception;
  return SparqlQuery.getAsJSON(state.getQuery(queryID).getResult());
}

Fixed version (ground truth):
@WebMethod public String getAsJSON(int sessionID,int queryID) throws ClientNotKnownException, SparqlQueryException {
  ClientState state=getState(sessionID);
  SparqlQueryException exception=null;
  if ((exception=state.getQuery(queryID).getSparqlQuery().getException()) != null)   throw exception;
  return state.getQuery(queryID).getResult();
}
Program: 10247
Project: 10247
Buggy source:
@WebMethod public String getAsXMLString(int sessionID,int queryID) throws ClientNotKnownException {
  ClientState state=getState(sessionID);
  ResultSet resultSet=state.getQuery(queryID).getResult();
  return SparqlQuery.getAsXMLString(resultSet);
}

Fixed version (ground truth):
@WebMethod public String getAsXMLString(int sessionID,int queryID) throws ClientNotKnownException {
  ClientState state=getState(sessionID);
  ResultSet resultSet=SparqlQuery.JSONtoResultSet(state.getQuery(queryID).getResult());
  return SparqlQuery.getAsXMLString(resultSet);
}
Program: 10248
Project: 10248
Buggy source:
public static Description parseConcept(String string) throws ParseException {
  KBParser parser=new KBParser(new StringReader(string));
  return parser.Concept();
}

Fixed version (ground truth):
public static Description parseConcept(String string) throws ParseException {
  String eq="String_Node_Str" + string + "String_Node_Str";
  KBParser parser=new KBParser(new StringReader(eq));
  EquivalentClassesAxiom eqAxiom=parser.TBoxEquiv();
  return eqAxiom.getConcept2();
}
Program: 10249
Project: 10249
Buggy source:
/** 
 * Takes a SPARQL query (which has not been evaluated yet) as argument and returns a result set. The result set is taken from this cache if the query is stored here. Otherwise the query is send and its result added to the cache and returned. Convenience method.
 * @param query The SPARQL query.
 * @return Jena result set.
 */
public ResultSet executeSparqlQuery(SparqlQuery query){
  String result=getCacheEntry(query.getQueryString());
  if (result != null) {
    return SparqlQuery.JSONtoResultSet(result);
  }
 else {
    ResultSet rs=query.send();
    if (rs != null) {
      String json=SparqlQuery.getAsJSON(rs);
      addToCache(query.getQueryString(),json);
      return SparqlQuery.JSONtoResultSet(json);
    }
 else     return rs;
  }
}

Fixed version (ground truth):
/** 
 * Takes a SPARQL query (which has not been evaluated yet) as argument and returns a result set. The result set is taken from this cache if the query is stored here. Otherwise the query is send and its result added to the cache and returned. Convenience method.
 * @param query The SPARQL query.
 * @return Jena result set.
 */
public ResultSet executeSparqlQuery(SparqlQuery query){
  String result=getCacheEntry(query.getQueryString());
  if (result != null) {
    return SparqlQuery.JSONtoResultSet(result);
  }
 else {
    query.send();
    ResultSet rs=query.getResultSet();
    if (rs != null) {
      String json=SparqlQuery.getAsJSON(rs);
      addToCache(query.getQueryString(),json);
      return SparqlQuery.JSONtoResultSet(json);
    }
    return rs;
  }
}
Program: 10250
Project: 10250
Buggy source:
/** 
 * Converts Jena result set to JSON.
 * @param resultSet The result set to transform.
 * @return JSON representation of the result set.
 */
public static String getAsJSON(ResultSet resultSet){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ResultSetFormatter.outputAsJSON(baos,resultSet);
  try {
    return baos.toString("String_Node_Str");
  }
 catch (  Exception e) {
    return baos.toString();
  }
}

Fixed version (ground truth):
/** 
 * Converts Jena result set to JSON.
 * @param resultSet The result set to transform.
 * @return JSON representation of the result set.
 */
public static String getAsJSON(ResultSet resultSet){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ResultSetFormatter.outputAsJSON(baos,resultSet);
  resultSet=JSONtoResultSet(baos.toString());
  try {
    return baos.toString("String_Node_Str");
  }
 catch (  Exception e) {
    return baos.toString();
  }
}
Program: 10251
Project: 10251
Buggy source:
/** 
 * set ComboBox to selected class
 */
public void updateComboBox(){
  if (config.getReasoner() != null)   for (int i=0; i < reasoner.size(); i++)   if (config.getKnowledgeSource().getClass().equals(config.getComponentManager().getKnowledgeSources().get(i))) {
    cb.setSelectedIndex(i);
  }
  this.choosenClassIndex=cb.getSelectedIndex();
}

Fixed version (ground truth):
/** 
 * set ComboBox to selected class
 */
public void updateComboBox(){
  if (config.getReasoner() != null)   for (int i=0; i < reasoner.size(); i++)   if (config.getReasoner().getClass().equals(config.getComponentManager().getReasonerComponents().get(i))) {
    cb.setSelectedIndex(i);
  }
  this.choosenClassIndex=cb.getSelectedIndex();
}
Program: 10253
Project: 10253
Buggy source:
public static void main(String[] args){
  JUnitCore.main("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args){
  SimpleLayout layout=new SimpleLayout();
  ConsoleAppender consoleAppender=new ConsoleAppender(layout);
  Logger logger=Logger.getRootLogger();
  logger.removeAllAppenders();
  logger.addAppender(consoleAppender);
  logger.setLevel(Level.INFO);
  JUnitCore.main("String_Node_Str","String_Node_Str");
}
Program: 10254
Project: 10254
Buggy source:
private KB getSimpleKnowledgeBase(){
  String kb="String_Node_Str";
  kb+="String_Node_Str";
  kb+="String_Node_Str";
  KB kbObject=null;
  try {
    kbObject=KBParser.parseKBFile(kb);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  ParseException e) {
    e.printStackTrace();
  }
  return kbObject;
}

Fixed version (ground truth):
private KB getSimpleKnowledgeBase(){
  String kb="String_Node_Str";
  kb+="String_Node_Str";
  kb+="String_Node_Str";
  kb+="String_Node_Str";
  kb+="String_Node_Str";
  kb+="String_Node_Str";
  kb+="String_Node_Str";
  kb+="String_Node_Str";
  kb+="String_Node_Str";
  KB kbObject=null;
  try {
    kbObject=KBParser.parseKBFile(kb);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  ParseException e) {
    e.printStackTrace();
  }
  return kbObject;
}
Program: 10255
Project: 10255
Buggy source:
@Test public void instanceCheckTest(){
  try {
    ComponentManager cm=ComponentManager.getInstance();
    KB kb=getSimpleKnowledgeBase();
    KnowledgeSource ks=new KBFile(kb);
    ks.init();
    ReasonerComponent reasoner=cm.reasoner(OWLAPIReasoner.class,ks);
    reasoner.init();
    Description d;
    d=KBParser.parseConcept("String_Node_Str");
    Individual i=new Individual("String_Node_Str");
    boolean result=reasoner.instanceCheck(d,i);
    assertFalse(result);
  }
 catch (  ParseException e) {
    e.printStackTrace();
  }
catch (  ReasoningMethodUnsupportedException e) {
    e.printStackTrace();
  }
catch (  ComponentInitException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Performs an instance checks on all reasoner components to verify that they all return the correct result.
 */
@Test public void instanceCheckTest(){
  try {
    ComponentManager cm=ComponentManager.getInstance();
    KB kb=getSimpleKnowledgeBase();
    KnowledgeSource ks=new KBFile(kb);
    ks.init();
    Description d;
    d=KBParser.parseConcept("String_Node_Str");
    Individual i=new Individual(KBParser.getInternalURI("String_Node_Str"));
    List<Class<? extends ReasonerComponent>> reasonerClasses=cm.getReasonerComponents();
    for (    Class<? extends ReasonerComponent> reasonerClass : reasonerClasses) {
      ReasonerComponent reasoner=cm.reasoner(reasonerClass,ks);
      reasoner.init();
      boolean result=reasoner.instanceCheck(d,i);
      logger.debug("String_Node_Str" + reasoner + "String_Node_Str"+ d+ "String_Node_Str"+ i+ "String_Node_Str"+ result);
      assertTrue(result);
    }
  }
 catch (  ParseException e) {
    e.printStackTrace();
  }
catch (  ReasoningMethodUnsupportedException e) {
    e.printStackTrace();
  }
catch (  ComponentInitException e) {
    e.printStackTrace();
  }
}
Program: 10256
Project: 10256
Buggy source:
/** 
 * It is necessary for init KnowledgeSource.
 * @return true, if url was set otherwise false
 */
public Boolean isSetURL(){
  if (cm.getConfigOptionValue(source,"String_Node_Str") != null)   return true;
 else   return false;
}

Fixed version (ground truth):
/** 
 * It is necessary for init KnowledgeSource.
 * @return true, if url was set otherwise false
 */
public Boolean isSetURL(){
  if (cm.getConfigOptionValue(source,"String_Node_Str") != null || cm.getConfigOptionValue(source,"String_Node_Str") != null)   return true;
 else   return false;
}
Program: 10257
Project: 10257
Buggy source:
/** 
 * after this, you can change widgets
 */
public void setSource(){
  System.out.println("String_Node_Str" + config.getComponentManager());
  System.out.println("String_Node_Str" + sources.get(choosenClassIndex));
  config.setKnowledgeSource(config.getComponentManager().knowledgeSource(sources.get(choosenClassIndex)));
  System.out.println("String_Node_Str" + config.getKnowledgeSource());
  System.out.println("String_Node_Str" + config.getComponentManager().getComponentName(sources.get(0)));
  config.setInitKnowledgeSource(false);
  updateAll();
}

Fixed version (ground truth):
/** 
 * after this, you can change widgets
 */
public void setSource(){
  config.setKnowledgeSource(config.getComponentManager().knowledgeSource(sources.get(choosenClassIndex)));
  config.setInitKnowledgeSource(false);
  updateAll();
}
Program: 10258
Project: 10258
Buggy source:
/** 
 * after this, next tab can be used
 */
public void init(){
  System.out.println("String_Node_Str" + config.getKnowledgeSource());
  System.out.println("String_Node_Str" + config.isSetURL());
  if (config.getKnowledgeSource() != null && config.isSetURL()) {
    try {
      config.getKnowledgeSource().init();
      config.setInitKnowledgeSource(true);
      System.out.println("String_Node_Str");
      startGUI.updateTabColors();
    }
 catch (    ComponentInitException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * after this, next tab can be used
 */
public void init(){
  if (config.getKnowledgeSource() != null && config.isSetURL()) {
    try {
      config.getKnowledgeSource().init();
      config.setInitKnowledgeSource(true);
      System.out.println("String_Node_Str");
      startGUI.updateTabColors();
    }
 catch (    ComponentInitException e) {
      e.printStackTrace();
    }
  }
}
Program: 10259
Project: 10259
Buggy source:
KnowledgeSourcePanel(final Config config,StartGUI startGUI){
  super(new BorderLayout());
  this.config=config;
  this.startGUI=startGUI;
  sources=config.getComponentManager().getKnowledgeSources();
  System.out.println("String_Node_Str" + sources);
  setButton=new JButton("String_Node_Str");
  setButton.addActionListener(this);
  initButton=new JButton("String_Node_Str");
  initButton.addActionListener(this);
  initButton.setEnabled(true);
  for (int i=0; i < sources.size(); i++) {
    cb.addItem(config.getComponentManager().getComponentName(sources.get(i)));
  }
  cb.addActionListener(this);
  choosePanel.add(cb);
  choosePanel.add(setButton);
  choosenClassIndex=cb.getSelectedIndex();
  optionPanel=new OptionPanel(config,config.getKnowledgeSource(),config.getOldKnowledgeSource(),sources.get(choosenClassIndex));
  initPanel.add(initButton);
  add(choosePanel,BorderLayout.PAGE_START);
  add(optionPanel,BorderLayout.CENTER);
  add(initPanel,BorderLayout.PAGE_END);
  updateAll();
}

Fixed version (ground truth):
KnowledgeSourcePanel(final Config config,StartGUI startGUI){
  super(new BorderLayout());
  this.config=config;
  this.startGUI=startGUI;
  sources=config.getComponentManager().getKnowledgeSources();
  setButton=new JButton("String_Node_Str");
  setButton.addActionListener(this);
  initButton=new JButton("String_Node_Str");
  initButton.addActionListener(this);
  initButton.setEnabled(true);
  for (int i=0; i < sources.size(); i++) {
    cb.addItem(config.getComponentManager().getComponentName(sources.get(i)));
  }
  cb.addActionListener(this);
  choosePanel.add(cb);
  choosePanel.add(setButton);
  choosenClassIndex=cb.getSelectedIndex();
  optionPanel=new OptionPanel(config,config.getKnowledgeSource(),config.getOldKnowledgeSource(),sources.get(choosenClassIndex));
  initPanel.add(initButton);
  add(choosePanel,BorderLayout.PAGE_START);
  add(optionPanel,BorderLayout.CENTER);
  add(initPanel,BorderLayout.PAGE_END);
  setSource();
  updateAll();
}
Program: 10260
Project: 10260
Buggy source:
/** 
 * Takes a SPARQL query (which has not been evaluated yet) as argument and returns a result set. The result set is taken from this cache if the query is stored here. Otherwise the query is send and its result added to the cache and returned. Convenience method.
 * @param query The SPARQL query.
 * @return Jena result set.
 */
public ResultSet executeSparqlQuery(SparqlQuery query){
  String result=getCacheEntry(query.getQueryString());
  if (result != null) {
    return SparqlQuery.JSONtoResultSet(result);
  }
 else {
    query.send();
    ResultSet rs=query.getResultSet();
    if (rs != null) {
      String json=SparqlQuery.getAsJSON(rs);
      addToCache(query.getQueryString(),json);
      return SparqlQuery.JSONtoResultSet(json);
    }
 else     return rs;
  }
}

Fixed version (ground truth):
/** 
 * Takes a SPARQL query (which has not been evaluated yet) as argument and returns a result set. The result set is taken from this cache if the query is stored here. Otherwise the query is send and its result added to the cache and returned. Convenience method.
 * @param query The SPARQL query.
 * @return Jena result set.
 */
public ResultSet executeSparqlQuery(SparqlQuery query){
  String result=getCacheEntry(query.getQueryString());
  if (result != null) {
    return SparqlQuery.JSONtoResultSet(result);
  }
 else {
    ResultSet rs=query.send();
    if (rs != null) {
      String json=SparqlQuery.getAsJSON(rs);
      addToCache(query.getQueryString(),json);
      return SparqlQuery.JSONtoResultSet(json);
    }
 else     return rs;
  }
}
Program: 10263
Project: 10263
Buggy source:
private static void handleError(String message){
  System.err.println(message);
  System.exit(0);
}

Fixed version (ground truth):
private static void handleError(String message){
  logger.error(message);
  System.exit(0);
}
Program: 10264
Project: 10264
Buggy source:
/** 
 * set true if you run LearningAlgorithm.init
 */
protected void setLearningAlgorithm(Boolean is){
  isInit[3]=is;
}

Fixed version (ground truth):
protected void setLearningAlgorithm(LearningAlgorithm input){
  la=input;
}
Program: 10265
Project: 10265
Buggy source:
/** 
 * after this, next tab can be used
 */
public void init(){
  if (config.getLearningProblem() != null) {
    config.getLearningAlgorithm().init();
    config.setLearningAlgorithm(true);
    System.out.println("String_Node_Str");
    startGUI.updateTabColors();
  }
}

Fixed version (ground truth):
/** 
 * after this, next tab can be used
 */
public void init(){
  if (config.getLearningProblem() != null) {
    config.getLearningAlgorithm().init();
    config.setInitLearningAlgorithm(true);
    System.out.println("String_Node_Str");
    startGUI.updateTabColors();
  }
}
Program: 10266
Project: 10266
Buggy source:
public void actionPerformed(ActionEvent e){
  if (choosenClassIndex != cb.getSelectedIndex()) {
    choosenClassIndex=cb.getSelectedIndex();
    config.setInitLearningProblem(false);
    setLearningAlgorithm();
  }
  if (e.getSource() == autoInitButton)   setLearningAlgorithm();
  if (e.getSource() == initButton)   init();
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  if (choosenClassIndex != cb.getSelectedIndex()) {
    choosenClassIndex=cb.getSelectedIndex();
    config.setInitLearningAlgorithm(false);
    setLearningAlgorithm();
  }
  if (e.getSource() == autoInitButton)   setLearningAlgorithm();
  if (e.getSource() == initButton)   init();
}
Program: 10267
Project: 10267
Buggy source:
@Override protected void showThingToChange(){
  if (component != null) {
    if (configOption.getClass().toString().contains("String_Node_Str")) {
      if (configOption.getDefaultValue() != null) {
        value=(Boolean)configOption.getDefaultValue();
      }
 else {
        value=false;
      }
      if (value == false)       cb.setSelectedIndex(0);
 else       cb.setSelectedIndex(1);
      cb.addActionListener(this);
      widgetPanel.add(cb);
    }
 else {
      JLabel notImplementedLabel=new JLabel("String_Node_Str");
      notImplementedLabel.setForeground(Color.RED);
      widgetPanel.add(notImplementedLabel);
    }
  }
 else {
    JLabel noConfigOptionLabel=new JLabel("String_Node_Str");
    noConfigOptionLabel.setForeground(Color.MAGENTA);
    widgetPanel.add(noConfigOptionLabel);
  }
}

Fixed version (ground truth):
@Override protected void showThingToChange(){
  if (component != null) {
    if (configOption.getClass().toString().contains("String_Node_Str")) {
      if (configOption.getDefaultValue() != null) {
        value=(Boolean)configOption.getDefaultValue();
        System.out.println("String_Node_Str" + configOption.getDefaultValue());
      }
 else {
        value=false;
      }
      if (value == false)       cb.setSelectedIndex(0);
 else       cb.setSelectedIndex(1);
      cb.addActionListener(this);
      widgetPanel.add(cb);
    }
 else {
      JLabel notImplementedLabel=new JLabel("String_Node_Str");
      notImplementedLabel.setForeground(Color.RED);
      widgetPanel.add(notImplementedLabel);
    }
  }
 else {
    JLabel noConfigOptionLabel=new JLabel("String_Node_Str");
    noConfigOptionLabel.setForeground(Color.MAGENTA);
    widgetPanel.add(noConfigOptionLabel);
  }
}
Program: 10268
Project: 10268
Buggy source:
@Override protected void setEntry(){
  BooleanConfigOption specialOption;
  if (cb.getSelectedIndex() == 0)   value=true;
 else   value=false;
  specialOption=(BooleanConfigOption)config.getComponentManager().getConfigOption(componentOption,configOption.getName());
  try {
    ConfigEntry<Boolean> specialEntry=new ConfigEntry<Boolean>(specialOption,value);
    config.getComponentManager().applyConfigEntry(component,specialEntry);
    System.out.println("String_Node_Str" + configOption.getName() + "String_Node_Str"+ value);
  }
 catch (  InvalidConfigOptionValueException s) {
    s.printStackTrace();
  }
}

Fixed version (ground truth):
@Override protected void setEntry(){
  BooleanConfigOption specialOption;
  if (cb.getSelectedIndex() == 0)   value=false;
 else   value=true;
  specialOption=(BooleanConfigOption)config.getComponentManager().getConfigOption(componentOption,configOption.getName());
  try {
    ConfigEntry<Boolean> specialEntry=new ConfigEntry<Boolean>(specialOption,value);
    config.getComponentManager().applyConfigEntry(component,specialEntry);
    System.out.println("String_Node_Str" + configOption.getName() + "String_Node_Str"+ value);
  }
 catch (  InvalidConfigOptionValueException s) {
    s.printStackTrace();
  }
}
Program: 10269
Project: 10269
Buggy source:
protected void setLearningAlgorithm(LearningAlgorithm input){
  la=input;
}

Fixed version (ground truth):
protected void setLearningAlgorithm(Boolean is){
  isInit[3]=is;
}
Program: 10270
Project: 10270
Buggy source:
public void init(){
  config.getKnowledgeSource().init();
  System.out.println("String_Node_Str" + sources.get(choosenClassIndex) + "String_Node_Str"+ config.getURI()+ "String_Node_Str");
}

Fixed version (ground truth):
public void init(){
  config.getKnowledgeSource().init();
  config.setInitKnowledgeSource(true);
  System.out.println("String_Node_Str" + sources.get(choosenClassIndex) + "String_Node_Str"+ config.getURI()+ "String_Node_Str");
}
Program: 10271
Project: 10271
Buggy source:
LearningAlgorithmPanel(Config config){
  super(new BorderLayout());
  this.config=config;
  initButton=new JButton("String_Node_Str");
  initButton.addActionListener(this);
  initPanel.add(initButton);
  choosePanel.add(cb);
  learners=config.getComponentManager().getLearningAlgorithms();
  for (int i=0; i < learners.size(); i++) {
    cb.addItem(config.getComponentManager().getComponentName(learners.get(i)));
  }
  cb.addActionListener(this);
  optionPanel=new OptionPanel(config,config.getLearningAlgorithm(),learners.get(choosenClassIndex));
  add(choosePanel,BorderLayout.PAGE_START);
  add(initPanel,BorderLayout.CENTER);
  add(optionPanel,BorderLayout.PAGE_END);
}

Fixed version (ground truth):
LearningAlgorithmPanel(Config config){
  super(new BorderLayout());
  this.config=config;
  learners=config.getComponentManager().getLearningAlgorithms();
  initButton=new JButton("String_Node_Str");
  initButton.addActionListener(this);
  initPanel.add(initButton);
  getInstancesButton=new JButton("String_Node_Str");
  getInstancesButton.addActionListener(this);
  for (int i=0; i < learners.size(); i++) {
    cb.addItem(config.getComponentManager().getComponentName(learners.get(i)));
  }
  choosePanel.add(cb);
  choosePanel.add(getInstancesButton);
  cb.addActionListener(this);
  optionPanel=new OptionPanel(config,config.getLearningAlgorithm(),learners.get(choosenClassIndex));
  add(choosePanel,BorderLayout.PAGE_START);
  add(optionPanel,BorderLayout.CENTER);
  add(initPanel,BorderLayout.PAGE_END);
}
Program: 10272
Project: 10272
Buggy source:
public void actionPerformed(ActionEvent e){
  choosenClassIndex=cb.getSelectedIndex();
  if (e.getSource() == initButton && config.getLearningProblem() != null) {
    config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm(learners.get(choosenClassIndex),config.getLearningProblem(),config.getReasoningService()));
    System.out.println("String_Node_Str");
    config.getLearningAlgorithm().init();
    updateOptionPanel();
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  choosenClassIndex=cb.getSelectedIndex();
  if (e.getSource() == getInstancesButton)   getInstances();
  if (e.getSource() == initButton && config.getURI() != null)   init();
}
Program: 10273
Project: 10273
Buggy source:
public void getInstances(){
  config.setReasoner(config.getComponentManager().reasoner(reasoners.get(choosenClassIndex),config.getKnowledgeSource()));
  updateOptionPanel();
}

Fixed version (ground truth):
public void getInstances(){
  if (config.isInitKnowledgeSource()) {
    config.setReasoner(config.getComponentManager().reasoner(reasoners.get(choosenClassIndex),config.getKnowledgeSource()));
    updateOptionPanel();
  }
}
Program: 10274
Project: 10274
Buggy source:
public void init(){
  config.getReasoner().init();
  System.out.println("String_Node_Str");
  config.setReasoningService(config.getComponentManager().reasoningService(config.getReasoner()));
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public void init(){
  config.getReasoner().init();
  System.out.println("String_Node_Str");
  config.setReasoningService(config.getComponentManager().reasoningService(config.getReasoner()));
  System.out.println("String_Node_Str");
  config.setInitReasoner(true);
}
Program: 10275
Project: 10275
Buggy source:
@WebMethod public String[] getCurrentlyBestConcepts(int id,int nrOfConcepts) throws ClientNotKnownException {
  ClientState state=getState(id);
  List<Concept> bestConcepts=state.getLearningAlgorithm().getBestSolutions(nrOfConcepts);
  return bestConcepts.toArray(new String[bestConcepts.size()]);
}

Fixed version (ground truth):
@WebMethod public String[] getCurrentlyBestConcepts(int id,int nrOfConcepts) throws ClientNotKnownException {
  ClientState state=getState(id);
  List<Concept> bestConcepts=state.getLearningAlgorithm().getBestSolutions(nrOfConcepts);
  List<String> conc=new LinkedList<String>();
  Iterator<Concept> iter=bestConcepts.iterator();
  while (iter.hasNext())   conc.add(iter.next().toString());
  return conc.toArray(new String[conc.size()]);
}
Program: 10276
Project: 10276
Buggy source:
/** 
 * Takes a SPARQL query (which has not been evaluated yet) as argument and returns a result set. The result set is taken from this cache if the query is stored here. Otherwise the query is send and its result added to the cache and returned. Convenience method.
 * @param query The SPARQL query.
 * @return Jena result set.
 */
public ResultSet executeSparqlQuery(SparqlQuery query){
  String result=getCacheEntry(query.getQueryString());
  if (result != null) {
    return SparqlQuery.JSONtoResultSet(result);
  }
 else {
    query.send();
    ResultSet rs=query.getResultSet();
    if (rs != null) {
      String json=SparqlQuery.getAsJSON(rs);
      addToCache(query.getQueryString(),json);
    }
    return rs;
  }
}

Fixed version (ground truth):
/** 
 * Takes a SPARQL query (which has not been evaluated yet) as argument and returns a result set. The result set is taken from this cache if the query is stored here. Otherwise the query is send and its result added to the cache and returned. Convenience method.
 * @param query The SPARQL query.
 * @return Jena result set.
 */
public ResultSet executeSparqlQuery(SparqlQuery query){
  String result=getCacheEntry(query.getQueryString());
  if (result != null) {
    return SparqlQuery.JSONtoResultSet(result);
  }
 else {
    query.send();
    ResultSet rs=query.getResultSet();
    if (rs != null) {
      String json=SparqlQuery.getAsJSON(rs);
      addToCache(query.getQueryString(),json);
      return SparqlQuery.JSONtoResultSet(json);
    }
 else     return rs;
  }
}
Program: 10277
Project: 10277
Buggy source:
/** 
 * sends a query and returns JSON
 * @return a String representation of the Resultset as JSON
 */
public String getAsJSON(){
  if (rs == null)   this.send();
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ResultSetFormatter.outputAsJSON(baos,rs);
  return baos.toString();
}

Fixed version (ground truth):
/** 
 * sends a query and returns JSON
 * @return a String representation of the Resultset as JSON
 */
public String getAsJSON(){
  if (rs == null)   this.send();
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ResultSetFormatter.outputAsJSON(baos,rs);
  rs=JSONtoResultSet(baos.toString());
  return baos.toString();
}
Program: 10278
Project: 10278
Buggy source:
/** 
 * TODO can further be optimized
 * @return a jena ResultSet
 */
public ResultSet getAsResultSet(){
  return SparqlQuery.JSONtoResultSet(getAsJSON());
}

Fixed version (ground truth):
public ResultSet getAsResultSet(){
  return this.sparqlQuery.send();
}
Program: 10279
Project: 10279
Buggy source:
/** 
 * TODO define the format
 * @return
 */
@SuppressWarnings({"String_Node_Str"}) public String[][] getAsStringArray(){
  System.out.println("String_Node_Str");
  ResultSet rs=send();
  System.out.println("String_Node_Str");
  List<ResultBinding> l=ResultSetFormatter.toList(rs);
  List<String> resultVars=rs.getResultVars();
  String[][] array=new String[l.size()][resultVars.size()];
  Iterator<String> iter=resultVars.iterator();
  int i=0, j=0;
  for (  ResultBinding resultBinding : l) {
    while (iter.hasNext()) {
      String varName=(String)iter.next();
      array[i][j]=resultBinding.get(varName).toString();
      j++;
    }
    iter=resultVars.iterator();
    i++;
    j=0;
  }
  System.out.println("String_Node_Str");
  return array;
}

Fixed version (ground truth):
/** 
 * TODO define the format
 * @return
 */
@SuppressWarnings({"String_Node_Str"}) public String[][] getAsStringArray(){
  System.out.println("String_Node_Str");
  ResultSet rs=send();
  List<ResultBinding> l=ResultSetFormatter.toList(rs);
  List<String> resultVars=rs.getResultVars();
  String[][] array=new String[l.size()][resultVars.size()];
  Iterator<String> iter=resultVars.iterator();
  int i=0, j=0;
  for (  ResultBinding resultBinding : l) {
    while (iter.hasNext()) {
      String varName=(String)iter.next();
      array[i][j]=resultBinding.get(varName).toString();
      j++;
    }
    iter=resultVars.iterator();
    i++;
    j=0;
  }
  System.out.println("String_Node_Str");
  return array;
}