e.printStackTrace();
  protected void attachRollupLegsFromResult (ResultSet rs, UIDGenerator generator, 					     Map prototypeToNode, Tree cargoTree) {    Map protoToPaths = new HashMap();    try{      int total = 0;      boolean firstResult = true;      String prevReadyAt = null;      String prevAssetID = null;      int prevAggNumber = 0;      List prevPathsForProto = null;      Path currentPath = null;	        // For all legs      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 instanceProto  = rs.getString (13);	String nomen     = rs.getString (14);	String bumperno  = rs.getString (15);	String owner     = rs.getString (16);	int    aggNumber = rs.getInt (17);	String protoKey  = (aggregateByUnit) ? (owner + instanceProto) : instanceProto;	// Deal with implied legs POSITIONING and RETURNING	if (legtype == DGPSPConstants.LEG_TYPE_POSITIONING || legtype == DGPSPConstants.LEG_TYPE_RETURNING) {	  prevReadyAt = readyAt;	  continue;	} 	// There may be no positioning or returning legs, which is the only way prevReadyAt gets set	// What is the purpose of prevReadyAt, anyway?  I wish I could remember... (Gordon 08-17-01)	else if (!firstResult && readyAt.equals (start) && (prevReadyAt != null)) {	    if (debug) {		TPFDDLoggerFactory.createLogger().logMessage(Logger.NORMAL, Logger.GENERIC, "FilterQuery.attachRollupLegsFromResult - setting ready At = prevReadyAt = " + prevReadyAt +				    " first result " + firstResult + " and ready at " + readyAt + " = " +  start);	    }	  readyAt = prevReadyAt;	}	// if there is no path list for prototype, create it	List pathsForProto = (List) protoToPaths.get (protoKey);	if (pathsForProto == null) {	    pathsForProto = new ArrayList ();	    protoToPaths.put (protoKey, pathsForProto);	}		// This result is the start of a new path.  	// Process the old path and create a new path.  	if (!assetid.equals (prevAssetID)) {	  if (!firstResult) {	    // Set the aggregation number	    currentPath.setAggNumber(prevAggNumber);	    // if we could not combine this path with a known one, then it's a new one to add	    if (!couldCombine (prevPathsForProto, currentPath)) 	      prevPathsForProto.add (currentPath);	  }	  // begin a new path	  currentPath = new Path ();	}	// Create the leg node and add it to the current path	LegNode legNode = 	  (LegNode) createLeg (generator, id, start, end, readyAt, startLoc, startName, endLoc, endName, 			       convtype, legtype, nomen, bumperno);	currentPath.addLeg (legNode);	// Update prev variables for next iteration	prevAssetID = assetid;	prevAggNumber = aggNumber;	prevPathsForProto = pathsForProto;	firstResult = false;      } // end while      // If no legs found (i.e. empty result set), don't do anything      if (total == 0)	return;	      // Final fence-posting code: process the last path      currentPath.setAggNumber(prevAggNumber);      if (!couldCombine (prevPathsForProto, currentPath)) 	prevPathsForProto.add (currentPath);      } catch (SQLException e) {      TPFDDLoggerFactory.createLogger().logMessage(Logger.NORMAL, Logger.GENERIC, "FilterQuery.attachRollupLegsFromResult - SQLError : " + e);    } finally {      if(rs!=null) {	try { rs.close(); } catch (SQLException e){	  TPFDDLoggerFactory.createLogger().logMessage(Logger.NORMAL, Logger.GENERIC, "FilterQuery.attachRollupLegsFromResult - " +			      "closing result set, got sql error : " + e); 	}      }    }    //Map protoToSinglePath = combinePaths (protoToPaths);    // I don't think this does anything . . .     // Map protoToFewPath = combinePathsAsNecessary (protoToPaths);    Map protoToFewPath = protoToPaths;    // Create an array list to sort the prototypes by name    Map protoToName = new HashMap();    for (Iterator iter = prototypeToNode.keySet().iterator(); iter.hasNext();) {      String proto = (String) iter.next();      AggregateCargoType prototypeNode = (AggregateCargoType)prototypeToNode.get(proto);      String name = prototypeNode.getCargoName();      protoToName.put(proto, name);    }    List al = new ArrayList(prototypeToNode.keySet());    addLegsToTree (al, protoToName, prototypeToNode, protoToFewPath, generator, cargoTree);  }