nus-yam/ex-repair huggingface dataset:
Program: 4833
Project: 4833
Buggy source:
/** 
 * Write cache so that we only have to calculate them once.
 */
public void persistCache(){
  try {
    ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream(URN_CACHE_FILE));
    oos.writeObject(URN_MAP);
    oos.close();
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
/** 
 * Write cache so that we only have to calculate them once.
 */
public synchronized void persistCache(){
  try {
    ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream(URN_CACHE_FILE));
    oos.writeObject(URN_MAP);
    oos.close();
  }
 catch (  Exception e) {
  }
}
Program: 4834
Project: 4834
Buggy source:
/** 
 * Find any URNs remembered from a previous session for the specified <tt>File</tt> instance.  The returned <tt>Set</tt> is guaranteed to be non-null, but it may be empty.
 * @param file the <tt>File</tt> instance to look up URNs for
 * @return a new <tt>Set</tt> containing any cached URNs for thespeficied <tt>File</tt> instance, guaranteed to be non-null and  unmodifiable, but possibly empty
 */
public Set getUrns(File file){
  if (file.lastModified() == 0L) {
    return EMPTY_SET;
  }
  UrnSetKey key=new UrnSetKey(file);
  Set cachedUrns=(Set)URN_MAP.get(key);
  if (cachedUrns == null) {
    return EMPTY_SET;
  }
  return Collections.unmodifiableSet(cachedUrns);
}

Fixed version (ground truth):
/** 
 * Find any URNs remembered from a previous session for the specified <tt>File</tt> instance.  The returned <tt>Set</tt> is guaranteed to be non-null, but it may be empty.
 * @param file the <tt>File</tt> instance to look up URNs for
 * @return a new <tt>Set</tt> containing any cached URNs for thespeficied <tt>File</tt> instance, guaranteed to be non-null and  unmodifiable, but possibly empty
 */
public synchronized Set getUrns(File file){
  if (file.lastModified() == 0L) {
    return EMPTY_SET;
  }
  UrnSetKey key=new UrnSetKey(file);
  Set cachedUrns=(Set)URN_MAP.get(key);
  if (cachedUrns == null) {
    return EMPTY_SET;
  }
  return Collections.unmodifiableSet(cachedUrns);
}
Program: 4835
Project: 4835
Buggy source:
private boolean readQueueVersion(String str){
  if (indexOfIgnoreCase(str,"String_Node_Str") == -1)   return false;
  String s=HTTPUtils.extractHeaderValue(str);
  float version=Float.parseFloat(s);
  if (version > 0)   _supportsQueueing=true;
  return true;
}

Fixed version (ground truth):
private boolean readQueueVersion(String str){
  if (indexOfIgnoreCase(str,"String_Node_Str") == -1)   return false;
  String s=HTTPUtils.extractHeaderValue(str);
  float version=(new Float(s)).floatValue();
  if (version > 0)   _supportsQueueing=true;
  return true;
}
Program: 4836
Project: 4836
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTest(UploadTest.suite());
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTest(UploadTest.suite());
  suite.addTest(UploaderTest.suite());
  return suite;
}
Program: 4837
Project: 4837
Buggy source:
static File createNewTestFile(int size){
  try {
    File file=File.createTempFile("String_Node_Str","String_Node_Str");
    OutputStream out=new FileOutputStream(file);
    out.write(new byte[size]);
    out.flush();
    out.close();
    return FileManager.getCanonicalFile(file);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str");
    e.printStackTrace();
    System.exit(1);
    return null;
  }
}

Fixed version (ground truth):
File createNewTestFile(int size){
  try {
    File file=File.createTempFile("String_Node_Str","String_Node_Str",directory);
    OutputStream out=new FileOutputStream(file);
    out.write(new byte[size]);
    out.flush();
    out.close();
    return FileManager.getCanonicalFile(file);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str");
    e.printStackTrace();
    System.exit(1);
    return null;
  }
}
Program: 4838
Project: 4838
Buggy source:
/** 
 * Same a createNewTestFile but doesn't actually allocate the requested number of bytes on disk.  Instead returns a subclass of File. 
 */
static File createFakeTestFile(long size){
  File real=createNewTestFile(1);
  return new HugeFakeFile(real.getParentFile(),real.getName(),size);
}

Fixed version (ground truth):
/** 
 * Same a createNewTestFile but doesn't actually allocate the requested number of bytes on disk.  Instead returns a subclass of File. 
 */
File createFakeTestFile(long size){
  File real=createNewTestFile(1);
  return new HugeFakeFile(real.getParentFile(),real.getName(),size);
}
Program: 4840
Project: 4840
Buggy source:
/** 
 * Parses out the timestamp string from the alternate location header string, throwing an exception if there is any error.
 * @param location the full alternate-location HTTP header string,as specified in HUGE v0.93
 * @return the date/time string from the the alternate locationheader, or <tt>null</tt> if the date/time string could not be extracted, is invalid, or does not exist
 */
