I written an Java jms code to execute message and my problem is i have 10 records in the list it is processing first two records and from third record onwards not processing due to third record value is null, please help me how to skip the null message and proceed the for loop to process remaining records. Is it possible to do if any message is null skip and proceed. Thanks in Advance
My log shows in the else part record failure "null pointer exception" and come out of the loop further not proceed.
My Java code:
for (createTestbean createTestBean : createTestbeanList) {
String createTestMessage = createTestBean.getMessage();
TextMessage textMessage = queueSession
.createTextMessage(createTestMessage);
TextMessage tm;
String replymessage = null ;
String code = null;
Message message = queueReceiver.receive(60 * 1000);
if (message != null) {
logger.info("Received message:\n" + message);
tm =(TextMessage) message;
logger.info("Message:" + tm.getText());
replymessage =tm.getText();
} else {
logger.info("No message received!\n");
recordFailure(null);
}
code = replymessage.split(",")[2];
createTestDAO rmdao = new createTestDAO();
rmdao.updateCreateTest(replymessage,code);
}