Skip to content

java.lang.NullPointerException when iteration through viewentrycollection #186

@PatrickKwinten

Description

@PatrickKwinten
  • Domino server Release 12.0.1FP1 HF72
  • DDE Revision 20220404.1552-FP1 (Release 12.0.1FP1)
  • ODA version 12.0.2.202211211802

here is an example of the error from log.nsf:

java.lang.NullPointerException
2023-05-26 09:44:29 HTTP JVM: at org.openntf.domino.impl.ViewEntryCollection.getCount(ViewEntryCollection.java:219)
2023-05-26 09:44:29 HTTP JVM: at org.openntf.domino.iterators.ViewEntryIterator.(ViewEntryIterator.java:57)
2023-05-26 09:44:29 HTTP JVM: at org.openntf.domino.impl.ViewEntryCollection.iterator(ViewEntryCollection.java:111)
2023-05-26 09:44:29 HTTP JVM: at org.acme.kkom.dao.AttachmentDominoDAO.updateAccess(AttachmentDominoDAO.java:510)

510 refers to the for loop statement (for (ViewEntry entry : entries) ) in:

View vw = db.getView(propDataSources.getProperty("vw_attach_unid"));
if (null != vw){
ViewEntryCollection entries = vw.createViewEntryCollection();
if (null != key){
entries = vw.getAllEntriesByKey(key, true);
}
else{
entries = vw.getAllEntries();
}
//ODA way:
for (ViewEntry entry : entries) {
if(entry.isValid()){
if(entry.isDocument()){
Document doc = entry.getDocument();
if(null != item){
doc.copyItem(item);
} else{
doc.removeItem(fieldName);
}
if(doc.save(true,false)){
vw.refresh();
}
}
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions