I have no idea how this is happening. Last night it worked fine:
My logger on the server reads:
Form Array length 2
Fields= 2
so why am I getting a null if there is a size and length > 1 in the array and list??????
Please help...thanx
Form:
public String[] getFields()
{
return fields;
}
public void setFields(String[] s)
{
fields = s;
System.out.println("Form Array length " + s.length);
}
String[] formFields = form.getFields();
List<Bean> fields = new ArrayList<Bean>();
for( String fName : formFields )
{
fields.add( BeanCache.fetchFromCache(Bean.class,name) );
}
System.out.println("Fields= " + fields.size() );
for( bean f : fields )
{
System.out.println("Name = " + f.getName() ); <<-- NULL ERROR HERE???
}
Maybe your list contains null values.
List<String> stringList = new ArrayList<String>();
stringList.add(null);
System.out.println(stringList.get(0).trim()); // null pointer
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.