e.printStackTrace();
  protected void attachLegsFromResult (ResultSet rs, UIDGenerator generator, 				       Map instanceToNode, Tree cargoTree) {    try{      int total = 0;      String prevReadyAt = null;      Map assetToLeg = new HashMap ();      while(rs.next()){	total++;			String id        = rs.getString (1);	String start     = rs.getString (2);	String end       = rs.getString (3);	String readyAt   = rs.getString (4);	String startLoc  = rs.getString (5);	String startName = rs.getString (6);	String endLoc    = rs.getString (7);	String endName   = rs.getString (8);	int    convtype  = rs.getInt (9);	int    legtype   = rs.getInt (10);	String assetid   = rs.getString (11);	String nomen     = rs.getString (14);	String bumperno  = rs.getString (15);	boolean isLowFi   = rs.getString (DGPSPConstants.COL_IS_LOW_FIDELITY).equals("true");	if(debug){	  TPFDDLoggerFactory.createLogger().logMessage(Logger.NORMAL, Logger.GENERIC, "UnitQuery.attachLegsFromResult - isLowFi was " + isLowFi + "/" +			      rs.getString (DGPSPConstants.COL_IS_LOW_FIDELITY));	}	if (legtype != DGPSPConstants.LEG_TYPE_POSITIONING && legtype != DGPSPConstants.LEG_TYPE_RETURNING) {	  if (readyAt.equals (start) && prevReadyAt != null)	    readyAt = prevReadyAt;	  LegNode legNode = createLeg (generator, id, start, end, readyAt, startLoc, startName, endLoc, endName, convtype, 				    legtype, nomen, bumperno);		  	  Node instanceNode = (Node)instanceToNode.get(assetid);	  if (instanceNode == null){	    if(debug){	      //Currently the Leg query ignores Carrier aspects of FilterClauses (so we get complete tpfdd lines	      //even when filtering for specific critereon.  This means that when filtering for Carriers, there may NOT 	      //be instances for some of the legs, hence this is an expected, if ugly condition.	      TPFDDLoggerFactory.createLogger().logMessage(Logger.NORMAL, Logger.GENERIC, "UnitQuery.attachLegsFromResult - no instance node for : " + assetid);	    }	  }else {	    if (debug && false)	      TPFDDLoggerFactory.createLogger().logMessage(Logger.NORMAL, Logger.GENERIC, "UnitQuery.attachInstancesFromResult - parent instance " + instanceNode);	    if (isLowFi) {	      LegNode currentLegNode = findLegNode(assetToLeg, assetid, startLoc, endLoc);	      if (currentLegNode == null) {		registerLegNode (assetToLeg, assetid, startLoc, endLoc, legNode);		cargoTree.addNode (instanceNode.getUID(), legNode);	      }	      else		rollUpLegNode (legNode, currentLegNode);	    }	    else 	      cargoTree.addNode (instanceNode.getUID(), legNode);	  }	}	else {	  prevReadyAt = readyAt;	}      }      if (debug) 	TPFDDLoggerFactory.createLogger().logMessage(Logger.NORMAL, Logger.GENERIC, "UnitQuery.attachLegsFromResult - total rows for legs " + total);	      } catch (SQLException e) {      TPFDDLoggerFactory.createLogger().logMessage(Logger.NORMAL, Logger.GENERIC, "UnitQuery.attachLegsFromResult - SQLError : " + e);    }finally{      if(rs!=null) {	try { rs.close(); } catch (SQLException e){	  TPFDDLoggerFactory.createLogger().logMessage(Logger.NORMAL, Logger.GENERIC, "UnitQuery.attachLegsFromResult - " +			      "closing result set, got sql error : " + e); 	}      }    }  }