From: Brian W. <bwe...@xb...> - 2011-09-01 22:26:35
|
On Sep 1, 2011, at 3:23 PM, Periya.Data wrote: > Also, I get a null pointer exception error when I try to getName. > > // DNS Questions > Name qname; > int qtype; > int qclass; > > Record question = dns_msg.getQuestion(); > qname = question.getName(); ===> error at this line. > > I am not what that means. A valid record is not found? Is there a nice way to check if a valid record has been returned? Maybe I am screwing up with the starting of a valid DNS message from the bytebuffer. As I said before, there's a problem with your data. If you're parsing a message, and the DNS header indicates that there are 0 records in all of the sections, the message parser won't try to parse any records, so Message.getQuestion() would return null. Brian |