Together with core dev we tracked down an issue in our large text list support in 12.0.2 where we had to use a Java char instead of a Java short to work with unsigned C WORD values, here the textSize passed to ListAddEntry2Ext:
int i=0;
for (String currStr : strList) {
Memory currStrMem = NotesStringUtils.toLMBCS(currStr, false);
if (currStrMem.size() > 65535) {
throw new DominoException(MessageFormat.format("List item at position {0} exceeds max lengths of 65535 bytes", i));
}
//somehow these two lines produce different results for the ListAddEntry2Ext call with text lengths >32767 bytes
//leading to an error "Insufficient memory" in macOS when using a short
//short textSize = (short) (currStrMem==null ? 0 : (currStrMem.size() & 0xffff));
char textSize = (char) currStrMem.size();
short addResult = capi1201.ListAddEntry2Ext(hList,
false,
retListSize,
(short) (i & 0xffff),
currStrMem,
textSize,
true);
NotesErrorUtils.checkResult(addResult);
i++;
}
ListAddEntry2Ext is declared like this:
STATUS far PASCAL ListAddEntry2Ext(MEMHANDLE mhList,
BOOL fPrefixDataType,
DWORD far *pListSize,
WORD EntryNumber,
const char far *Text,
WORD TextSize,
BOOL bAllowLarge);
To avoid similar issues we should replace all Java shorts in the JNX codebase that are used as unsigned WORD values with a Java char.
Together with core dev we tracked down an issue in our large text list support in 12.0.2 where we had to use a Java char instead of a Java short to work with unsigned C WORD values, here the textSize passed to ListAddEntry2Ext:
ListAddEntry2Ext is declared like this:
To avoid similar issues we should replace all Java shorts in the JNX codebase that are used as unsigned WORD values with a Java char.