Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP behaviour .......

 
Roberto Diaz
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...........
..........
private Address[] messageFrom = new Address[10] ;
private String[] messageSubject = new String[10] ;
private Message[] userMessages = new Message[10] ;
private int numMessages = 0 ;
private String[] tempString = new String[10];
.......
.......
void readEmail(Message message[]) {
for (int i=0; i < numMessages; i++)
{
messageFrom = message[i].getFrom()[0]; messageSubject[i] = message[i].getSubject();
}
/***** removeSpecialCharacters(messageFrom, messageSubject); ****/
}
}
void removeSpecialCharacters(Address[] messageFrom, String[] messageSubject)
{
for(int i=0 ; i < messageFrom.length ; i++)
{
tempString[i] = messageFrom[i].toString();
tempString[i] = tempString[i].replaceAll("<","") ;
tempString[i] = tempString[i].replaceAll(">","") ;
}
}
%>
<%
response.setContentType("text/voicexml+xml");
getEmail(userName, passWord, mailHost);
readEmail(userMessages);
removeSpecialCharacters(messageFrom, messageSubject);
%>
Why does not this(one in bold) method call work ??
It gives me NullPointer exception at the italicised line of code. [I]tempString[i] = messageFrom[i].toString();
removeSpecialCharacters(messageFrom, messageSubject);
If I replace it with the method call commented out it works fine ??
Any ideas.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!