nus-yam/ex-repair huggingface dataset:
Program: 152776
Project: 152776
Buggy source:
/** 
 * Start the database and create the table if it doesn't exist
 */
private void createTableAndIndex(String dirName,String logName) throws SQLException {
  try {
    Class.forName("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    LogLog.error("String_Node_Str",e);
  }
synchronized (initializeLock) {
    LogLog.warn("String_Node_Str");
    conn=DriverManager.getConnection(hsqlConfigUrl,"String_Node_Str","String_Node_Str");
    initializeLock.notify();
  }
  insertStatement="String_Node_Str" + logName + "String_Node_Str";
  selectStatement="String_Node_Str" + logName + "String_Node_Str";
  deleteStatement="String_Node_Str" + logName + "String_Node_Str";
  if (tableExists(logName)) {
    return;
  }
  Statement st=conn.createStatement();
  st.execute("String_Node_Str" + logName + "String_Node_Str");
  st.execute("String_Node_Str" + logName + "String_Node_Str");
  st.execute("String_Node_Str" + logName + "String_Node_Str");
  st.close();
}

Fixed version (ground truth):
/** 
 * Start the database and create the table if it doesn't exist
 */
private void createTableAndIndex(String dirName,String logName) throws SQLException {
  try {
    Class.forName("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    LogLog.error("String_Node_Str",e);
  }
synchronized (initializeLock) {
    LogLog.debug("String_Node_Str");
    conn=DriverManager.getConnection(hsqlConfigUrl,"String_Node_Str","String_Node_Str");
    initializeLock.notify();
  }
  insertStatement="String_Node_Str" + logName + "String_Node_Str";
  selectStatement="String_Node_Str" + logName + "String_Node_Str";
  deleteStatement="String_Node_Str" + logName + "String_Node_Str";
  if (tableExists(logName)) {
    return;
  }
  Statement st=conn.createStatement();
  st.execute("String_Node_Str" + logName + "String_Node_Str");
  st.execute("String_Node_Str" + logName + "String_Node_Str");
  st.execute("String_Node_Str" + logName + "String_Node_Str");
  st.close();
}
Program: 152777
Project: 152777
Buggy source:
public void shutdown(){
synchronized (serverLock) {
    try {
      LogLog.warn("String_Node_Str");
      PreparedStatement ps=conn.prepareStatement("String_Node_Str");
      ps.execute();
      ps.close();
      server.stop();
      while (server.getState() != ServerConstants.SERVER_STATE_SHUTDOWN) {
        try {
          Thread.sleep(100);
        }
 catch (        InterruptedException e) {
          LogLog.warn("String_Node_Str",e);
        }
      }
    }
 catch (    SQLException e) {
      errorHandler.error("String_Node_Str",e,1);
    }
  }
}

Fixed version (ground truth):
public void shutdown(){
synchronized (serverLock) {
    try {
      if (!shutdownRequested) {
        LogLog.debug("String_Node_Str");
        PreparedStatement ps=conn.prepareStatement("String_Node_Str");
        ps.execute();
        ps.close();
        server.stop();
        shutdownRequested=true;
      }
      while (server.getState() != ServerConstants.SERVER_STATE_SHUTDOWN) {
        try {
          Thread.sleep(100);
        }
 catch (        InterruptedException e) {
          LogLog.warn("String_Node_Str",e);
        }
      }
    }
 catch (    SQLException e) {
      errorHandler.error("String_Node_Str",e,1);
    }
  }
}
Program: 152779
Project: 152779
Buggy source:
/** 
 * Waits until the db is initialized, or stop has been requested.
 * @return
 */
public boolean waitUntilDbInitialized(){
  Object dbInitLock=db.getInitLock();
synchronized (dbInitLock) {
    while (db.isInitialized() && requestedState != ThreadState.STOPPED) {
      try {
        dbInitLock.wait();
      }
 catch (      InterruptedException e) {
        LogLog.error("String_Node_Str",e);
      }
    }
  }
  return db.isInitialized();
}

Fixed version (ground truth):
/** 
 * Waits until the db is initialized, or stop has been requested.
 * @return
 */
public boolean waitUntilDbInitialized(){
synchronized (db.initializeLock) {
    while (!db.isInitialized() && requestedState != ThreadState.STOPPED) {
      try {
        db.initializeLock.wait();
      }
 catch (      InterruptedException e) {
        LogLog.error("String_Node_Str",e);
      }
    }
  }
  return db.isInitialized();
}
Program: 152781
Project: 152781
Buggy source:
/** 
 * Reads the output file directory and puts all existing files into the queue.
 */
@Override public void activateOptions(){
  if (dirName == null) {
    LogLog.warn("String_Node_Str");
  }
  if (logglyUrl == null) {
    LogLog.warn("String_Node_Str");
  }
  if (name == null) {
    name="String_Node_Str";
  }
  LogLog.debug("String_Node_Str" + dirName + "String_Node_Str"+ getName());
  db=new EmbeddedDb(dirName,getName(),errorHandler);
  Thread posterThread=new Thread(poster);
  posterThread.start();
}

Fixed version (ground truth):
/** 
 * Reads the output file directory and puts all existing files into the queue.
 */
@Override public void activateOptions(){
  if (dirName == null) {
    LogLog.warn("String_Node_Str");
  }
  if (logglyUrl == null) {
    LogLog.warn("String_Node_Str");
  }
  LogLog.debug("String_Node_Str" + dirName + "String_Node_Str"+ getName());
  db=new EmbeddedDb(dirName,getName(),errorHandler);
  poster=new HttpPost();
  Thread posterThread=new Thread(poster);
  posterThread.start();
}
Program: 152782
Project: 152782
Buggy source:
/** 
 * Stop this thread sending data and write the last read position
 */
public void stop(){
  requestedState=ThreadState.STOPPED;
synchronized (waitLock) {
    LogLog.debug("String_Node_Str");
    waitLock.notify();
  }
synchronized (poster.stopLock) {
    LogLog.debug("String_Node_Str");
    while (poster.curState != ThreadState.STOPPED) {
      try {
        poster.stopLock.wait(100);
      }
 catch (      InterruptedException e) {
        LogLog.error("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Stop this thread sending data and write the last read position
 */
public void stop(){
  LogLog.debug("String_Node_Str");
  requestedState=ThreadState.STOPPED;
synchronized (waitLock) {
    LogLog.debug("String_Node_Str");
    waitLock.notify();
  }
synchronized (poster.stopLock) {
    LogLog.debug("String_Node_Str");
    while (poster.curState != ThreadState.STOPPED) {
      try {
        poster.stopLock.wait(100);
      }
 catch (      InterruptedException e) {
        LogLog.error("String_Node_Str");
      }
    }
  }
}
Program: 152783
Project: 152783
Buggy source:
public void close(){
  poster.stop();
}

Fixed version (ground truth):
public void close(){
  poster.stop();
  db.shutdown();
}
Program: 152784
Project: 152784
Buggy source:
/** 
 * Adds a type mapping to instruct the tester how a certain type should be instantiated. This is the preferred method for type mapping because ensures maximum test stability. If your bean uses interfaces to define properties than all interfaces should be added to the mappings before testing the property otherwise instantiation exceptions will be thrown.
 * @param type the type you want to map
 * @param builder a <code>ValueBuilder</code> implementation capable of generating pseudo-random instances of the given type.
 */
public void addMapping(Class<?> type,ValueBuilder<Object> builder){
  mappings.put(type,builder);
}

Fixed version (ground truth):
/** 
 * Adds a type mapping to instruct the tester how a certain type should be instantiated. This is the preferred method for type mapping because ensures maximum test stability. If your bean uses interfaces to define properties than all interfaces should be added to the mappings before testing the property otherwise instantiation exceptions will be thrown.
 * @param type the type you want to map
 * @param builder a <code>ValueBuilder</code> implementation capable of generating pseudo-random instances of the given type.
 */
public void addMapping(Class<?> type,ValueBuilder<?> builder){
  mappings.put(type,builder);
}
Program: 152785
Project: 152785
Buggy source:
protected Object getInstance(final Class<?> type) throws InstantiationException, IllegalAccessException {
  if (mappings.containsKey(type)) {
    return mappings.get(type);
  }
 else   if (type.isEnum()) {
    return type.getEnumConstants()[0];
  }
 else   if (Modifier.isAbstract(type.getModifiers()) || Modifier.isInterface(type.getModifiers())) {
    return Mockito.mock(type);
  }
 else {
    return type.newInstance();
  }
}

Fixed version (ground truth):
protected Object getInstance(final Class<?> type) throws InstantiationException, IllegalAccessException {
  if (mappings.containsKey(type)) {
    return mappings.get(type);
  }
 else   if (type.isEnum()) {
    return type.getEnumConstants()[0];
  }
 else   if (Modifier.isAbstract(type.getModifiers())) {
    return Mockito.mock(type,Mockito.CALLS_REAL_METHODS);
  }
 else {
    return type.newInstance();
  }
}
Program: 152787
Project: 152787
Buggy source:
public void testAllConstructors(Class<? extends Exception> type) throws Exception {
  Constructor<?>[] constructors=type.getConstructors();
  for (  Constructor<?> constructor : constructors) {
    List<Object> values=new ArrayList<Object>();
    for (    Class<?> param : constructor.getParameterTypes()) {
      values.add(this.getInstance(param));
    }
    this.testConstructor(type,constructor.getParameterTypes(),values.toArray());
  }
}

Fixed version (ground truth):
public void testAllConstructors(Class<? extends Exception> type,boolean lenient) throws Exception {
  Constructor<?>[] constructors=type.getConstructors();
  for (  Constructor<?> constructor : constructors) {
    List<Object> params=new ArrayList<Object>();
    for (    Class<?> paramType : constructor.getParameterTypes()) {
      params.add(this.getInstance(paramType));
    }
    this.testConstructor(type,constructor.getParameterTypes(),params.toArray(),lenient);
  }
}
Program: 152788
Project: 152788
Buggy source:
public void testConstructor(Class<?> type,Class<?>[] types,Object[] values) throws Exception {
  Constructor<?> constructor=type.getConstructor(types);
  try {
    constructor.newInstance(values);
  }
 catch (  InstantiationException ie) {
    Assert.fail("String_Node_Str" + ie);
  }
catch (  InvocationTargetException ite) {
    Assert.fail("String_Node_Str" + ite.getCause());
  }
}

Fixed version (ground truth):
public void testConstructor(Class<?> type,Class<?>[] paramTypes,Object[] params,boolean lenient) throws Exception {
  assertNotNull(paramTypes);
  assertNotNull(params);
  Constructor<?> constructor=type.getConstructor(paramTypes);
  Collection<Field> fields=listInherithed(type,type,new ArrayList<Field>());
  try {
    Object instance=constructor.newInstance(params);
    for (int i=0; i < paramTypes.length; i++) {
      this.testParameter(instance,paramTypes[i],params[i],fields,lenient);
    }
  }
 catch (  InstantiationException ie) {
    System.out.println("String_Node_Str");
    throw new AssertionError("String_Node_Str" + ie);
  }
catch (  InvocationTargetException ite) {
    System.out.println("String_Node_Str");
    throw new AssertionError("String_Node_Str" + ite.getCause());
  }
}
Program: 152789
Project: 152789
Buggy source:
/** 
 * Obtains a screenshot from the browser and saves it in the output folder.
 * @param method name of the failing test method
 */
private void capture(String method){
  try {
    FileOutputStream out=new FileOutputStream(outputFolder + "String_Node_Str" + method+ "String_Node_Str");
    out.write(((TakesScreenshot)driver).getScreenshotAs(OutputType.BYTES));
    out.close();
  }
 catch (  Exception e) {
    new RuntimeException("String_Node_Str" + method,e).printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Obtains a screenshot from the browser and saves it in the output folder.
 * @param method name of the failing test method
 */
private void capture(String method){
  try {
    File target=new File(outputFolder,"String_Node_Str" + method + "String_Node_Str");
    FileOutputStream out=new FileOutputStream(target);
    out.write(((TakesScreenshot)driver).getScreenshotAs(OutputType.BYTES));
    out.close();
  }
 catch (  Exception e) {
    new RuntimeException("String_Node_Str" + method,e).printStackTrace();
  }
}
Program: 152790
Project: 152790
Buggy source:
@Override public void run(){
  if (instance != null && instance.delegate != null) {
    instance.delegate.quit();
  }
}

Fixed version (ground truth):
@Override public void run(){
  SharedWebDriver.destroy();
}
Program: 152791
Project: 152791
Buggy source:
@Override public void add(Iterable<Statement> triples,String namedGraphURI){
  SailConnection connection=null;
  try {
    connection=sail.getConnection();
  }
 catch (  SailException e2) {
    e2.printStackTrace();
  }
  for (  Statement stmt : triples) {
    try {
      if (namedGraphURI == null) {
        connection.addStatement(stmt.getSubject(),stmt.getPredicate(),stmt.getObject());
      }
 else {
        final URI graph=new ValueFactoryImpl().createURI(namedGraphURI);
        connection.addStatement(stmt.getSubject(),stmt.getPredicate(),stmt.getObject(),graph);
      }
    }
 catch (    SailException e) {
      try {
        connection.rollback();
      }
 catch (      SailException e1) {
        e1.printStackTrace();
      }
    }
  }
  try {
    connection.commit();
    connection.close();
  }
 catch (  SailException e2) {
    e2.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void add(Iterable<Statement> triples,String namedGraphURI){
  for (  Statement stmt : triples)   try {
    if (namedGraphURI == null) {
      connection.addStatement(stmt.getSubject(),stmt.getPredicate(),stmt.getObject());
    }
 else {
      final URI graph=new ValueFactoryImpl().createURI(namedGraphURI);
      connection.addStatement(stmt.getSubject(),stmt.getPredicate(),stmt.getObject(),graph);
    }
  }
 catch (  SailException e) {
    try {
      connection.rollback();
    }
 catch (    SailException e1) {
      e1.printStackTrace();
    }
  }
  try {
    connection.commit();
  }
 catch (  SailException e2) {
    e2.printStackTrace();
  }
}
Program: 152792
Project: 152792
Buggy source:
@Override public void disconnect(){
  setConnected(false);
  try {
    connection.close();
  }
 catch (  SailException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void disconnect(){
  setConnected(false);
  try {
    if (connection.isOpen()) {
      connection.close();
    }
  }
 catch (  SailException e) {
    e.printStackTrace();
  }
}
Program: 152793
Project: 152793
Buggy source:
@Override public void delete(String graphURI){
  connect();
  try {
    if (graphURI == null) {
      connection.clear();
    }
 else {
      connection.clear(new ValueFactoryImpl().createURI(graphURI));
    }
  }
 catch (  SailException e) {
    e.printStackTrace();
    try {
      connection.rollback();
    }
 catch (    SailException e1) {
      e1.printStackTrace();
    }
  }
  disconnect();
}

Fixed version (ground truth):
@Override public void delete(String graphURI){
  try {
    if (graphURI == null) {
      connection.clear();
      connection.commit();
    }
 else {
      connection.clear(new ValueFactoryImpl().createURI(graphURI));
      connection.commit();
    }
  }
 catch (  SailException e) {
    e.printStackTrace();
    try {
      connection.rollback();
    }
 catch (    SailException e1) {
      e1.printStackTrace();
    }
  }
}
Program: 152794
Project: 152794
Buggy source:
@Override public void remove(Iterable<Statement> triples,String namedGraphURI){
  connect();
  for (  Statement stmt : triples)   try {
    if (namedGraphURI == null) {
      connection.removeStatements(stmt.getSubject(),stmt.getPredicate(),stmt.getObject());
    }
 else {
      connection.removeStatements(stmt.getSubject(),stmt.getPredicate(),stmt.getObject(),new ValueFactoryImpl().createURI(namedGraphURI));
    }
  }
 catch (  SailException e) {
    try {
      connection.rollback();
    }
 catch (    SailException e1) {
      e1.printStackTrace();
    }
  }
  disconnect();
}

Fixed version (ground truth):
@Override public void remove(Iterable<Statement> triples,String namedGraphURI){
  for (  Statement stmt : triples)   try {
    if (namedGraphURI == null) {
      connection.removeStatements(stmt.getSubject(),stmt.getPredicate(),stmt.getObject());
    }
 else {
      connection.removeStatements(stmt.getSubject(),stmt.getPredicate(),stmt.getObject(),new ValueFactoryImpl().createURI(namedGraphURI));
    }
  }
 catch (  SailException e) {
    try {
      connection.rollback();
    }
 catch (    SailException e1) {
      e1.printStackTrace();
    }
  }
  try {
    connection.commit();
  }
 catch (  SailException e) {
    e.printStackTrace();
  }
}
Program: 152795
Project: 152795
Buggy source:
@Override public void connect(){
  if (!isConnected()) {
    setConnected(true);
    try {
      connection=sail.getConnection();
    }
 catch (    SailException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void connect(){
  if (!isConnected()) {
    setConnected(true);
    try {
      if (connection != null && connection.isOpen()) {
        connection.close();
      }
      connection=sail.getConnection();
    }
 catch (    SailException e) {
      e.printStackTrace();
    }
  }
}
Program: 152796
Project: 152796
Buggy source:
@Override public IResultSet<Value,URI,Literal> selectQuery(String query,String graph){
  connect();
  final SPARQLParser parser=new SPARQLParser();
  CloseableIteration<? extends BindingSet,QueryEvaluationException> sparqlResults=null;
  ParsedQuery parsedQuery=null;
  try {
    parsedQuery=parser.parseQuery(query,null);
  }
 catch (  MalformedQueryException e) {
    e.printStackTrace();
  }
  try {
    sparqlResults=sail.getConnection().evaluate(parsedQuery.getTupleExpr(),parsedQuery.getDataset(),new EmptyBindingSet(),false);
  }
 catch (  SailException e) {
    e.printStackTrace();
  }
  return new SailResultSet(sparqlResults);
}

Fixed version (ground truth):
@Override public IResultSet<Value,URI,Literal> selectQuery(String query,String graph){
  connect();
  final SPARQLParser parser=new SPARQLParser();
  CloseableIteration<? extends BindingSet,QueryEvaluationException> sparqlResults=null;
  ParsedQuery parsedQuery=null;
  try {
    parsedQuery=parser.parseQuery(query,null);
  }
 catch (  MalformedQueryException e) {
    e.printStackTrace();
  }
  try {
    sparqlResults=connection.evaluate(parsedQuery.getTupleExpr(),parsedQuery.getDataset(),new EmptyBindingSet(),false);
  }
 catch (  SailException e) {
    e.printStackTrace();
  }
  return new SailResultSet(sparqlResults);
}
Program: 152797
Project: 152797
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void save(Collection<Statement> triples,@SuppressWarnings("String_Node_Str") IDataSource dataSource,String graphURI){
  dataSource.add(triples,graphURI);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void save(Collection<Statement> triples,@SuppressWarnings("String_Node_Str") IDataSource dataSource,String graphURI){
  dataSource.connect();
  dataSource.add(triples,graphURI);
  dataSource.disconnect();
}
Program: 152798
Project: 152798
Buggy source:
@Override public EObject getEObject(String uriFragment){
  if (dataSource == null) {
    dataSource=getDataSource();
  }
  if (uriFragment != null && uriFragment.startsWith("String_Node_Str")) {
    final URI key=getProxyKey(uriFragment);
    return load(dataSource,key.toString(),getGraph());
  }
  return null;
}

Fixed version (ground truth):
@Override public EObject getEObject(String uriFragment){
  if (dataSource == null) {
    dataSource=getByRegistryOrCreateDataSource(null);
  }
  if (uriFragment != null && uriFragment.startsWith("String_Node_Str")) {
    final URI key=getProxyKey(uriFragment);
    return load(dataSource,key.toString(),getGraph());
  }
  return null;
}
Program: 152799
Project: 152799
Buggy source:
@Override public void delete(Map<?,?> options) throws IOException {
  final IDataSource<G,T,N,U,L> dataSource=options == null ? getDataSource() : getDataSource(options);
  if (dataSource.isMutable()) {
    dataSource.connect();
    final Map<String,String> queries=decodeQueryString(getURI().query());
    dataSource.delete(queries.get("String_Node_Str"));
    dataSource.disconnect();
  }
}

Fixed version (ground truth):
@Override public void delete(Map<?,?> options) throws IOException {
  if (dataSource == null) {
    dataSource=getByRegistryOrCreateDataSource(options);
  }
  if (dataSource.isMutable()) {
    final Map<String,String> queries=decodeQueryString(getURI().query());
    dataSource.delete(queries.get("String_Node_Str"));
  }
}
Program: 152800
Project: 152800
Buggy source:
protected EObject createProxy(EClass eClass,String key){
  if (resource.getPrimaryCache().hasKey(key)) {
    return resource.getPrimaryCache().getObjectByKey(key);
  }
 else {
    EObject object=EcoreUtil.create(eClass);
    setIdValue(object,key,ETripleEcoreUtil.getId(eClass));
    URI id=resource.getID(object);
    ((InternalEObject)object).eSetProxyURI(id);
    resource.getPrimaryCache().cache(key,object);
    resource.getContents().add(object);
    return object;
  }
}

Fixed version (ground truth):
protected EObject createProxy(EClass eClass,String key){
  if (resource.getPrimaryCache().hasKey(key)) {
    return resource.getPrimaryCache().getObjectByKey(key);
  }
 else {
    EObject object=EcoreUtil.create(eClass);
    setIdValue(object,key,ETripleEcoreUtil.getId(eClass));
    final URI proxyURI;
    proxyURI=URI.createURI(resource.getURI() + "String_Node_Str" + key);
    ((InternalEObject)object).eSetProxyURI(proxyURI);
    resource.getPrimaryCache().cache(key,object);
    resource.getContents().add(object);
    return object;
  }
}
Program: 152801
Project: 152801
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) protected IResultSet<N,U,L> getResultSet(EClass eClass,String key,String graphURI,IDataSource dataSource){
  return dataSource.selectQuery(selectObjectByClass(eClass,key),graphURI);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) protected IResultSet<N,U,L> getResultSet(EClass eClass,String key,String graphURI,IDataSource dataSource){
  return dataSource.selectQuery(selectObjectByClass(eClass,key,graphURI),null);
}
Program: 152802
Project: 152802
Buggy source:
protected void setIdValue(EObject returnedObject,String key,EAttribute id){
  if (id == null)   return;
  EAnnotation ann=ETripleEcoreUtil.getETripleAnnotation(id,"String_Node_Str");
  if (ann == null) {
    returnedObject.eSet(id,key);
    return;
  }
  if (ann.getDetails().containsKey("String_Node_Str")) {
    String base=ann.getDetails().get("String_Node_Str");
    if (key.startsWith(base)) {
      String localName=key.substring(base.length(),key.length());
      if (localName != null && localName.length() > 0)       returnedObject.eSet(id,EcoreUtil.createFromString((EDataType)id.getEType(),localName));
    }
  }
}

Fixed version (ground truth):
protected void setIdValue(EObject returnedObject,String key,EAttribute id){
  if (id == null)   return;
  EAnnotation ann=ETripleEcoreUtil.getETripleAnnotation(id,"String_Node_Str");
  if (ann == null) {
    if (id.isID() && id.getName().equals("String_Node_Str")) {
      returnedObject.eSet(id,EcoreUtil.createFromString(id.getEAttributeType(),key));
    }
 else {
      String ns=returnedObject.eClass().getEPackage().getNsURI();
      int length;
      if (!(ns.endsWith("String_Node_Str") || ns.endsWith("String_Node_Str"))) {
        length=ns.length() + 1;
      }
 else {
        length=ns.length();
      }
      String value=key.substring(length,key.length());
      returnedObject.eSet(id,EcoreUtil.createFromString(id.getEAttributeType(),value));
    }
  }
 else {
    if (ann.getDetails().containsKey("String_Node_Str")) {
      String base=ann.getDetails().get("String_Node_Str");
      if (key.startsWith(base)) {
        String localName=key.substring(base.length(),key.length());
        if (localName != null && localName.length() > 0) {
          returnedObject.eSet(id,EcoreUtil.createFromString(id.getEAttributeType(),localName));
        }
      }
    }
  }
}
Program: 152803
Project: 152803
Buggy source:
@Override public EObject getEObject(String uriFragment){
  if (dataSource == null) {
    dataSource=getByRegistryOrCreateDataSource(null);
  }
  if (uriFragment != null && uriFragment.startsWith("String_Node_Str")) {
    final URI key=getProxyKey(uriFragment);
    return load(dataSource,key.toString(),getGraph());
  }
  return null;
}

Fixed version (ground truth):
@Override public EObject getEObject(String uriFragment){
  if (dataSource == null) {
    dataSource=getByRegistryOrCreateDataSource(null);
  }
  if (uriFragment != null) {
    final String key=getProxyKey(uriFragment);
    if (key != null) {
      return load(dataSource,key,getGraph());
    }
  }
  return null;
}
Program: 152804
Project: 152804
Buggy source:
private URI getProxyKey(String uriFragment){
  return URI.createURI(uriFragment.split("String_Node_Str")[1].replaceAll("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
private String getProxyKey(String uriFragment){
  if (uriFragment.startsWith("String_Node_Str")) {
    return uriFragment.split("String_Node_Str")[1].replaceAll("String_Node_Str","String_Node_Str");
  }
 else   return null;
}
Program: 152805
Project: 152805
Buggy source:
@Override public URI getID(EObject object){
  if (getPrimaryCache().hasObject(object)) {
    return URI.createURI(getPrimaryCache().getObjectId(object));
  }
  final String key=EObjectID.getId(object);
  getPrimaryCache().cache(key,object);
  return URI.createURI(key);
}

Fixed version (ground truth):
@Override public URI getID(EObject object){
  String key=null;
  if (getPrimaryCache().hasObject(object)) {
    key=getPrimaryCache().getObjectId(object);
  }
  if (key == null && object.eIsProxy()) {
    URI uri=((InternalEObject)object).eProxyURI();
    if (uri.hasFragment()) {
      key=getProxyKey(uri.fragment());
    }
  }
  if (key == null) {
    key=EObjectID.getId(object);
    getPrimaryCache().cache(key,object);
  }
  return URI.createURI(key);
}
Program: 152806
Project: 152806
Buggy source:
/** 
 * Loads an inventory from a YAML configuration file.
 * @param file the YAML file to load
 * @return the loaded inventory
 * @throws IOException if the file could not be read
 * @throws InvalidConfigurationException if the file could not be parsed
 */
public static Inventory loadFromYaml(File file) throws IOException, InvalidConfigurationException {
  YamlConfiguration yaml=new YamlConfiguration();
  yaml.load(file);
  int inventorySize=yaml.getInt("String_Node_Str",6 * 9);
  Inventory inventory=Bukkit.getServer().createInventory(null,inventorySize);
  ConfigurationSection items=yaml.getConfigurationSection("String_Node_Str");
  for (int slot=0; slot < inventorySize; slot++) {
    String slotString=String.valueOf(slot);
    if (items.isItemStack(slotString)) {
      ItemStack itemStack=items.getItemStack(slotString);
      inventory.setItem(slot,itemStack);
    }
  }
  return inventory;
}

Fixed version (ground truth):
/** 
 * Loads an inventory from a YAML configuration file.
 * @param file the YAML file to load
 * @return the loaded inventory
 * @throws IOException if the file could not be read
 * @throws InvalidConfigurationException if the file could not be parsed
 */
public static Inventory loadFromYaml(File file) throws IOException, InvalidConfigurationException {
  YamlConfiguration yaml=new Utf8YamlConfiguration();
  yaml.load(file);
  int inventorySize=yaml.getInt("String_Node_Str",6 * 9);
  Inventory inventory=Bukkit.getServer().createInventory(null,inventorySize);
  ConfigurationSection items=yaml.getConfigurationSection("String_Node_Str");
  for (int slot=0; slot < inventorySize; slot++) {
    String slotString=String.valueOf(slot);
    if (items.isItemStack(slotString)) {
      ItemStack itemStack=items.getItemStack(slotString);
      inventory.setItem(slot,itemStack);
    }
  }
  return inventory;
}
Program: 152807
Project: 152807
Buggy source:
/** 
 * Save an inventory to a YAML configuration file.
 * @param inventory the inventory to save
 * @param file the YAML file to write
 * @throws IOException if the file could not be written
 */
public static void saveToYaml(Inventory inventory,File file) throws IOException {
  YamlConfiguration yaml=new YamlConfiguration();
  int inventorySize=inventory.getSize();
  yaml.set("String_Node_Str",inventorySize);
  ConfigurationSection items=yaml.createSection("String_Node_Str");
  for (int slot=0; slot < inventorySize; slot++) {
    ItemStack stack=inventory.getItem(slot);
    if (stack != null) {
      items.set(String.valueOf(slot),stack);
    }
  }
  yaml.save(file);
}

Fixed version (ground truth):
/** 
 * Save an inventory to a YAML configuration file.
 * @param inventory the inventory to save
 * @param file the YAML file to write
 * @throws IOException if the file could not be written
 */
public static void saveToYaml(Inventory inventory,File file) throws IOException {
  YamlConfiguration yaml=new Utf8YamlConfiguration();
  int inventorySize=inventory.getSize();
  yaml.set("String_Node_Str",inventorySize);
  ConfigurationSection items=yaml.createSection("String_Node_Str");
  for (int slot=0; slot < inventorySize; slot++) {
    ItemStack stack=inventory.getItem(slot);
    if (stack != null) {
      items.set(String.valueOf(slot),stack);
    }
  }
  yaml.save(file);
}
Program: 152808
Project: 152808
Buggy source:
public int save(boolean saveAll){
  int savedChests=0;
  dataFolder.mkdirs();
  Iterator<Entry<String,VirtualChest>> chestIterator=chests.entrySet().iterator();
  while (chestIterator.hasNext()) {
    final Entry<String,VirtualChest> entry=chestIterator.next();
    final String playerName=entry.getKey();
    final VirtualChest chest=entry.getValue();
    new File(dataFolder,playerName + "String_Node_Str").delete();
    if (chest == null) {
      new File(dataFolder,playerName + "String_Node_Str").delete();
      chestIterator.remove();
    }
 else     if (saveAll || chest.isChanged()) {
      try {
        final File nbtFile=new File(dataFolder,playerName + "String_Node_Str");
        saveChestToNBT(chest,nbtFile);
        chest.setChanged(false);
        savedChests++;
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  return savedChests;
}

Fixed version (ground truth):
public int save(boolean saveAll){
  int savedChests=0;
  dataFolder.mkdirs();
  Iterator<Entry<String,VirtualChest>> chestIterator=chests.entrySet().iterator();
  while (chestIterator.hasNext()) {
    final Entry<String,VirtualChest> entry=chestIterator.next();
    final String playerName=entry.getKey();
    final VirtualChest chest=entry.getValue();
    if (chest == null) {
      new File(dataFolder,playerName + "String_Node_Str").delete();
      new File(dataFolder,playerName + "String_Node_Str").delete();
      chestIterator.remove();
    }
 else     if (saveAll || chest.isChanged()) {
      new File(dataFolder,playerName + "String_Node_Str").delete();
      try {
        final File nbtFile=new File(dataFolder,playerName + "String_Node_Str");
        saveChestToNBT(chest,nbtFile);
        chest.setChanged(false);
        savedChests++;
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  return savedChests;
}
Program: 152810
Project: 152810
Buggy source:
public void handleStatus(SVNStatus status) throws SVNException {
  SVNStatusType s=status.getContentsStatus();
  if (s == SVNStatusType.STATUS_UNVERSIONED || s == SVNStatusType.STATUS_IGNORED || s == SVNStatusType.STATUS_MODIFIED || s == SVNStatusType.STATUS_NONE) {
    listener.getLogger().println("String_Node_Str" + status.getFile());
    try {
      File f=status.getFile();
      if (f.isDirectory())       FileUtils.deleteDirectory(f);
 else       f.delete();
    }
 catch (    IOException e) {
      throw new SVNException(SVNErrorMessage.UNKNOWN_ERROR_MESSAGE,e);
    }
  }
}

Fixed version (ground truth):
public void handleStatus(SVNStatus status) throws SVNException {
  SVNStatusType s=status.getContentsStatus();
  if (s == SVNStatusType.STATUS_UNVERSIONED || s == SVNStatusType.STATUS_IGNORED || s == SVNStatusType.STATUS_MODIFIED || s == SVNStatusType.STATUS_NONE) {
    listener.getLogger().println("String_Node_Str" + status.getFile());
    try {
      File f=status.getFile();
      if (f.isDirectory())       FileUtils.deleteDirectory(f);
 else       if (!f.delete())       throw new IOException("String_Node_Str" + f.getAbsolutePath());
    }
 catch (    IOException e) {
      throw new SVNException(SVNErrorMessage.UNKNOWN_ERROR_MESSAGE,e);
    }
  }
}
Program: 152811
Project: 152811
Buggy source:
@Override protected void preUpdate(ModuleLocation module,File local) throws SVNException {
  listener.getLogger().println("String_Node_Str" + local);
  manager.getStatusClient().doStatus(local,null,SVNDepth.INFINITY,false,false,true,false,new ISVNStatusHandler(){
    public void handleStatus(    SVNStatus status) throws SVNException {
      SVNStatusType s=status.getContentsStatus();
      if (s == SVNStatusType.STATUS_UNVERSIONED || s == SVNStatusType.STATUS_IGNORED || s == SVNStatusType.STATUS_MODIFIED || s == SVNStatusType.STATUS_NONE) {
        listener.getLogger().println("String_Node_Str" + status.getFile());
        try {
          File f=status.getFile();
          if (f.isDirectory())           FileUtils.deleteDirectory(f);
 else           f.delete();
        }
 catch (        IOException e) {
          throw new SVNException(SVNErrorMessage.UNKNOWN_ERROR_MESSAGE,e);
        }
      }
    }
  }
,null);
}

Fixed version (ground truth):
@Override protected void preUpdate(ModuleLocation module,File local) throws SVNException {
  listener.getLogger().println("String_Node_Str" + local);
  manager.getStatusClient().doStatus(local,null,SVNDepth.INFINITY,false,false,true,false,new ISVNStatusHandler(){
    public void handleStatus(    SVNStatus status) throws SVNException {
      SVNStatusType s=status.getContentsStatus();
      if (s == SVNStatusType.STATUS_UNVERSIONED || s == SVNStatusType.STATUS_IGNORED || s == SVNStatusType.STATUS_MODIFIED || s == SVNStatusType.STATUS_NONE) {
        listener.getLogger().println("String_Node_Str" + status.getFile());
        try {
          File f=status.getFile();
          if (f.isDirectory())           FileUtils.deleteDirectory(f);
 else           if (!f.delete())           throw new IOException("String_Node_Str" + f.getAbsolutePath());
        }
 catch (        IOException e) {
          throw new SVNException(SVNErrorMessage.UNKNOWN_ERROR_MESSAGE,e);
        }
      }
    }
  }
,null);
}
Program: 152812
Project: 152812
Buggy source:
public Credential getCredential(SVNURL url,String realm){
  return get(getCredentialsKey(url.toDecodedString(),realm));
}

Fixed version (ground truth):
public Credential getCredential(SerializableSVNURL serializableURL,String realm) throws SVNException {
  return get(getCredentialsKey(serializableURL.getSVNURL().toDecodedString(),realm));
}
Program: 152813
Project: 152813
Buggy source:
private SVNAuthentication fromProvider(SVNURL url,String realm,String kind,RemotableSVNAuthenticationProvider src,String debugName) throws SVNException {
  if (src == null) {
    return null;
  }
  Credential cred=src.getCredential(url,realm);
  LOGGER.fine(String.format("String_Node_Str",debugName,kind,url,realm,cred));
  this.lastCredential=cred;
  if (cred != null) {
    return cred.createSVNAuthentication(kind);
  }
  return null;
}

Fixed version (ground truth):
private SVNAuthentication fromProvider(SVNURL url,String realm,String kind,RemotableSVNAuthenticationProvider src,String debugName) throws SVNException {
  if (src == null) {
    return null;
  }
  Credential cred=src.getCredential(new SerializableSVNURL(url),realm);
  LOGGER.fine(String.format("String_Node_Str",debugName,kind,url,realm,cred));
  this.lastCredential=cred;
  if (cred != null) {
    return cred.createSVNAuthentication(kind);
  }
  return null;
}
Program: 152814
Project: 152814
Buggy source:
public Credential getCredential(SVNURL url,String realm){
  for (  SubversionCredentialProvider p : SubversionCredentialProvider.all()) {
    Credential c=p.getCredential(url,realm);
    if (c != null) {
      LOGGER.fine(String.format("String_Node_Str",realm,c,p));
      return c;
    }
  }
  LOGGER.fine(String.format("String_Node_Str",realm,credentials.get(realm)));
  return credentials.get(realm);
}

Fixed version (ground truth):
public Credential getCredential(SerializableSVNURL serializableUrl,String realm) throws SVNException {
  for (  SubversionCredentialProvider p : SubversionCredentialProvider.all()) {
    Credential c=p.getCredential(serializableUrl.getSVNURL(),realm);
    if (c != null) {
      LOGGER.fine(String.format("String_Node_Str",realm,c,p));
      return c;
    }
  }
  LOGGER.fine(String.format("String_Node_Str",realm,credentials.get(realm)));
  return credentials.get(realm);
}
Program: 152815
Project: 152815
Buggy source:
/** 
 * Test excluded regions
 */
@Bug(6030) public void testExcludedRegions() throws Exception {
  File repo=new CopyExisting(getClass().getResource("String_Node_Str")).allocate();
  SubversionSCM scm=new SubversionSCM(SubversionSCM.ModuleLocation.parse(new String[]{"String_Node_Str" + repo.getPath()},new String[]{"String_Node_Str"},null,null),true,false,null,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  FreeStyleProject p=createFreeStyleProject("String_Node_Str");
  p.setScm(scm);
  assertBuildStatusSuccess(p.scheduleBuild2(0).get());
  assertFalse(p.pollSCMChanges(createTaskListener()));
  createCommit(scm,"String_Node_Str");
  assertFalse("String_Node_Str",p.pollSCMChanges(createTaskListener()));
  createCommit(scm,"String_Node_Str");
  assertTrue("String_Node_Str",p.pollSCMChanges(createTaskListener()));
}

Fixed version (ground truth):
/** 
 * Test excluded regions
 */
@Bug(6030) public void testExcludedRegions() throws Exception {
  File repo=new CopyExisting(getClass().getResource("String_Node_Str")).allocate();
  SubversionSCM scm=new SubversionSCM(SubversionSCM.ModuleLocation.parse(new String[]{"String_Node_Str" + repo.getPath()},new String[]{"String_Node_Str"},null,null),true,false,null,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  FreeStyleProject p=createFreeStyleProject("String_Node_Str");
  p.setScm(scm);
  assertBuildStatusSuccess(p.scheduleBuild2(0).get());
  assertFalse("String_Node_Str",p.poll(createTaskListener()).hasChanges());
  createCommit(scm,"String_Node_Str");
  assertFalse("String_Node_Str",p.poll(createTaskListener()).hasChanges());
  createCommit(scm,"String_Node_Str");
  assertTrue("String_Node_Str",p.poll(createTaskListener()).hasChanges());
}
Program: 152816
Project: 152816
Buggy source:
/** 
 * Test included regions
 */
@Bug(6030) public void testIncludedRegions() throws Exception {
  File repo=new CopyExisting(getClass().getResource("String_Node_Str")).allocate();
  SubversionSCM scm=new SubversionSCM(SubversionSCM.ModuleLocation.parse(new String[]{"String_Node_Str" + repo.getPath()},new String[]{"String_Node_Str"},null,null),true,false,null,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  FreeStyleProject p=createFreeStyleProject("String_Node_Str");
  p.setScm(scm);
  assertBuildStatusSuccess(p.scheduleBuild2(0).get());
  assertFalse(p.pollSCMChanges(createTaskListener()));
  createCommit(scm,"String_Node_Str");
  assertFalse("String_Node_Str",p.pollSCMChanges(createTaskListener()));
  createCommit(scm,"String_Node_Str");
  assertTrue("String_Node_Str",p.pollSCMChanges(createTaskListener()));
}

Fixed version (ground truth):
/** 
 * Test included regions
 */
@Bug(6030) public void testIncludedRegions() throws Exception {
  File repo=new CopyExisting(getClass().getResource("String_Node_Str")).allocate();
  SubversionSCM scm=new SubversionSCM(SubversionSCM.ModuleLocation.parse(new String[]{"String_Node_Str" + repo.getPath()},new String[]{"String_Node_Str"},null,null),true,false,null,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  FreeStyleProject p=createFreeStyleProject("String_Node_Str");
  p.setScm(scm);
  assertBuildStatusSuccess(p.scheduleBuild2(0).get());
  assertFalse(p.poll(createTaskListener()).hasChanges());
  createCommit(scm,"String_Node_Str");
  assertFalse("String_Node_Str",p.poll(createTaskListener()).hasChanges());
  createCommit(scm,"String_Node_Str");
  assertTrue("String_Node_Str",p.poll(createTaskListener()).hasChanges());
}
Program: 152817
Project: 152817
Buggy source:
XmlFile getXmlFile(Job prj){
  File rootDir=prj.getRootDir();
  File credentialFile=new File(rootDir,credentialsFileName);
  if (credentialFile.exists()) {
    return new XmlFile(credentialFile);
  }
  if (prj instanceof MatrixConfiguration && prj.getParent() != null) {
    ItemGroup parent=prj.getParent();
    if (parent instanceof Job) {
      return getXmlFile((Job)parent);
    }
  }
  if (prj.hasCascadingProject()) {
    return getXmlFile(prj.getCascadingProject());
  }
  return new XmlFile(new File(rootDir,credentialsFileName));
}

Fixed version (ground truth):
XmlFile getXmlFile(Job prj){
  File rootDir=prj.getRootDir();
  File credentialFile=new File(rootDir,credentialsFileName);
  if (credentialFile.exists()) {
    return new XmlFile(credentialFile);
  }
  if (prj instanceof MatrixConfiguration && prj.getParent() != null) {
    ItemGroup parent=prj.getParent();
    return getXmlFile((Job)parent);
  }
  if (prj.hasCascadingProject()) {
    return getXmlFile(prj.getCascadingProject());
  }
  return new XmlFile(new File(rootDir,credentialsFileName));
}
Program: 152818
Project: 152818
Buggy source:
@Url("String_Node_Str") public void testRemoteCheckOut() throws Exception {
  DumbSlave s=createSlave();
  FreeStyleProject p=createFreeStyleProject();
  p.setAssignedLabel(s.getSelfLabel());
  p.setScm(new SubversionSCM("String_Node_Str"));
  FreeStyleBuild b=assertBuildStatusSuccess(p.scheduleBuild2(0,new Cause.UserCause()).get());
  assertTrue(b.getWorkspace().child("String_Node_Str").exists());
  b=assertBuildStatusSuccess(p.scheduleBuild2(0).get());
}

Fixed version (ground truth):
@Url("String_Node_Str") public void testRemoteCheckOut() throws Exception {
  DumbSlave s=createSlave();
  FreeStyleProject p=createFreeStyleProject();
  p.setAssignedLabel(s.getSelfLabel());
  p.setScm(new SubversionSCM("String_Node_Str"));
  FreeStyleBuild b=assertBuildStatusSuccess(p.scheduleBuild2(0,new Cause.UserCause()).get());
  assertTrue(b.getWorkspace().child("String_Node_Str").exists());
  assertNotNull(assertBuildStatusSuccess(p.scheduleBuild2(0).get()));
}
Program: 152819
Project: 152819
Buggy source:
/** 
 * Validates the excludeCommitMessages field.
 * @param value value to validate.
 * @return {@link FormValidation}.
 * @throws java.io.IOException IOException.
 * @throws javax.servlet.ServletException ServletException.
 */
public FormValidation doCheckExcludedCommitMessages(@QueryParameter String value) throws IOException, ServletException {
  for (  String message : Util.fixNull(value).trim().split("String_Node_Str")) {
    try {
      Pattern.compile(message);
    }
 catch (    PatternSyntaxException e) {
      return FormValidation.error("String_Node_Str" + e.getMessage());
    }
  }
  return FormValidation.ok();
}

Fixed version (ground truth):
/** 
 * Validates the excludeCommitMessages field.
 * @param value value to validate.
 * @return {@link FormValidation}.
 * @throws java.io.IOException            IOException.
 * @throws javax.servlet.ServletException ServletException.
 */
public FormValidation doCheckExcludedCommitMessages(@QueryParameter String value) throws IOException, ServletException {
  for (  String message : Util.fixNull(value).trim().split("String_Node_Str")) {
    try {
      Pattern.compile(message);
    }
 catch (    PatternSyntaxException e) {
      return FormValidation.error("String_Node_Str" + e.getMessage());
    }
  }
  return FormValidation.ok();
}
Program: 152820
Project: 152820
Buggy source:
/** 
 * Validates the value for a local location (local checkout directory).
 * @param value value to validate.
 * @return {@link FormValidation}.
 * @throws java.io.IOException IOException.
 * @throws javax.servlet.ServletException ServletException.
 */
public FormValidation doCheckLocal(@QueryParameter String value) throws IOException, ServletException {
  String v=Util.nullify(value);
  if (v == null) {
    return FormValidation.ok();
  }
  v=v.trim();
  if (v.startsWith("String_Node_Str") || v.startsWith("String_Node_Str") || v.startsWith("String_Node_Str")|| v.matches("String_Node_Str")) {
    return FormValidation.error("String_Node_Str");
  }
  return FormValidation.ok();
}

Fixed version (ground truth):
/** 
 * Validates the value for a local location (local checkout directory).
 * @param value value to validate.
 * @return {@link FormValidation}.
 * @throws java.io.IOException            IOException.
 * @throws javax.servlet.ServletException ServletException.
 */
public FormValidation doCheckLocal(@QueryParameter String value) throws IOException, ServletException {
  String v=Util.nullify(value);
  if (v == null) {
    return FormValidation.ok();
  }
  v=v.trim();
  if (v.startsWith("String_Node_Str") || v.startsWith("String_Node_Str") || v.startsWith("String_Node_Str")|| v.matches("String_Node_Str")) {
    return FormValidation.error("String_Node_Str");
  }
  return FormValidation.ok();
}
Program: 152821
Project: 152821
Buggy source:
/** 
 * Validates the includedRegions Regex.
 * @param value value to validate.
 * @return {@link FormValidation}.
 * @throws java.io.IOException IOException.
 * @throws javax.servlet.ServletException ServletException.
 */
public FormValidation doCheckIncludedRegions(@QueryParameter String value) throws IOException, ServletException {
  return doCheckExcludedRegions(value);
}

Fixed version (ground truth):
/** 
 * Validates the includedRegions Regex.
 * @param value value to validate.
 * @return {@link FormValidation}.
 * @throws java.io.IOException            IOException.
 * @throws javax.servlet.ServletException ServletException.
 */
public FormValidation doCheckIncludedRegions(@QueryParameter String value) throws IOException, ServletException {
  return doCheckExcludedRegions(value);
}
Program: 152822
Project: 152822
Buggy source:
/** 
 * Verify if two arrays of objects are equal without same order of elements.
 * @param array1 first array.
 * @param array2 second array.
 * @return true if two arrays equals and false in other way.
 */
public static boolean isEqualsWithoutOrdering(Object[] array1,Object[] array2){
  if (array1 == null && array2 == null) {
    return true;
  }
  if (array1 == null || array2 == null) {
    return false;
  }
  if (array1.length != array2.length) {
    return false;
  }
  for (int i=0; i < array1.length; i++) {
    boolean contains=false;
    for (int j=0; j < array2.length; j++) {
      if (array1[i] == null && array2[i] == null) {
        contains=true;
        break;
      }
      if (array1[i] != null && array1[i].equals(array2[j])) {
        contains=true;
        break;
      }
    }
    if (!contains)     return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Verify if two arrays of objects are equal without same order of elements.
 * @param array1 first array.
 * @param array2 second array.
 * @return true if two arrays equals and false in other way.
 */
public static boolean isEqualsWithoutOrdering(Object[] array1,Object[] array2){
  if (array1 == null && array2 == null) {
    return true;
  }
  if (array1 == null || array2 == null) {
    return false;
  }
  if (array1.length != array2.length) {
    return false;
  }
  for (int i=0; i < array1.length; i++) {
    boolean contains=false;
    for (int j=0; j < array2.length; j++) {
      if (array1[i] == null && array2[i] == null) {
        contains=true;
        break;
      }
      if (array1[i] != null && array1[i].equals(array2[j])) {
        contains=true;
        break;
      }
    }
    if (!contains) {
      return false;
    }
  }
  return true;
}