private static String extractTimestamp(final String location){
  StringTokenizer st=new StringTokenizer(location);
  int numToks=st.countTokens();
  if (numToks != 2 && numToks != 3) {
    return null;
  }
 else {
    String curTok=null;
    for (int i=0; i < numToks; i++) {
      curTok=st.nextToken();
    }
    if (AlternateLocation.isValidTimestamp(curTok)) {
      return curTok;
    }
 else {
      return null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Parses out the timestamp string from the alternate location header string, throwing an exception if there is any error.
 * @param location the full alternate-location HTTP header string,as specified in HUGE v0.93
 * @return the date/time string from the the alternate locationheader, or <tt>null</tt> if the date/time string could not be extracted, is invalid, or does not exist
 */
private static String extractTimestamp(final String location){
  StringTokenizer st=new StringTokenizer(location);
  int numToks=st.countTokens();
  String curTok=null;
  for (int i=0; i < numToks; i++) {
    curTok=st.nextToken();
  }
  if (AlternateLocation.isValidTimestamp(curTok)) {
    return curTok;
  }
 else {
    return null;
  }
}
Program: 4841
Project: 4841
Buggy source:
/** 
 * Removes the timestamp from an alternate location header.  This will remove the timestamp from an alternate location header string that  includes the header name, or from an alternate location string that only contains the alternate location header value.
 * @param locationHeader the string containing the full header, or onlythe header value
 * @return the same string as supplied in the <tt>locationHeader</tt> argument, but with the timestamp removed
 */
private static String removeTimestamp(final String locationHeader){
  StringTokenizer st=new StringTokenizer(locationHeader);
  int numToks=st.countTokens();
  if (numToks == 1 || numToks == 2 || numToks == 3) {
    return st.nextToken();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Removes the timestamp from an alternate location header.  This will remove the timestamp from an alternate location header string that  includes the header name, or from an alternate location string that only contains the alternate location header value.
 * @param locationHeader the string containing the full header, or onlythe header value
 * @return the same string as supplied in the <tt>locationHeader</tt> argument, but with the timestamp removed
 */
private static String removeTimestamp(final String locationHeader){
  StringTokenizer st=new StringTokenizer(locationHeader);
  int numToks=st.countTokens();
  if (numToks == 1) {
    return locationHeader;
  }
  String curTok=null;
  for (int i=0; i < numToks; i++) {
    curTok=st.nextToken();
  }
  int tsIndex=locationHeader.indexOf(curTok);
  if (tsIndex == -1)   return null;
  return locationHeader.substring(0,tsIndex);
}
Program: 4842
Project: 4842
Buggy source:
/** 
 * Throttles the uploads by sleeping periodically
 * @exception IOException If there is any I/O problem while uploading file
 */
private void uploadThrottled(OutputStream ostream) throws IOException {
  while (true) {
    int max=_uploader.getManager().calculateBandwidth();
    int burstSize=max * CYCLE_TIME;
    int c=-1;
    byte[] buf=new byte[1024];
    int burstSent=0;
    long start=System.currentTimeMillis();
    while (burstSent < burstSize) {
      c=_fis.read(buf);
      if (c == -1)       return;
      if (c > (_uploadEnd - _amountRead))       c=_uploadEnd - _amountRead;
      try {
        ostream.write(buf,0,c);
      }
 catch (      java.net.SocketException e) {
        throw new IOException();
      }
      _amountRead+=c;
      _uploader.setAmountUploaded(_amountRead);
      burstSent+=c;
      if (_amountRead >= _uploadEnd)       break;
    }
    long stop=System.currentTimeMillis();
    int elapsed=(int)(stop - start);
    int sleepTime=CYCLE_TIME - elapsed;
    if (sleepTime > 0) {
      try {
        Thread.currentThread().sleep(sleepTime);
      }
 catch (      InterruptedException e) {
        throw new IOException();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Throttles the uploads by sleeping periodically
 * @exception IOException If there is any I/O problem while uploading file
 */
private void uploadThrottled(OutputStream ostream) throws IOException {
  while (true) {
    int max=_uploader.getManager().calculateBandwidth();
    int burstSize=max * CYCLE_TIME;
    int c=-1;
    byte[] buf=new byte[1024];
    int burstSent=0;
    long start=System.currentTimeMillis();
    while (burstSent < burstSize) {
      c=_fis.read(buf);
      if (c == -1)       return;
      if (c > (_uploadEnd - _amountRead))       c=_uploadEnd - _amountRead;
      try {
        ostream.write(buf,0,c);
      }
 catch (      java.net.SocketException e) {
        throw new IOException();
      }
      _amountRead+=c;
      _uploader.setAmountUploaded(_amountRead);
      burstSent+=c;
      if (_amountRead >= _uploadEnd)       return;
    }
    long stop=System.currentTimeMillis();
    int elapsed=(int)(stop - start);
    int sleepTime=CYCLE_TIME - elapsed;
    if (sleepTime > 0) {
      try {
        Thread.currentThread().sleep(sleepTime);
      }
 catch (      InterruptedException e) {
        throw new IOException();
      }
    }
  }
}
Program: 4843
Project: 4843
Buggy source:
public void writeMessageHeaders(OutputStream ostream) throws IOException {
  String str;
  str="String_Node_Str";
  ostream.write(str.getBytes());
  str="String_Node_Str" + CommonUtils.getHttpServer() + "String_Node_Str";
  ostream.write(str.getBytes());
  str="String_Node_Str";
  ostream.write(str.getBytes());
  str="String_Node_Str" + ERROR_MESSAGE.length + "String_Node_Str";
  ostream.write(str.getBytes());
  if (FILE_DESC != null) {
    HTTPUtils.writeHeader(HTTPHeaderName.CONTENT_URN,FILE_DESC.getSHA1Urn(),ostream);
    if (FILE_DESC.hasAlternateLocations()) {
      HTTPUtils.writeHeader(HTTPHeaderName.ALT_LOCATION,FILE_DESC.getAlternateLocationCollection(),ostream);
    }
  }
  str="String_Node_Str";
  ostream.write(str.getBytes());
}

Fixed version (ground truth):
public void writeMessageHeaders(OutputStream ostream) throws IOException {
  String str;
  str="String_Node_Str";
  ostream.write(str.getBytes());
  str="String_Node_Str" + CommonUtils.getHttpServer() + "String_Node_Str";
  ostream.write(str.getBytes());
  str="String_Node_Str";
  ostream.write(str.getBytes());
  str="String_Node_Str" + ERROR_MESSAGE.length + "String_Node_Str";
  ostream.write(str.getBytes());
  if (FILE_DESC != null) {
    URN sha1=FILE_DESC.getSHA1Urn();
    if (sha1 != null) {
      HTTPUtils.writeHeader(HTTPHeaderName.CONTENT_URN,sha1,ostream);
    }
    if (FILE_DESC.hasAlternateLocations()) {
      HTTPUtils.writeHeader(HTTPHeaderName.ALT_LOCATION,FILE_DESC.getAlternateLocationCollection(),ostream);
    }
  }
  str="String_Node_Str";
  ostream.write(str.getBytes());
}
Program: 4846
Project: 4846
Buggy source:
public String getValue(String fieldName){
  fieldName=fieldName.trim();
  return (String)fieldToValue.get(fieldName);
}

Fixed version (ground truth):
public String getValue(String fieldName){
  String retValue=null;
  fieldName=fieldName.trim();
  retValue=(String)fieldToValue.get(fieldName);
  if (fieldName.equals("String_Node_Str") && (retValue != null)) {
    try {
      short index=Short.parseShort(retValue);
      retValue=ID3Reader.getGenreString(index);
      fieldToValue.put(fieldName,retValue);
    }
 catch (    NumberFormatException ignored) {
    }
 finally {
      if (retValue.equals("String_Node_Str")) {
        fieldToValue.remove(fieldName);
        retValue=null;
      }
    }
  }
  return retValue;
}
Program: 4847
Project: 4847
Buggy source:
/** 
 * Notifies this that connect() has been called.  This may decide to give out bootstrap pongs if necessary.
 */
public synchronized void expire(){
  bootstrapHostInProgress=null;
  bootstrapHosts.clear();
  String[] hosts=settings.getQuickConnectHosts();
  for (int i=0; i < hosts.length; i++) {
    Endpoint e=new Endpoint(hosts[i]);
    bootstrapHosts.addLast(e);
    notify();
  }
  int n=getNumUltrapeerHosts();
  for (int i=0; i < n; i++) {
    try {
      ExtendedEndpoint e=getAnEndpointInternal();
      add(e,NORMAL_PRIORITY);
    }
 catch (    NoSuchElementException e) {
      Assert.that(false,i + "String_Node_Str" + n);
    }
  }
}

Fixed version (ground truth):
/** 
 * Notifies this that connect() has been called.  This may decide to give out bootstrap pongs if necessary.
 */
public synchronized void expire(){
  bootstrapHostInProgress=null;
  bootstrapHosts.clear();
  String[] hosts=settings.getQuickConnectHosts();
  for (int i=0; i < hosts.length; i++) {
    try {
      Endpoint e=new Endpoint(hosts[i]);
      bootstrapHosts.addLast(e);
      notify();
    }
 catch (    IllegalArgumentException ignore) {
    }
  }
  int n=getNumUltrapeerHosts();
  for (int i=0; i < n; i++) {
    try {
      ExtendedEndpoint e=getAnEndpointInternal();
      add(e,NORMAL_PRIORITY);
    }
 catch (    NoSuchElementException e) {
      Assert.that(false,i + "String_Node_Str" + n);
    }
  }
}
Program: 4848
Project: 4848
Buggy source:
public void testBootstraps(){
  try {
    SettingsManager.instance().setQuickConnectHosts(new String[]{"String_Node_Str","String_Node_Str"});
    hc.expire();
    hc.add(new Endpoint("String_Node_Str",6346),false);
    hc.add(new Endpoint("String_Node_Str",6346),false);
    hc.add(new Endpoint("String_Node_Str",6346),false);
    Endpoint router1=hc.getAnEndpoint();
    assertTrue(router1.equals(new Endpoint("String_Node_Str",6346)));
    assertTrue(hc.getAnEndpoint().equals(new Endpoint("String_Node_Str",6346)));
    hc.add(new Endpoint("String_Node_Str",6346),true);
    hc.doneWithConnect(router1,false);
    hc.doneWithMessageLoop(router1);
    assertTrue(hc.getAnEndpoint().equals(new Endpoint("String_Node_Str",6346)));
    Endpoint router2=hc.getAnEndpoint();
    assertTrue(router2.equals(new Endpoint("String_Node_Str",6347)));
    assertTrue(hc.getAnEndpoint().equals(new Endpoint("String_Node_Str",6346)));
    hc.doneWithConnect(router2,false);
    hc.doneWithMessageLoop(router2);
    assertTrue(hc.getAnEndpoint().equals(new Endpoint("String_Node_Str",6346)));
  }
 catch (  InterruptedException e) {
    assertTrue("String_Node_Str",false);
  }
}

Fixed version (ground truth):
public void testBootstraps(){
  try {
    SettingsManager.instance().setQuickConnectHosts(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"});
    hc.expire();
    hc.add(new Endpoint("String_Node_Str",6346),false);
    hc.add(new Endpoint("String_Node_Str",6346),false);
    hc.add(new Endpoint("String_Node_Str",6346),false);
    Endpoint router1=hc.getAnEndpoint();
    assertTrue(router1.equals(new Endpoint("String_Node_Str",6346)));
    assertTrue(hc.getAnEndpoint().equals(new Endpoint("String_Node_Str",6346)));
    hc.add(new Endpoint("String_Node_Str",6346),true);
    hc.doneWithConnect(router1,false);
    hc.doneWithMessageLoop(router1);
    assertTrue(hc.getAnEndpoint().equals(new Endpoint("String_Node_Str",6346)));
    Endpoint router2=hc.getAnEndpoint();
    assertTrue(router2.equals(new Endpoint("String_Node_Str",6347)));
    assertTrue(hc.getAnEndpoint().equals(new Endpoint("String_Node_Str",6346)));
    hc.doneWithConnect(router2,false);
    hc.doneWithMessageLoop(router2);
    assertTrue(hc.getAnEndpoint().equals(new Endpoint("String_Node_Str",6346)));
  }
 catch (  InterruptedException e) {
    assertTrue("String_Node_Str",false);
  }
}
Program: 4849
Project: 4849
Buggy source:
public void testAudio(){
  clearDirectory();
  LimeXMLReplyCollection collection=new LimeXMLReplyCollection(files,schemaURI,mfm,audio);
  Assert.assertTrue("String_Node_Str" + collection.getCount(),(collection.getCount() == 2));
  LimeXMLDocument doc=null;
  doc=collection.getDocForHash(mfm.readFromMap(mason));
  Assert.assertTrue("String_Node_Str",doc == null);
  doc=collection.getDocForHash(mfm.readFromMap(vader));
  Assert.assertTrue("String_Node_Str",doc != null);
  doc=collection.getDocForHash(mfm.readFromMap(swing));
  Assert.assertTrue("String_Node_Str",doc != null);
  List keywords=collection.getKeyWords();
  Assert.assertTrue("String_Node_Str" + keywords.size(),(keywords.size() == 4));
  Assert.assertTrue("String_Node_Str",(keywords.contains("String_Node_Str") && keywords.contains("String_Node_Str") && keywords.contains("String_Node_Str")&& keywords.contains("String_Node_Str")));
}

Fixed version (ground truth):
public void testAudio(){
  clearDirectory();
  LimeXMLReplyCollection collection=new LimeXMLReplyCollection(files,schemaURI,mfm,audio);
  Assert.assertTrue("String_Node_Str" + collection.getCount(),(collection.getCount() == 2));
  LimeXMLDocument doc=null;
  doc=collection.getDocForHash(mfm.readFromMap(mason));
  Assert.assertTrue("String_Node_Str",doc == null);
  doc=collection.getDocForHash(mfm.readFromMap(vader));
  Assert.assertTrue("String_Node_Str",doc != null);
  doc=collection.getDocForHash(mfm.readFromMap(swing));
  Assert.assertTrue("String_Node_Str",doc != null);
  List keywords=collection.getKeyWords();
  Assert.assertTrue("String_Node_Str" + keywords.size(),(keywords.size() == 6));
  Assert.assertTrue("String_Node_Str",(keywords.contains("String_Node_Str") && keywords.contains("String_Node_Str") && keywords.contains("String_Node_Str")&& keywords.contains("String_Node_Str")&& keywords.contains("String_Node_Str")&& keywords.contains("String_Node_Str")));
}
Program: 4851
Project: 4851
Buggy source:
/** 
 * Instructs this to stop after reading the given byte in the file.
 * @param stop the byte offset to stop at
 */
public void stopAt(int stop){
  _amountToRead=(stop - _initialReadingPoint);
}

Fixed version (ground truth):
/** 
 * Instructs this stop just before reading the given byte.
 * @param stop the index just past the last byte to read;stop-1 is the index of the last byte to be downloaded
 */
public void stopAt(int stop){
  _amountToRead=(stop - _initialReadingPoint);
}
Program: 4854
Project: 4854
Buggy source:
/** 
 * Assigns a white part of the file to a HTTPDownloader and returns it. This method has side effects.
 */
private void assignWhite(HTTPDownloader dloader) throws IOException, TryAgainLaterException, FileNotFoundException, NotSharingException {
  Interval interval=null;
synchronized (this) {
    interval=(Interval)needed.remove(0);
  }
  dloader.connectHTTP(getOverlapOffset(interval.low),interval.high);
  dloader.stopAt(interval.high + 1);
  debug("String_Node_Str" + interval + "String_Node_Str"+ dloader);
}

Fixed version (ground truth):
/** 
 * Assigns a white part of the file to a HTTPDownloader and returns it. This method has side effects.
 */
private void assignWhite(HTTPDownloader dloader) throws IOException, TryAgainLaterException, FileNotFoundException, NotSharingException {
  Interval interval=null;
synchronized (this) {
    interval=(Interval)needed.remove(0);
  }
  dloader.connectHTTP(getOverlapOffset(interval.low),interval.high + 1);
  dloader.stopAt(interval.high + 1);
  debug("String_Node_Str" + interval + "String_Node_Str"+ dloader);
}
Program: 4856
Project: 4856
Buggy source:
private void send(OutputStream out,int start,int stop) throws IOException {
  String str="String_Node_Str";
  out.write(str.getBytes());
  str="String_Node_Str" + (stop - start) + "String_Node_Str";
  out.write(str.getBytes());
  if (start != 0) {
    str="String_Node_Str" + start + "String_Node_Str"+ (stop - 1)+ "String_Node_Str"+ TestFile.length()+ "String_Node_Str";
    out.write(str.getBytes());
  }
  if (storedAltLocs.hasAlternateLocations())   HTTPUtils.writeHeader(HTTPHeaderName.ALT_LOCATION,storedAltLocs,out);
  str="String_Node_Str";
  out.write(str.getBytes());
  out.flush();
  for (int i=start; i < stop; ) {
    long startTime=System.currentTimeMillis();
    for (int j=0; j < Math.max(1,(rate * 1024)) && i < stop; j++) {
      if (stopAfter > -1 && totalUploaded >= stopAfter) {
        stopped=true;
        out.flush();
        throw new IOException();
      }
      if (sendCorrupt)       out.write(TestFile.getByte(i) + (byte)1);
 else       out.write(TestFile.getByte(i));
      totalUploaded++;
      i++;
    }
    long elapsed=System.currentTimeMillis() - startTime;
    long wait=1000 - elapsed;
    if (wait > 0)     try {
      Thread.sleep(wait);
    }
 catch (    InterruptedException e) {
    }
  }
  out.flush();
}

Fixed version (ground truth):
private void send(OutputStream out,int start,int stop) throws IOException {
  String str=busy ? "String_Node_Str" : "String_Node_Str";
  out.write(str.getBytes());
  if (busy) {
    String s="String_Node_Str";
    out.write(s.getBytes());
    out.flush();
    out.close();
    return;
  }
  str="String_Node_Str" + (stop - start) + "String_Node_Str";
  out.write(str.getBytes());
  if (start != 0) {
    str="String_Node_Str" + start + "String_Node_Str"+ (stop - 1)+ "String_Node_Str"+ TestFile.length()+ "String_Node_Str";
    out.write(str.getBytes());
  }
  if (storedAltLocs.hasAlternateLocations())   HTTPUtils.writeHeader(HTTPHeaderName.ALT_LOCATION,storedAltLocs,out);
  str="String_Node_Str";
  out.write(str.getBytes());
  out.flush();
  for (int i=start; i < stop; ) {
    long startTime=System.currentTimeMillis();
    for (int j=0; j < Math.max(1,(rate * 1024)) && i < stop; j++) {
      if (stopAfter > -1 && totalUploaded >= stopAfter) {
        stopped=true;
        out.flush();
        throw new IOException();
      }
      if (sendCorrupt)       out.write(TestFile.getByte(i) + (byte)1);
 else       out.write(TestFile.getByte(i));
      totalUploaded++;
      i++;
    }
    long elapsed=System.currentTimeMillis() - startTime;
    long wait=1000 - elapsed;
    if (wait > 0)     try {
      Thread.sleep(wait);
    }
 catch (    InterruptedException e) {
    }
  }
  out.flush();
}
Program: 4857
Project: 4857
Buggy source:
/** 
 * @return Correctly uncompressed data (according to Content-Type header) May return a byte[] of length 0 if something bad happens. 
 */
public static byte[] uncompress(byte[] data) throws Exception {
  byte[] retBytes=new byte[0];
  String headerFragment=new String(data,0,C_HEADER_BEGIN.length());
  if (headerFragment.equals(C_HEADER_BEGIN)) {
    headerFragment=new String(data,(C_HEADER_BEGIN.length()),max3(C_HEADER_NONE_VAL.length(),C_HEADER_ZLIB_VAL.length(),C_HEADER_GZIP_VAL.length()));
    if (headerFragment.indexOf(C_HEADER_NONE_VAL) == 0) {
      retBytes=new byte[data.length - COMPRESS_HEADER_NONE.length()];
      System.arraycopy(data,COMPRESS_HEADER_NONE.length(),retBytes,0,data.length - COMPRESS_HEADER_NONE.length());
    }
 else     if (headerFragment.indexOf(C_HEADER_GZIP_VAL) == 0) {
      retBytes=new byte[data.length - COMPRESS_HEADER_GZIP.length()];
      System.arraycopy(data,COMPRESS_HEADER_GZIP.length(),retBytes,0,data.length - COMPRESS_HEADER_GZIP.length());
      retBytes=uncompressGZIP(retBytes);
    }
 else     if (headerFragment.indexOf(C_HEADER_ZLIB_VAL) == 0) {
      retBytes=new byte[data.length - COMPRESS_HEADER_ZLIB.length()];
      System.arraycopy(data,COMPRESS_HEADER_ZLIB.length(),retBytes,0,data.length - COMPRESS_HEADER_ZLIB.length());
      retBytes=uncompressZLIB(retBytes);
    }
 else     ;
  }
 else   return data;
  return retBytes;
}

Fixed version (ground truth):
/** 
 * @return Correctly uncompressed data (according to Content-Type header) May return a byte[] of length 0 if something bad happens. 
 */
public static byte[] uncompress(byte[] data) throws Exception {
  byte[] retBytes=new byte[0];
  String headerFragment=new String(data,0,C_HEADER_BEGIN.length());
  if (headerFragment.equals(C_HEADER_BEGIN)) {
    boolean found=false;
    int i=0;
    for (; i < data.length && !found; i++)     if (data[i] == (byte)125)     found=true;
    headerFragment=new String(data,1,i - 1 - 1);
    int comp=getCompressionType(headerFragment);
    if (comp == NONE) {
      retBytes=new byte[data.length - (headerFragment.length() + 2)];
      System.arraycopy(data,i,retBytes,0,data.length - (headerFragment.length() + 2));
    }
 else     if (comp == GZIP) {
      retBytes=new byte[data.length - COMPRESS_HEADER_GZIP.length()];
      System.arraycopy(data,COMPRESS_HEADER_GZIP.length(),retBytes,0,data.length - COMPRESS_HEADER_GZIP.length());
      retBytes=uncompressGZIP(retBytes);
    }
 else     if (comp == ZLIB) {
      retBytes=new byte[data.length - COMPRESS_HEADER_ZLIB.length()];
      System.arraycopy(data,COMPRESS_HEADER_ZLIB.length(),retBytes,0,data.length - COMPRESS_HEADER_ZLIB.length());
      retBytes=uncompressZLIB(retBytes);
    }
 else     ;
  }
 else   return data;
  return retBytes;
}
Program: 4858
Project: 4858
Buggy source:
public void testEncode() throws java.io.IOException {
  for (int num=1; num < 512; num++) {
    System.out.println("String_Node_Str" + num);
    byte[] bytes=new byte[num];
    for (int i=0; i < bytes.length; i++)     bytes[i]=0;
    byte[] after=COBSUtil.cobsEncode(bytes);
    assertTrue(bytes.length == (after.length - 1));
    for (int i=0; i < after.length; i++)     assertTrue(after[i] == 0x01);
    for (int i=0; i < bytes.length; i++)     if (i % 2 == 0)     bytes[i]=0;
 else     bytes[i]=1;
    after=COBSUtil.cobsEncode(bytes);
    assertTrue(bytes.length == (after.length - 1));
    for (int i=0; i < after.length; i++)     if (i % 2 == 0)     after[i]=2;
 else     after[i]=1;
    for (int i=0; i < bytes.length; i++)     if (i % 3 == 0)     bytes[i]=0;
 else     bytes[i]=1;
    after=COBSUtil.cobsEncode(bytes);
    assertTrue(bytes.length == (after.length - 1));
    for (int i=0; i < after.length; i++)     if (i % 3 == 0)     after[i]=3;
 else     after[i]=1;
    for (int i=0; i < bytes.length; i++)     if (i % 255 == 0)     bytes[i]=0;
 else     bytes[i]=1;
    after=COBSUtil.cobsEncode(bytes);
    assertTrue(bytes.length == (after.length - 1));
    for (int i=0; i < after.length; i++)     if (i % 255 == 0)     after[i]=(byte)0xFF;
 else     after[i]=1;
    for (int i=0; i < bytes.length; i++)     if (i % 2 == 0)     bytes[i]=1;
 else     bytes[i]=0;
    after=COBSUtil.cobsEncode(bytes);
    assertTrue(bytes.length == (after.length - 1));
    for (int i=0; i < bytes.length; i++)     if (i % 2 == 0)     after[i]=2;
 else     after[i]=1;
    assertTrue(after[num] == 1);
    for (int i=0; i < bytes.length; i++)     if ((i + 1) % 3 == 0)     bytes[i]=0;
 else     bytes[i]=1;
    after=COBSUtil.cobsEncode(bytes);
    assertTrue(bytes.length == (after.length - 1));
    for (int i=0; i < bytes.length; i++)     if ((i + 1) % 3 == 0)     after[i]=3;
 else     after[i]=1;
    assertTrue(after[num] == 1);
    for (int i=0; i < bytes.length; i++)     if ((i + 1) % 255 == 0)     bytes[i]=0;
 else     bytes[i]=1;
    after=COBSUtil.cobsEncode(bytes);
    assertTrue(bytes.length == (after.length - 1));
    for (int i=0; i < after.length; i++)     if ((i + 1) % 255 == 0)     after[i]=(byte)0xFF;
 else     after[i]=1;
    assertTrue(after[num] == 1);
  }
}

Fixed version (ground truth):
public void testEncode() throws java.io.IOException {
  for (int num=255; num < 260; num++)   encode(num);
}
Program: 4859
Project: 4859
Buggy source:
public LimeXMLDocument readDocument(File file) throws IOException {
  Object[] info=parseFile(file);
  short track=((Short)info[4]).shortValue(), gen=((Short)info[6]).shortValue();
  int bitrate=((Integer)info[7]).intValue(), seconds=((Integer)info[8]).intValue();
  List nameValList=new ArrayList();
  nameValList.add(new NameValue(TITLE_KEY,info[0]));
  nameValList.add(new NameValue(ARTIST_KEY,info[1]));
  nameValList.add(new NameValue(ALBUM_KEY,info[2]));
  nameValList.add(new NameValue(YEAR_KEY,info[3]));
  nameValList.add(new NameValue(COMMENTS_KEY,info[5]));
  nameValList.add(new NameValue(TRACK_KEY,"String_Node_Str" + track));
  nameValList.add(new NameValue(GENRE_KEY,"String_Node_Str" + gen));
  nameValList.add(new NameValue(BITRATE_KEY,"String_Node_Str" + bitrate));
  nameValList.add(new NameValue(SECONDS_KEY,"String_Node_Str" + seconds));
  return new LimeXMLDocument(nameValList,schemaURI);
}

Fixed version (ground truth):
public LimeXMLDocument readDocument(File file) throws IOException {
  Object[] info=parseFile(file);
  short track=((Short)info[4]).shortValue();
  short gen=((Short)info[6]).shortValue();
  int bitrate=((Integer)info[7]).intValue();
  int seconds=((Integer)info[8]).intValue();
  String genre=getGenreString(gen);
  List nameValList=new ArrayList();
  if (!((String)info[0]).equals("String_Node_Str"))   nameValList.add(new NameValue(TITLE_KEY,info[0]));
  if (!((String)info[1]).equals("String_Node_Str"))   nameValList.add(new NameValue(ARTIST_KEY,info[1]));
  if (!((String)info[2]).equals("String_Node_Str"))   nameValList.add(new NameValue(ALBUM_KEY,info[2]));
  if (!((String)info[3]).equals("String_Node_Str"))   nameValList.add(new NameValue(YEAR_KEY,info[3]));
  if (!((String)info[5]).equals("String_Node_Str"))   nameValList.add(new NameValue(COMMENTS_KEY,info[5]));
  if (track > 0)   nameValList.add(new NameValue(TRACK_KEY,"String_Node_Str" + track));
  if (!genre.equals("String_Node_Str"))   nameValList.add(new NameValue(GENRE_KEY,genre));
  if (bitrate > 0)   nameValList.add(new NameValue(BITRATE_KEY,"String_Node_Str" + bitrate));
  if (seconds > 0)   nameValList.add(new NameValue(SECONDS_KEY,"String_Node_Str" + seconds));
  return new LimeXMLDocument(nameValList,schemaURI);
}
Program: 4861
Project: 4861
Buggy source:
public void writeMessageHeaders(OutputStream os){
}

Fixed version (ground truth):
public void writeMessageHeaders(OutputStream os) throws IOException {
  String str;
  str="String_Node_Str";
  os.write(str.getBytes());
  str="String_Node_Str" + CommonUtils.getHttpServer() + "String_Node_Str";
  os.write(str.getBytes());
  str="String_Node_Str";
  os.write(str.getBytes());
  str="String_Node_Str" + RESPONSE_PAGE.length() + "String_Node_Str";
  os.write(str.getBytes());
  str="String_Node_Str";
  os.write(str.getBytes());
}
Program: 4862
Project: 4862
Buggy source:
public void writeMessageBody(OutputStream os){
}

Fixed version (ground truth):
public void writeMessageBody(OutputStream os) throws IOException {
  os.write(RESPONSE_PAGE.getBytes());
  os.flush();
}
Program: 4863
Project: 4863
Buggy source:
/** 
 * Converts the specified <tt>Date</tt> instance to a <tt>String</tt>  that fits the syntax specified in the ISO 8601 subset we're using, discussed at: http://www.w3.org/TR/NOTE-datetime.
 * @param date the <tt>Date</tt> instance to convert
 * @return a new <tt>String</tt> instance that matches the standardsyntax
 */
private static String convertDateToString(Date date){
  Calendar cal=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
  cal.setTime(date);
  int[] dateInts=new int[6];
  String[] dateStrs=new String[6];
  dateInts[0]=cal.get(Calendar.YEAR);
  dateInts[1]=cal.get(Calendar.MONTH);
  dateInts[2]=cal.get(Calendar.DAY_OF_MONTH);
  dateInts[3]=cal.get(Calendar.HOUR);
  dateInts[4]=cal.get(Calendar.MINUTE);
  dateInts[5]=cal.get(Calendar.SECOND);
  for (int i=0; i < dateInts.length; i++) {
    if (dateInts[i] < 10) {
      dateStrs[i]="String_Node_Str" + String.valueOf(dateInts[i]);
    }
 else {
      dateStrs[i]=String.valueOf(dateInts[i]);
    }
  }
  final String DASH="String_Node_Str";
  final String COLON="String_Node_Str";
  return (dateStrs[0] + DASH + dateStrs[1]+ DASH+ dateStrs[2]+ "String_Node_Str"+ dateStrs[3]+ COLON+ dateStrs[4]+ COLON+ dateStrs[5]+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Converts the specified <tt>Date</tt> instance to a <tt>String</tt>  that fits the syntax specified in the ISO 8601 subset we're using, discussed at: http://www.w3.org/TR/NOTE-datetime.
 * @param date the <tt>Date</tt> instance to convert
 * @return a new <tt>String</tt> instance that matches the standardsyntax
 */
private static String convertDateToString(Date date){
  Calendar cal=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
  cal.setTime(date);
  int[] dateInts=new int[6];
  String[] dateStrs=new String[6];
  dateInts[0]=cal.get(Calendar.YEAR);
  dateInts[1]=cal.get(Calendar.MONTH) + 1;
  dateInts[2]=cal.get(Calendar.DAY_OF_MONTH);
  dateInts[3]=cal.get(Calendar.HOUR);
  dateInts[4]=cal.get(Calendar.MINUTE);
  dateInts[5]=cal.get(Calendar.SECOND);
  for (int i=0; i < dateInts.length; i++) {
    if (dateInts[i] < 10) {
      dateStrs[i]="String_Node_Str" + String.valueOf(dateInts[i]);
    }
 else {
      dateStrs[i]=String.valueOf(dateInts[i]);
    }
  }
  final String DASH="String_Node_Str";
  final String COLON="String_Node_Str";
  StringBuffer sb=new StringBuffer();
  sb.append(dateStrs[0]);
  sb.append(DASH);
  sb.append(dateStrs[1]);
  sb.append(DASH);
  sb.append(dateStrs[2]);
  sb.append("String_Node_Str");
  sb.append(dateStrs[3]);
  sb.append(COLON);
  sb.append(dateStrs[4]);
  sb.append(COLON);
  sb.append(dateStrs[5]);
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 4864
Project: 4864
Buggy source:
/** 
 * Returns the URN type string for this URN.  For example, if the String for this URN is:<p> urn:sha1:PLSTHIPQGSSZTS5FJUPAKUZWUGYQYPFB <p> then this method will return: <p> urn:sha1:
 */
private static String getTypeString(String fullUrnString){
  return fullUrnString.substring(0,fullUrnString.indexOf(':',4) + 1);
}

Fixed version (ground truth):
/** 
 * Returns the URN type string for this URN.  For example, if the String for this URN is:<p> urn:sha1:PLSTHIPQGSSZTS5FJUPAKUZWUGYQYPFB <p> then this method will return: <p> urn:sha1:
 */
private static String getTypeString(String fullUrnString){
  String protocol=fullUrnString.substring(0,fullUrnString.lastIndexOf(':') + 1);
  return protocol.trim();
}
Program: 4865
Project: 4865
Buggy source:
/** 
 * Create a new SHA1 hash string for the specified file on disk.
 * @param file the file to construct the hash from
 * @return the SHA1 hash string
 * @throws <tt>IOException</tt> if there is an error creating the hash
 * @throws <tt>NoSuchAlgorithmException</tt> if the specified algorithmcannot be found
 */
private static String createSHA1String(final File file) throws IOException {
  FileInputStream fis=new FileInputStream(file);
  MessageDigest md=null;
  try {
    md=MessageDigest.getInstance("String_Node_Str");
  }
 catch (  NoSuchAlgorithmException e) {
    throw new IOException("String_Node_Str");
  }
  byte[] buffer=new byte[16384];
  int read;
  while ((read=fis.read(buffer)) != -1) {
    long start=System.currentTimeMillis();
    md.update(buffer,0,read);
    long end=System.currentTimeMillis();
    long interval=Math.abs(end - start);
    try {
      Thread.sleep(interval * 2);
    }
 catch (    InterruptedException e) {
    }
  }
  fis.close();
  byte[] sha1=md.digest();
  return UrnType.URN_NAMESPACE_ID + UrnType.SHA1_STRING + "String_Node_Str"+ Base32.encode(sha1);
}

Fixed version (ground truth):
/** 
 * Create a new SHA1 hash string for the specified file on disk.
 * @param file the file to construct the hash from
 * @return the SHA1 hash string
 * @throws <tt>IOException</tt> if there is an error creating the hash
 * @throws <tt>NoSuchAlgorithmException</tt> if the specified algorithmcannot be found
 */
private static String createSHA1String(final File file) throws IOException {
  FileInputStream fis=new FileInputStream(file);
  MessageDigest md=null;
  try {
    md=MessageDigest.getInstance("String_Node_Str");
  }
 catch (  NoSuchAlgorithmException e) {
    throw new IOException("String_Node_Str");
  }
  byte[] buffer=new byte[16384];
  int read;
  while ((read=fis.read(buffer)) != -1) {
    long start=System.currentTimeMillis();
    md.update(buffer,0,read);
    long end=System.currentTimeMillis();
    long interval=Math.abs(end - start);
    try {
      Thread.sleep(interval * 2);
    }
 catch (    InterruptedException e) {
    }
  }
  fis.close();
  byte[] sha1=md.digest();
  return UrnType.URN_NAMESPACE_ID + UrnType.SHA1_STRING + Base32.encode(sha1);
}
Program: 4866
Project: 4866
Buggy source:
/** 
 * Walks back through the byte array to trim off null characters and spaces.  A helper for read(...) above.
 * @return the number of bytes with nulls and spaces trimmed.
 */
private static int getTrimmedLength(byte[] bytes,int includedLength){
  int i;
  for (i=includedLength - 1; (i >= 0) && ((bytes[i] == 0) || (bytes[i] == 32)); i--)   ;
  return i + 1;
}

Fixed version (ground truth):
/** 
 * Walks back through the byte array to trim off null characters and spaces.  A helper for read(...) above.
 * @return the number of bytes with nulls and spaces trimmed.
 */
private static int getTrimmedLength(byte[] bytes,int includedLength){
  int i;
  for (i=includedLength - 1; (i >= 0) && ((bytes[i] == 0) || (bytes[i] == 32)); i--)   ;
  for (int j=0; j <= i; j++)   if (bytes[j] == 0)   bytes[j]=(byte)32;
  return i + 1;
}
Program: 4867
Project: 4867
Buggy source:
/** 
 * Clears this', reloads this' extensions, generates an array of directories, and then indexes the generated directories files. NOTE TO SUBCLASSES: extend this method as needed, it shall be threaded and run asynchronously as to not slow down the main thread (the GUI).
 * @modifies this 
 */
protected void loadSettingsBlocking(boolean notifyOnClear){
  File[] tempDirVar;
synchronized (this) {
    _size=0;
    _numFiles=0;
    _files=new ArrayList();
    _index=new Trie(true);
    _extensions=new TreeSet(new StringComparator());
    _sharedDirectories=new TreeMap(new FileComparator());
    String[] extensions=StringUtils.split(SettingsManager.instance().getExtensions().trim(),';');
    for (int i=0; (i < extensions.length) && !_loadThreadInterrupted; i++)     _extensions.add(extensions[i].toLowerCase());
    final File[] directories=SettingsManager.instance().getDirectories();
    Arrays.sort(directories,new Comparator(){
      public int compare(      Object a,      Object b){
        return (a.toString()).length() - (b.toString()).length();
      }
    }
);
    tempDirVar=directories;
  }
  final File[] directories=tempDirVar;
  if (notifyOnClear)   _callback.clearSharedFiles();
{
    int i=0;
    while (i < directories.length && !_loadThreadInterrupted) {
      addDirectory(directories[i],null);
      i++;
    }
    if (!_loadThreadInterrupted)     trim();
  }
  UrnCache.instance().persistCache();
}

Fixed version (ground truth):
/** 
 * Clears this', reloads this' extensions, generates an array of directories, and then indexes the generated directories files. NOTE TO SUBCLASSES: extend this method as needed, it shall be threaded and run asynchronously as to not slow down the main thread (the GUI).
 * @modifies this 
 */
protected void loadSettingsBlocking(boolean notifyOnClear){
  File[] tempDirVar;
synchronized (this) {
    _size=0;
    _numFiles=0;
    _files=new ArrayList();
    _index=new Trie(true);
    _extensions=new TreeSet(new StringComparator());
    _sharedDirectories=new TreeMap(new FileComparator());
    String[] extensions=StringUtils.split(SettingsManager.instance().getExtensions().trim(),';');
    for (int i=0; (i < extensions.length) && !loadThreadInterrupted(); i++)     _extensions.add(extensions[i].toLowerCase());
    final File[] directories=SettingsManager.instance().getDirectories();
    Arrays.sort(directories,new Comparator(){
      public int compare(      Object a,      Object b){
        return (a.toString()).length() - (b.toString()).length();
      }
    }
);
    tempDirVar=directories;
  }
  final File[] directories=tempDirVar;
  if (notifyOnClear)   _callback.clearSharedFiles();
{
    int i=0;
    while (i < directories.length && !loadThreadInterrupted()) {
      addDirectory(directories[i],null);
      i++;
    }
    if (!loadThreadInterrupted())     trim();
  }
  UrnCache.instance().persistCache();
}
Program: 4868
Project: 4868
Buggy source:
/** 
 * @requires directory is part of DIRECTORIES_TO_SEARCH_FOR_FILES or one ofits children, and parent is directory's shared parent or null if directory's parent is not shared.
 * @modifies this
 * @effects adds all files with shared extensions in directory and its(recursive) children to this.  If directory doesn't exist, isn't a  directory, or has already been added, does nothing.  Entries in this  before the call are unmodified. This method is thread-safe.  It acquires locks on a per-file basis. If the _loadThread is interrupted while adding the contents of the directory, it returns immediately.  
 */
private void addDirectory(File directory,File parent){
  try {
    directory=getCanonicalFile(directory);
  }
 catch (  IOException e) {
    return;
  }
  File[] file_list=listFiles(directory);
  if (file_list == null)   return;
  int n=file_list.length;
synchronized (this) {
    if (_sharedDirectories.get(directory) != null)     return;
    _sharedDirectories.put(directory,new IntSet());
    if (_callback != null)     _callback.addSharedDirectory(directory,parent);
  }
  List directories=new ArrayList();
  for (int i=0; i < n && !_loadThreadInterrupted; i++) {
    if (file_list[i].isDirectory())     directories.add(file_list[i]);
 else     addFile((File)file_list[i]);
  }
  Iterator iter=directories.iterator();
  while (iter.hasNext() && !_loadThreadInterrupted)   addDirectory((File)iter.next(),directory);
}

Fixed version (ground truth):
/** 
 * @requires directory is part of DIRECTORIES_TO_SEARCH_FOR_FILES or one ofits children, and parent is directory's shared parent or null if directory's parent is not shared.
 * @modifies this
 * @effects adds all files with shared extensions in directory and its(recursive) children to this.  If directory doesn't exist, isn't a  directory, or has already been added, does nothing.  Entries in this  before the call are unmodified. This method is thread-safe.  It acquires locks on a per-file basis. If the _loadThread is interrupted while adding the contents of the directory, it returns immediately.  
 */
private void addDirectory(File directory,File parent){
  try {
    directory=getCanonicalFile(directory);
  }
 catch (  IOException e) {
    return;
  }
  File[] file_list=listFiles(directory);
  if (file_list == null)   return;
  int n=file_list.length;
synchronized (this) {
    if (_sharedDirectories.get(directory) != null)     return;
    _sharedDirectories.put(directory,new IntSet());
    if (_callback != null)     _callback.addSharedDirectory(directory,parent);
  }
  List directories=new ArrayList();
  for (int i=0; i < n && !loadThreadInterrupted(); i++) {
    if (file_list[i].isDirectory())     directories.add(file_list[i]);
 else     addFile((File)file_list[i]);
  }
  Iterator iter=directories.iterator();
  while (iter.hasNext() && !loadThreadInterrupted())   addDirectory((File)iter.next(),directory);
}
Program: 4870
Project: 4870
Buggy source:
/** 
 * This method overrides FileManager.loadSettingsBlocking(), though it calls the super method to load up the shared file DB.  Then, it processes these files and annotates them automatically as apropos. TODO2: Eventually we will think that its too much of a burden to have this thread be blocking in which case we will have to  have the load thread also handle the reloading of the meta-data. Question: Do we really want to reload the meta-data whenever a we want to update the file information?? It depends on how we want to  handle the meta-data and its relation to the file system
 */
protected void loadSettingsBlocking(boolean notifyOnClear){
  super.loadSettingsBlocking(notifyOnClear);
  if (Thread.currentThread().isInterrupted())   return;
synchronized (metaLocker) {
    if (!initialized) {
      fileToHash.clear();
      createFileToHashMaps();
      SchemaReplyCollectionMapper mapper=SchemaReplyCollectionMapper.instance();
      LimeXMLSchemaRepository schemaRepository=LimeXMLSchemaRepository.instance();
      if (Thread.currentThread().isInterrupted())       return;
      String[] schemas=schemaRepository.getAvailableSchemaURIs();
      int len=schemas.length;
      LimeXMLReplyCollection collection;
      for (int i=0; (i < len) && !Thread.currentThread().isInterrupted(); i++) {
        String s=LimeXMLSchema.getDisplayString(schemas[i]);
        collection=new LimeXMLReplyCollection(fileToHash,schemas[i],this,s.equalsIgnoreCase("String_Node_Str"));
        mapper.add(schemas[i],collection);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * This method overrides FileManager.loadSettingsBlocking(), though it calls the super method to load up the shared file DB.  Then, it processes these files and annotates them automatically as apropos. TODO2: Eventually we will think that its too much of a burden to have this thread be blocking in which case we will have to  have the load thread also handle the reloading of the meta-data. Question: Do we really want to reload the meta-data whenever a we want to update the file information?? It depends on how we want to  handle the meta-data and its relation to the file system
 */
protected void loadSettingsBlocking(boolean notifyOnClear){
  super.loadSettingsBlocking(notifyOnClear);
  if (loadThreadInterrupted())   return;
synchronized (metaLocker) {
    if (!initialized) {
      fileToHash.clear();
      createFileToHashMaps();
      SchemaReplyCollectionMapper mapper=SchemaReplyCollectionMapper.instance();
      LimeXMLSchemaRepository schemaRepository=LimeXMLSchemaRepository.instance();
      if (loadThreadInterrupted())       return;
      String[] schemas=schemaRepository.getAvailableSchemaURIs();
      int len=schemas.length;
      LimeXMLReplyCollection collection;
      for (int i=0; (i < len) && !loadThreadInterrupted(); i++) {
        String s=LimeXMLSchema.getDisplayString(schemas[i]);
        collection=new LimeXMLReplyCollection(fileToHash,schemas[i],this,s.equalsIgnoreCase("String_Node_Str"));
        mapper.add(schemas[i],collection);
      }
    }
  }
}