Program: 46201
Project: 46201
Buggy source:
private void syncImpl(){
  ArrayList<AvatarConfigFile> uploadList=new ArrayList();
  ArrayList<AvatarConfigFile> downloadList=new ArrayList();
  try {
    List<ContentNode> avatarList=avatarsDir.getChildren();
    for (    ContentNode a : avatarList) {
      if (a instanceof ContentResource) {
        System.err.println("String_Node_Str" + ((ContentResource)a).getURL());
        AvatarConfigFile serverAvatar=new AvatarConfigFile((ContentResource)a);
        AvatarConfigFile previous=serverAvatars.put(serverAvatar.avatarName,serverAvatar);
        if (previous != null && previous.version > serverAvatar.version) {
          System.err.println("String_Node_Str" + previous.resource.getURL());
          serverAvatars.put(previous.avatarName,previous);
          logger.fine("String_Node_Str" + serverAvatar.getFilename());
          avatarsDir.removeChild(serverAvatar.getFilename());
        }
 else {
          System.err.println("String_Node_Str" + serverAvatar.resource.getURL());
        }
      }
    }
    HashMap<String,AvatarConfigFile> tmpServerAvatars=(HashMap<String,AvatarConfigFile>)serverAvatars.clone();
synchronized (localAvatars) {
      for (      AvatarConfigFile a : localAvatars.values()) {
        AvatarConfigFile serverVersion=tmpServerAvatars.get(a.avatarName);
        logger.fine("String_Node_Str" + serverVersion + "String_Node_Str"+ a);
        if (serverVersion == null || serverVersion.version < a.version) {
          uploadList.add(a);
          tmpServerAvatars.remove(a.avatarName);
        }
 else         if (serverVersion.version > a.version) {
          downloadList.add(a);
          tmpServerAvatars.remove(a.avatarName);
        }
 else         if (serverVersion.version == a.version) {
          tmpServerAvatars.remove(a.avatarName);
          System.err.println("String_Node_Str" + serverVersion.resource.getURL());
          serverAvatars.put(serverVersion.avatarName,serverVersion);
        }
      }
    }
    for (    AvatarConfigFile a : tmpServerAvatars.values()) {
      downloadList.add(a);
    }
    for (    AvatarConfigFile a : uploadList) {
      try {
        uploadFileImpl(a);
      }
 catch (      IOException ex) {
        Logger.getLogger(AvatarConfigManager.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
    for (    AvatarConfigFile a : downloadList) {
      try {
        ContentResource localFile=(ContentResource)localAvatarsDir.createChild(a.resource.getName(),Type.RESOURCE);
        localFile.put(new BufferedInputStream(a.resource.getURL().openStream()));
      }
 catch (      IOException ex) {
        Logger.getLogger(AvatarConfigManager.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
synchronized (localAvatars) {
      for (      AvatarConfigFile a : downloadList) {
        localAvatars.put(a.avatarName,a);
        notifyListeners(true,a.avatarName);
      }
    }
  }
 catch (  ContentRepositoryException ex) {
    Logger.getLogger(AvatarConfigManager.class.getName()).log(Level.SEVERE,null,ex);
  }
}

Fixed version (ground truth):
private void syncImpl(){
  ArrayList<AvatarConfigFile> uploadList=new ArrayList();
  ArrayList<AvatarConfigFile> downloadList=new ArrayList();
  try {
    List<ContentNode> avatarList=avatarsDir.getChildren();
    for (    ContentNode a : avatarList) {
      if (a instanceof ContentResource) {
        logger.fine("String_Node_Str" + ((ContentResource)a).getURL());
        AvatarConfigFile serverAvatar=new AvatarConfigFile((ContentResource)a);
        AvatarConfigFile previous=serverAvatars.put(serverAvatar.avatarName,serverAvatar);
        if (previous != null && previous.version > serverAvatar.version) {
          serverAvatars.put(previous.avatarName,previous);
          logger.fine("String_Node_Str" + serverAvatar.getFilename());
          avatarsDir.removeChild(serverAvatar.getFilename());
        }
 else {
        }
      }
    }
    HashMap<String,AvatarConfigFile> tmpServerAvatars=(HashMap<String,AvatarConfigFile>)serverAvatars.clone();
synchronized (localAvatars) {
      for (      AvatarConfigFile a : localAvatars.values()) {
        AvatarConfigFile serverVersion=tmpServerAvatars.get(a.avatarName);
        logger.fine("String_Node_Str" + serverVersion + "String_Node_Str"+ a);
        if (serverVersion == null || serverVersion.version < a.version) {
          uploadList.add(a);
          tmpServerAvatars.remove(a.avatarName);
        }
 else         if (serverVersion.version > a.version) {
          downloadList.add(a);
          tmpServerAvatars.remove(a.avatarName);
        }
 else         if (serverVersion.version == a.version) {
          tmpServerAvatars.remove(a.avatarName);
          serverAvatars.put(serverVersion.avatarName,serverVersion);
        }
      }
    }
    for (    AvatarConfigFile a : tmpServerAvatars.values()) {
      downloadList.add(a);
    }
    for (    AvatarConfigFile a : uploadList) {
      try {
        uploadFileImpl(a);
      }
 catch (      IOException ex) {
        Logger.getLogger(AvatarConfigManager.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
    for (    AvatarConfigFile a : downloadList) {
      try {
        ContentResource localFile=(ContentResource)localAvatarsDir.createChild(a.resource.getName(),Type.RESOURCE);
        localFile.put(new BufferedInputStream(a.resource.getURL().openStream()));
      }
 catch (      IOException ex) {
        Logger.getLogger(AvatarConfigManager.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
synchronized (localAvatars) {
      for (      AvatarConfigFile a : downloadList) {
        localAvatars.put(a.avatarName,a);
        notifyListeners(true,a.avatarName);
      }
    }
  }
 catch (  ContentRepositoryException ex) {
    Logger.getLogger(AvatarConfigManager.class.getName()).log(Level.SEVERE,null,ex);
  }
}