OpenNTF / org.openntf.domino

Open replacement for lotus.domino package in HCL Domino
Apache License 2.0
66 stars 34 forks source link

List not empty when using getColumnValue("colName", ArrayList.class) on an empty column #140

Open dnmd opened 8 years ago

dnmd commented 8 years ago

When using entry.getColumnValue("colName", ArrayList.class) on an empty column, it does not return an empty list as one might expect. But a list with one String element.

List<String> list = entry.getColumnValue("colName", ArrayList.class);

System.out.println(list.isEmpty()); // false
System.out.println(list.size()); // == 1

1) I don't know if this is intended or by design but I could not find any examples / known issues about it. 2) What would be a proper way to prevent such behavior? As I would expect an empty List, my guess is that it happens somewhere around here

the-ntf commented 8 years ago

We would have to add a switch for this behavior, because the legacy API returns a Vector with one "" in it when a column value is "empty" just like it does with an "empty" field. There's actually no such thing as empty in Notes.

On Mon, Nov 2, 2015 at 5:44 AM, dnmd notifications@github.com wrote:

When using entry.getColumnValue("colName", ArrayList.class) on an empty column, it does not return an empty list as one might expect. But a list with one String element.

List list = entry.getColumnValue("colName", ArrayList.class); System.out.println(list.isEmpty()); // falseSystem.out.println(list.size()); // == 1

1) I don't know if this is intended or by design but I could not find any examples / known issues about it. 2) What would be a proper way to prevent such behavior? As I would expect an empty List, my guess is that it happens somewhere around here https://github.com/OpenNTF/org.openntf.domino/blob/master/domino/core/src/main/java/org/openntf/domino/impl/ViewEntry.java#L522

— Reply to this email directly or view it on GitHub https://github.com/OpenNTF/org.openntf.domino/issues/140.