Skip to content

Commit 1a71cb6

Browse files
Merge branch 'release/12.0.2a'
2 parents 61e84fd + 9753b6d commit 1a71cb6

File tree

6 files changed

+145
-71
lines changed

6 files changed

+145
-71
lines changed

domino/core/src/main/java/org/openntf/domino/Document.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@
9494
*/
9595
public interface Document extends Base<lotus.domino.Document>, lotus.domino.Document, org.openntf.domino.ext.Document, Resurrectable,
9696
DatabaseDescendant, Map<String, Object>, AsDocMap, ExceptionDetails {
97-
public static int MAX_NATIVE_FIELD_SIZE = 64000;
97+
//defaults when 'large summary' hasn't been set
98+
//see https://help.hcltechsw.com/dom_designer/11.0.1/basic/H_NOTES_AND_DOMINO_KNOWN_LIMITS.html
99+
public static int MAX_NATIVE_FIELD_SIZE = 32000;
98100
public static int MAX_SUMMARY_FIELD_SIZE = 64000;
99101

100102
public static class Schema extends FactorySchema<Document, lotus.domino.Document, Database> {
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,60 @@
1-
/**
2-
* Copyright © 2013-2021 The OpenNTF Domino API Team
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
package org.openntf.domino.exceptions;
17-
18-
public class DominoNonSummaryLimitException extends Exception {
19-
20-
private static final long serialVersionUID = 1L;
21-
22-
public DominoNonSummaryLimitException() {
23-
super();
24-
}
25-
26-
/**
27-
* @param message
28-
* the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.
29-
*/
30-
public DominoNonSummaryLimitException(final String message) {
31-
super(message);
32-
}
33-
34-
/**
35-
* @param cause
36-
* the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and
37-
* indicates that the cause is nonexistent or unknown.)
38-
*/
39-
public DominoNonSummaryLimitException(final Throwable cause) {
40-
super(cause);
41-
}
42-
43-
/**
44-
* @param message
45-
* the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.
46-
* @param cause
47-
* the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and
48-
* indicates that the cause is nonexistent or unknown.)
49-
*/
50-
public DominoNonSummaryLimitException(final String message, final Throwable cause) {
51-
super(message, cause);
52-
}
53-
54-
}
1+
/**
2+
* Copyright © 2013-2021 The OpenNTF Domino API Team
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.openntf.domino.exceptions;
17+
18+
public class DominoFieldSizeException extends Exception {
19+
20+
private static final long serialVersionUID = 1L;
21+
22+
public DominoFieldSizeException() {
23+
super();
24+
}
25+
26+
public DominoFieldSizeException(final String itemName, int size) {
27+
super("Could not store data in field '" + itemName + "': size is too large (size: " + size + "). " +
28+
"Consider (1) enabling 'large summary on the database, (2) enabling auto-mime or " +
29+
"(3) using replaceItemValueCustomData()");
30+
}
31+
32+
/**
33+
* @param message
34+
* the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.
35+
*/
36+
public DominoFieldSizeException(final String message) {
37+
super(message);
38+
}
39+
40+
/**
41+
* @param cause
42+
* the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and
43+
* indicates that the cause is nonexistent or unknown.)
44+
*/
45+
public DominoFieldSizeException(final Throwable cause) {
46+
super(cause);
47+
}
48+
49+
/**
50+
* @param message
51+
* the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.
52+
* @param cause
53+
* the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and
54+
* indicates that the cause is nonexistent or unknown.)
55+
*/
56+
public DominoFieldSizeException(final String message, final Throwable cause) {
57+
super(message, cause);
58+
}
59+
60+
}

