/** * processGetLoan * * @param udpMessage is an instance of GetLoanMessage * @throws Exception */ private void processGetLoan(UDPMessage udpMessage) throws Exception { if (udpMessage.getMessage() instanceof GetLoanMessage) { GetLoanMessage msg = (GetLoanMessage) udpMessage.getMessage(); if (!this.bank.getServerName().equalsIgnoreCase(msg.getBank())) { msg.setException(new Exception("Wrong Bank Name! Request denied. processGetLoan")); } else { int loanNumber = -1; try { loanNumber = bank.getLoan(msg.getAccountNumber(), msg.getPassword(), msg.getLoanAmount()); } catch (Exception e) { msg.setException(e); } msg.setResultLoanID(loanNumber); msg.setMachineName(Env.getMachineName()); } this.send(udpMessage); } else { throw new Exception("Invalid Object processGetLoan"); } }