Program: 25291
Project: 25291
Buggy source:
@Override public Date getLatestDateOfCube(LensSessionHandle sessionid,String cubeName,String timeDimension) throws LensException, HiveException {
  acquire(sessionid);
  CubeInterface ci=getClient(sessionid).getCube(cubeName);
  if (!(ci instanceof Cube)) {
    throw new BadRequestException("String_Node_Str" + cubeName + "String_Node_Str");
  }
  Cube c=(Cube)ci;
  String partitionColumn=c.getPartitionColumnOfTimeDim(timeDimension);
  List<FactTable> factTables=getAllFactsOfCube(sessionid,cubeName);
  Date latestDate=null;
  if (factTables != null && !factTables.isEmpty()) {
    for (    FactTable factTable : factTables) {
      List<String> storages=getStoragesOfFact(sessionid,factTable.getName());
      if (storages != null && !storages.isEmpty()) {
        for (        String storage : storages) {
          String storageTableName=MetastoreUtil.getFactStorageTableName(factTable.getName(),storage);
          List<Partition> parts=getClient(sessionid).getPartitionsByFilter(storageTableName,StorageConstants.getLatestPartFilter(partitionColumn));
          if (parts.size() == 1) {
            Date tmpDate=getClient(sessionid).getLatestTimeStamp(parts.get(0),partitionColumn);
            if (latestDate == null || latestDate.before(tmpDate)) {
              latestDate=tmpDate;
            }
          }
 else           if (parts.size() > 1) {
            throw new LensException("String_Node_Str" + partitionColumn + "String_Node_Str");
          }
        }
      }
    }
  }
  release(sessionid);
  return latestDate;
}

Fixed version (ground truth):
@Override public Date getLatestDateOfCube(LensSessionHandle sessionid,String cubeName,String timeDimension) throws LensException, HiveException {
  acquire(sessionid);
  CubeInterface ci=getClient(sessionid).getCube(cubeName);
  if (!(ci instanceof Cube)) {
    throw new BadRequestException("String_Node_Str" + cubeName + "String_Node_Str");
  }
  Cube c=(Cube)ci;
  String partitionColumn=c.getPartitionColumnOfTimeDim(timeDimension);
  List<FactTable> factTables=getAllFactsOfCube(sessionid,cubeName);
  Date latestDate=null;
  if (factTables != null && !factTables.isEmpty()) {
    for (    FactTable factTable : factTables) {
      List<String> storages=getStoragesOfFact(sessionid,factTable.getName());
      if (storages != null && !storages.isEmpty()) {
        for (        String storage : storages) {
          String storageTableName=MetastoreUtil.getFactStorageTableName(factTable.getName(),storage);
          List<Partition> parts=new LinkedList<Partition>();
          try {
            parts=getClient(sessionid).getPartitionsByFilter(storageTableName,StorageConstants.getLatestPartFilter(partitionColumn));
          }
 catch (          HiveException e) {
            LOG.info("String_Node_Str" + storageTableName + "String_Node_Str",e);
          }
          if (parts.size() == 1) {
            Date tmpDate=getClient(sessionid).getLatestTimeStamp(parts.get(0),partitionColumn);
            if (latestDate == null || latestDate.before(tmpDate)) {
              latestDate=tmpDate;
            }
          }
 else           if (parts.size() > 1) {
            throw new LensException("String_Node_Str" + partitionColumn + "String_Node_Str");
          }
        }
      }
    }
  }
  release(sessionid);
  return latestDate;
}