Program: 46332
Project: 46332
Buggy source:
/** 
 * Synchronously download an asset from a server, given the asset and the url of the server to look for the asset. The asset object will be updated with the local file containing the cached asset and the locally computed  checksum. Returns true upon success, false upon failure
 * @param asset The asset to download
 * @param url The full URL to the asset
 * @param progressListener Notified of updates in the loading
 * @return True upon success, false upon failure 
 */
private boolean getAssetFromServer(Asset asset,String url,ProgressListener progressListener){
  try {
    logger.fine("String_Node_Str" + url.toString());
    URLConnection connection=new URL(url).openConnection();
    TrackingInputStream track=new TrackingInputStream(connection.getInputStream());
    InputStream in=new BufferedInputStream(track);
    if (progressListener != null) {
      track.setListener(progressListener,AssetManager.UPDATE_BYTE_INTERVAL,connection.getContentLength());
    }
    AssetID assetID=new AssetID(asset.getResourceURI(),asset.getChecksum());
    String cacheFile=this.getAssetCacheFileName(assetID);
    File file=new File(cacheFile);
    if (!file.canWrite())     makeDirectory(file);
    byte[] buf=new byte[AssetManager.NETWORK_CHUNK_SIZE];
    MessageDigest digest=MessageDigest.getInstance(CHECKSUM_ALGORITHM);
    OutputStream out=new DigestOutputStream(new BufferedOutputStream(new FileOutputStream(file),buf.length),digest);
    int c=in.read(buf);
    while (c > 0) {
      out.write(buf,0,c);
      c=in.read(buf);
    }
    in.close();
    out.close();
    track.close();
    asset.setChecksum(Checksum.toHexString(digest.digest()));
    digest.reset();
    asset.setLocalCacheFile(file);
    asset.setURL(url);
    logger.fine("String_Node_Str" + url.toString());
    return true;
  }
 catch (  java.lang.Exception ex) {
    logger.log(Level.SEVERE,"String_Node_Str" + url);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Synchronously download an asset from a server, given the asset and the url of the server to look for the asset. The asset object will be updated with the local file containing the cached asset and the locally computed  checksum. Returns true upon success, false upon failure
 * @param asset The asset to download
 * @param url The full URL to the asset
 * @param progressListener Notified of updates in the loading
 * @return True upon success, false upon failure 
 */
private boolean getAssetFromServer(Asset asset,String url,ProgressListener progressListener){
  try {
    logger.fine("String_Node_Str" + url.toString());
    url=encodeSpaces(url);
    URLConnection connection=new URL(url).openConnection();
    TrackingInputStream track=new TrackingInputStream(connection.getInputStream());
    InputStream in=new BufferedInputStream(track);
    if (progressListener != null) {
      track.setListener(progressListener,AssetManager.UPDATE_BYTE_INTERVAL,connection.getContentLength());
    }
    AssetID assetID=new AssetID(asset.getResourceURI(),asset.getChecksum());
    String cacheFile=this.getAssetCacheFileName(assetID);
    File file=new File(cacheFile);
    if (!file.canWrite())     makeDirectory(file);
    byte[] buf=new byte[AssetManager.NETWORK_CHUNK_SIZE];
    MessageDigest digest=MessageDigest.getInstance(CHECKSUM_ALGORITHM);
    OutputStream out=new DigestOutputStream(new BufferedOutputStream(new FileOutputStream(file),buf.length),digest);
    int c=in.read(buf);
    while (c > 0) {
      out.write(buf,0,c);
      c=in.read(buf);
    }
    in.close();
    out.close();
    track.close();
    asset.setChecksum(Checksum.toHexString(digest.digest()));
    digest.reset();
    asset.setLocalCacheFile(file);
    asset.setURL(url);
    logger.fine("String_Node_Str" + url.toString());
    return true;
  }
 catch (  java.lang.Exception ex) {
    logger.log(Level.SEVERE,"String_Node_Str" + url,ex);
    return false;
  }
}