1
   

Null pointer exception

 
 
Rhyan
 
Reply Mon 2 Jul, 2012 12:42 am
i am getting null pointer exception when i am trying to migrate java 1.4 to 1.7. It was working when i was testing in 1.4. But when i was testing in 1.7 it was not working
below are the codes:

In jsp:

<td> <html:text property='<%= "duration[" + ind + "]" %>' styleClass="textfield" size="5" maxlength="5" />
</td>

In javabean:

public class CodeSpecialtyForm extends ValidatorForm {

private String codeType;

private String codeValue;

private String codeDesc;

private String codeSeq;

private String defunctInd;

private List durationList;

private List logbookTemplateList;

private String[] selectedSubtype;

private String durationForRetrospectivePosting;

private String shortName;

private List subtypeCodes;

private List templateOptions;

private String hepBInd;

private String[] useLogbook;

/* properties for training duration (years) */

public List getDurationList() {
return durationList;
}

public void setDurationList(List durationList) {
System.out.println("durationList===>**"+durationList);
this.durationList = durationList;
System.out.println("durationList**"+durationList);
}

public String getDuration(int index) {

// make sure list is not null
if (this.durationList == null) {
this.durationList = new ArrayList();
}

// indexes do not come in order, populate empty spots
while (index >= this.durationList.size()) {
this.durationList.add(new String());
}

// return the requested item
return (String) durationList.get(index);

}

public String setDuration(int index, String duration) {

// make sure list is not null
if (this.durationList == null) {
this.durationList = new ArrayList();
}

// indexes do not come in order, populate empty spots
while (index >= this.durationList.size()) {
this.durationList.add(new String());
}

// return the requested item
return (String) durationList.set(index, duration);

}

/* properties for logbook template */

  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 1 • Views: 1,934 • Replies: 2
No top replies

 
gungasnake
 
  1  
Reply Mon 2 Jul, 2012 02:49 am
In simplest terms, a null pointer problem means you've tried to use pointer to which no real space has been assigned.
nikkoncolmel
 
  0  
Reply Thu 13 Sep, 2012 04:15 am
@gungasnake,
NullPointerException is the exception that occurred when a programmer perform an operation on a object or calling a method on the object i.e null. This exception is thrown by JVM.We should not handle that exception by try and catch block
0 Replies
 
 

Related Topics

Disable Java? - Discussion by engineer
java jws - Question by rockerpham
java to mips - Question by themanwhoknowsandask
Ubuntu, Java and Aptana Studio 3 - Question by Ken Dawson
Java Question,time converter. - Question by Loh Jane
unescape javascripts - Question by happy5
Java Programming Question? - Question by evang14
 
  1. Forums
  2. » Null pointer exception
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/19/2024 at 05:39:59