hi
this code is screwing me up. i get NoSuchElementException exceptions pointing to line 630 ('int anAuctionID = myEnum.nextElement();')
i am pretty sure this is a casting type problem - because if i comment out the above line, then comment out the line where i plug the resulting int into a method
//AuctionStruct anAuctionStruct = getAuctionService().getAuction(anAuctionID);
and instead plug in an int
AuctionStruct anAuctionStruct = getAuctionService().getAuction(1);
i do not get the NoSuchElementException exception any longer. i believe that 'int anAuctionID = myEnum.nextElement(); ' is returning either a null or some other type of object and not an int as i had intended, so when i plug it into my method which expects an int argument it is returning nothing, hence the exception.
can someone tell me what i'm doing wrong? i'm plugging in a vector of objects to this method, i want to enumerate through the vector, cast each element to an int, and plug it into my getAuction(int) method, which expects an int. i may be casting wrong and plugging in either a null or some type of object other than an int at this point in the execution.
if someone help me debug, i'd appreciate it. i'm not sure what i'm doing wrong.
.
public static void loadBiddedAuctionData(Vector bidVector) {
if (bidVector.size() == 0) {
return;
}
Log.debug("Bidded auctions:");
// Remove duplicates elements in bidVector
Vector tmpVector = new Vector();
// Create a set from the vector
Set tmpSet = new TreeSet(bidVector);
tmpVector = new Vector(tmpSet);
Enumeration<Integer> myEnum = tmpVector.elements();
for (int i = 0; myEnum.hasMoreElements(); i++) {
System.out.println(myEnum.nextElement());
//int anAuctionID = myEnum.nextElement();
try {
//AuctionStruct anAuctionStruct = getAuctionService().getAuction(anAuctionID);
AuctionStruct anAuctionStruct = getAuctionService().getAuction(1);
}
catch (NotFoundException e) {
Log.warning (e);
//JOptionPane.showMessageDialog(this, e.description);
}
catch (Exception e) { // if some other exception has occurred.
Log.alarm(e);
}
}
} // end loadBiddedAuctionData()