domino/core/src/main/java/org/openntf/domino/ext/Database.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,21 @@ public DocumentCollection FTSearchRange(final String query, final int maxDocs, f
832832
* @since org.openntf.domino 5.0.0
833833
*/
834834
public void setAutoMime(AutoMime autoMime);
835+
836+
/**
837+
* Indicates if the 'large summary' flag is set on the database, allowing up to 16 MB of summary data
838+
*
839+
* @since org.openntf.domino 12.0.2
840+
*/
841+
public boolean isLargeSummaryEnabled();
842+
843+
/**
844+
* Indicates if DAOS is enabled on the database.
845+
*
846+
* @since org.openntf.domino 12.0.2
847+
*/
848+
public boolean isDaosEnabled();
849+
835850

836851
/**
837852
* Gets the $DefaultLanguage stored in the icon note and converts it to a locale

domino/core/src/main/java/org/openntf/domino/impl/Database.java

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ public class Database extends BaseResurrectable<org.openntf.domino.Database, lot
115115
private AutoMime autoMime_;
116116

117117
private DatabaseMetaData shadowedMetaData_;
118+
119+
private boolean largeSummaryEnabled = false;
120+
private boolean daosEnabled = false;
121+
private boolean designRead = false;
118122

119123
// private String ident_;
120124

@@ -3758,7 +3762,37 @@ public AutoMime getAutoMime() {
37583762
public void setAutoMime(final AutoMime autoMime) {
37593763
autoMime_ = autoMime;
37603764
}
3761-
3765+
3766+
public boolean isLargeSummaryEnabled() {
3767+
readDesignNote();
3768+
return largeSummaryEnabled;
3769+
}
3770+
3771+
public boolean isDaosEnabled() {
3772+
readDesignNote();
3773+
return daosEnabled;
3774+
}
3775+
3776+
/*
3777+
* read database settings from the IconNote.
3778+
*/
3779+
private void readDesignNote() {
3780+
3781+
if (designRead) {
3782+
return;
3783+
}
3784+
3785+
designRead = true;
3786+
3787+
Document doc = getDesign().getIconNote().getDocument();
3788+
3789+
if (doc != null) {
3790+
daosEnabled = "1".equals(doc.getItemValueString("$Daos") );
3791+
largeSummaryEnabled = "1".equals(doc.getItemValueString("$LargeSummary") );
3792+
}
3793+
3794+
}
3795+
37623796
private Locale dbLocale = null;
37633797
private boolean getLocaleCalled = false;
37643798

domino/core/src/main/java/org/openntf/domino/impl/Document.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
import org.openntf.domino.events.IDominoEvent;
6565
import org.openntf.domino.exceptions.DataNotCompatibleException;
6666
import org.openntf.domino.exceptions.DocumentWriteAccessException;
67-
import org.openntf.domino.exceptions.DominoNonSummaryLimitException;
67+
import org.openntf.domino.exceptions.DominoFieldSizeException;
6868
import org.openntf.domino.exceptions.ItemNotFoundException;
6969
import org.openntf.domino.exceptions.OpenNTFNotesException;
7070
import org.openntf.domino.exceptions.UserAccessException;
@@ -2881,7 +2881,7 @@ public Item replaceItemValue(final String itemName, final Object value, final Bo
28812881
// AutoMime completely disabled.
28822882
throw ex2;
28832883
}
2884-
if (!boxCompatibleOnly || ex2 instanceof DominoNonSummaryLimitException) {
2884+
if (!boxCompatibleOnly || ex2 instanceof DominoFieldSizeException) {
28852885
// if the value exceeds 32k or we are called from put() (means boxCompatibleOnly=false) we try to write the object as MIME
28862886
result = replaceItemValueCustomData(itemName, "mime-bean", value, returnItem);
28872887
} else if (this.getAutoMime() == AutoMime.WRAP_ALL) {
@@ -2946,11 +2946,11 @@ public Item replaceItemValue(final String itemName, final Object value, final Bo
29462946
*
29472947
* It throws a DataNotCompatibleException, if the data is not domino compatible
29482948
*
2949-
* @throws DominoNonSummaryLimitException
2949+
* @throws DominoFieldSizeException
29502950
* if the item does not fit in a field
29512951
*/
29522952
public Item replaceItemValueLotus(final String itemName, Object value, final Boolean isSummary, final boolean returnItem)
2953-
throws DominoNonSummaryLimitException {
2953+
throws DominoFieldSizeException {
29542954
checkMimeOpen(itemName);
29552955
// writing a value of "Null" leads to a remove of the item if configured in SESSION
29562956
if (value == null || value instanceof Null) {

domino/core/src/main/java/org/openntf/domino/utils/TypeUtils.java

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
import org.openntf.domino.Session;
5353
import org.openntf.domino.big.NoteCoordinate;
5454
import org.openntf.domino.exceptions.DataNotCompatibleException;
55-
import org.openntf.domino.exceptions.DominoNonSummaryLimitException;
55+
import org.openntf.domino.exceptions.DominoFieldSizeException;
5656
import org.openntf.domino.exceptions.ItemNotFoundException;
5757
import org.openntf.domino.exceptions.UnimplementedException;
5858
import org.openntf.domino.ext.Formula;
@@ -1927,7 +1927,7 @@ public static int getLotusPayload(final Object o, final Class<?> c) {
19271927

19281928
@SuppressWarnings("unchecked")
19291929
public static Item writeToItem(final org.openntf.domino.Document doc, final String itemName, Object value, final Boolean isSummary)
1930-
throws DominoNonSummaryLimitException {
1930+
throws DominoFieldSizeException {
19311931
Class<?> fromClass = value.getClass();
19321932
CustomConverter converter = findCustomConverter(fromClass);
19331933
if (converter != null) {
@@ -1973,12 +1973,20 @@ public static Item writeToItem(final org.openntf.domino.Document doc, final Stri
19731973
}
19741974
}
19751975
} else if (value.getClass().isArray()) {
1976+
1977+
int maxFieldSize = org.openntf.domino.Document.MAX_NATIVE_FIELD_SIZE;
1978+
if (doc.getAncestorDatabase().isLargeSummaryEnabled()) {
1979+
//limit is increased to 64 KB, see
1980+
//https://help.hcltechsw.com/domino/11.0.1/admin/admn_increase_document_summary_data_limit.html
1981+
maxFieldSize = 64000;
1982+
}
1983+
19761984
recycleThis = new ArrayList<lotus.domino.Base>();
19771985
int lh = Array.getLength(value);
1978-
if (lh > org.openntf.domino.Document.MAX_NATIVE_FIELD_SIZE) { // Then skip making dominoFriendly if it's a primitive
1986+
if (lh > maxFieldSize) { // Then skip making dominoFriendly if it's a primitive
19791987
String cn = value.getClass().getName();
19801988
if (cn.length() == 2) { // It is primitive
1981-
throw new DominoNonSummaryLimitException();
1989+
throw new DominoFieldSizeException(itemName, lh);
19821990
}
19831991
}
19841992
dominoFriendlyVec = new Vector<Object>(lh);
@@ -2058,26 +2066,35 @@ public static Item writeToItem(final org.openntf.domino.Document doc, final Stri
20582066
} else {
20592067
payload += getLotusPayload(dominoFriendlyObj, firstElementClass);
20602068
}
2061-
2062-
if (payload > org.openntf.domino.Document.MAX_NATIVE_FIELD_SIZE) {
2069+
2070+
int maxFieldSize = org.openntf.domino.Document.MAX_NATIVE_FIELD_SIZE;
2071+
int maxSummaryDataSize = org.openntf.domino.Document.MAX_SUMMARY_FIELD_SIZE;
2072+
if (doc.getAncestorDatabase().isLargeSummaryEnabled()) {
2073+
//limit is increased to 64 KB, see
2074+
//https://help.hcltechsw.com/domino/11.0.1/admin/admn_increase_document_summary_data_limit.html
2075+
maxFieldSize = 64000;
2076+
maxSummaryDataSize = 16000000; //16 MB
2077+
}
2078+
2079+
if (payload > maxFieldSize) {
20632080
// the datatype is OK, but there's no way to store the data in the Document
2064-
throw new DominoNonSummaryLimitException();
2081+
throw new DominoFieldSizeException(itemName, payload);
20652082
}
20662083
if (firstElementClass == String.class) { // Strings have to be further inspected, because
20672084
// each sign may demand up to 3 bytes in LMBCS
20682085
int calc = ((payload - payloadOverhead) * 3) + payloadOverhead;
2069-
if (calc >= org.openntf.domino.Document.MAX_NATIVE_FIELD_SIZE) {
2086+
if (calc >= maxFieldSize) {
20702087
if (dominoFriendlyVec != null) {
20712088
payload = payloadOverhead + LMBCSUtils.getPayload(dominoFriendlyVec);
20722089
} else {
20732090
payload = payloadOverhead + LMBCSUtils.getPayload((String) dominoFriendlyObj);
20742091
}
2075-
if (payload > org.openntf.domino.Document.MAX_NATIVE_FIELD_SIZE) {
2076-
throw new DominoNonSummaryLimitException();
2092+
if (payload > maxFieldSize) {
2093+
throw new DominoFieldSizeException(itemName, payload);
20772094
}
20782095
}
20792096
}
2080-
if (payload > org.openntf.domino.Document.MAX_NATIVE_FIELD_SIZE) {
2097+
if (payload > maxSummaryDataSize) {
20812098
isNonSummary = true;
20822099
}
20832100

0 commit comments

Comments
 (0)