Hi guys,

Hoping you can help me. I have a client server program where you enter a new item via a client interface which then appears in the server interface using the below method:

Java Code:
public String addItem(){
    String serialNo = (String) receive();
    String desc = (String) receive();
    Integer stock = (Integer) receive();
    String location = (String) receive();
    String dateTime = (String) receive();
 
    // creates new serial number
    //serialNo = new Integer(server.getReposSize() + 1).toString();
 
    //creates new stockitem from stockitem class
    StockItem item = new StockItem(serialNo, desc, stock, location) ;
 
     if (item == null)
      return "Item does not exist";
 
    //Lock the object
    item = (StockItem) server.lock(serialNo);
    if (item != null){
      String status ="";
 
      //Carry out deposit on the locked account
      if (item.addItem(stock.intValue(),dateTime))
        status = "Stock Added";
      else
        status = "Failed to add new stock";
     server.unlock(serialNo);
     return status;
 
    
}
server.put(serialNo, item);
return "Item added";
}
Everything compiles and shows on the server interface, however where "item" is used it shows in the server interface as "null". Im not sure how as i though the line: "StockItem item = new StockItem(serialNo, desc, stock, location) ;" would recieve the value's sent and insert them into the interface like it has for the serialNo value.

Is there anything i could replace "if (item.addItem(stock.intValue(),dateTime))" to basically state i want the data recieved for the "item" object inserting in there?

Could anyone advise on this?

Thanks in advance.