Image

Imagegrrlpower wrote in Imagejava_dev 😡frustrated

last time for this lab, I swear...

ok so I have two similar methods, a findAll() and findItemByQuant(). Both return a vector. The findItemByQuant was throwing a remote exception, so I thought I would copy over the code and see what was up.
I actually have the method set up once and called once from the program, and just changed the name of the method .. and it works when it's called findAll() and not findItemByQuant(). Anyone heard of such a thing??

this is what I mean:
calling class:
// v = invent.findAll();
v = invent.findItemByQuant();
ui.displaySubset(v);


(the actual code is:)
public java.util.Vector findItemByQuant() throws NoSuchItemException, java.rmi.RemoteException {
// public java.util.Vector findAll() throws NoSuchItemException, java.rmi.RemoteException {

Vector itmVector = null;
Item itm = null;
ResultSet rs = null;
 try {
   st = con.createStatement();
   rs = st.executeQuery("select * from ITEMS;");

   while (rs.next()) {
       up	= rs.getString("UPC");
       de = rs.getString("DESCRIPTION");
       ud = rs.getString("UNIT");
       qnt = rs.getInt("QUANTITY");
       rs.close();
       itm = new Item(up, de, ud, qnt);
       itmVector.add(itm);
    }
 }
 catch (SQLException sql) {
    System.out.println(sql.getMessage());
 }
 finally {
   System.gc();
   return itmVector;
 }

}

the lines are commented out b/c I switched them to test out the other name.. and if I try to use the findItemByQuant(), I get the following exception: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: invalid method hash