if (log.isDebugEnabled()) { log.debug(this + " doing query " + query + " and created Relationship: " + rd); } if (rd.getType() == null && log.isErrorEnabled()) { log.error("Please report bug 1304: using CSMART " + CSMART.writeDebug() + " just created a RelationshipData from the DB and type is now null: " + rd, new Throwable()); }
  private RelationshipData[] getRelationshipData() {    // creates relationships by creating RelationshipData    // from the database and passing that as an argument    // to RelationshipBase    ArrayList relationshipData = new ArrayList();    try {      Connection conn = DBUtils.getConnection();      try {        Statement stmt = conn.createStatement();	        String query = DBUtils.getQuery(QUERY_AGENT_RELATIONS, substitutions);        ResultSet rs = stmt.executeQuery(query);        while(rs.next()) {          RelationshipData rd = new RelationshipData();          String supported = rs.getString(1);          String role = rs.getString(2);          Timestamp startDate = rs.getTimestamp(3);          Timestamp endDate = rs.getTimestamp(4);          rd.setItemId(supported);          rd.setSupported(supported);          if (role.equals("Subordinate")) {            rd.setRole("");            rd.setType("Subordinate");          } else {            rd.setRole(role);            rd.setType("Supporting");          }          if (startDate != null) {            rd.setStartTime(startDate.getTime());          }          if (endDate != null) rd.setEndTime(endDate.getTime());          relationshipData.add(rd);        }        rs.close();        stmt.close();      } finally {        conn.close();      }    } catch (Exception e) {      if(log.isErrorEnabled()) {        log.error("Exception", e);      }      throw new RuntimeException("Error" + e);    }    return (RelationshipData[])relationshipData.toArray(new RelationshipData[relationshipData.size()]);  }