Patrick Kwinten
Patrick Kwinten

Reputation: 2048

getAllEntriesByKey causes error: Unknown or unsupported object type in Vector

I get the following error in a xp:messages control:

Error in lotus.domino.local.View, line -2: NotesException: Unknown or unsupported object type in Vector

It is generated in the following code in my Java class:

View vw = db.getView(viewName);
if(null != vw){ 
ViewEntryCollection vec
-> vec = vw.getAllEntriesByKey(key);
}

key is here a provided String.

Anyone has an explanation for this?

Upvotes: 1

Views: 539

Answers (3)

Detlef Birkholz
Detlef Birkholz

Reputation: 441

Did you check that your variable key is not null? I get this error message if I provide a key parameter that is null.

Upvotes: 3

Paul Stephen Withers
Paul Stephen Withers

Reputation: 15739

You're passing in a String, not a Vector. You need to create a Vector, then add your string as the first element to it, same as in SSJS.

Vector vec = new Vector();
vec.add(key)
vw.getAllEntriesByKey(vec);

This is one of the reasons that ODA's method signature is getAllEntriesByKey(Object key), so our abstraction layer does all that for you. Plus once you get the result, you can use standard Java looping to process the loop (for (ViewEntry ent : vec) {....})

Upvotes: 2

geco17
geco17

Reputation: 5294

There are two things to consider. The first is your syntax. The code should be as follows

View vw = db.getView(viewName);
if(null != vw){ 
    ViewEntryCollection vec = vw.getAllEntriesByKey(key);
    // do something with the vec
}

The second is the exception message:

Unknown or unsupported object type in vector.

The documentation here has the method signatures. The key variable you've mentioned is a String so the method should be the one you've used:

public ViewEntryCollection getAllEntriesByKey(Object key) throws NotesException

When you remove the -> from the code does it work as expected?

Upvotes: 0

Related Questions