Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-mime not working for content > 32 KB but < 64 KB #182

Closed
markleusink opened this issue Nov 23, 2022 · 1 comment · Fixed by #183
Closed

Auto-mime not working for content > 32 KB but < 64 KB #182

markleusink opened this issue Nov 23, 2022 · 1 comment · Fixed by #183

Comments

@markleusink
Copy link
Contributor

markleusink commented Nov 23, 2022

There seems to be an issue with the auto-mime setting and 'large summary' feature of a database. This commit (321ffde) increases the amount of data that is allowed in a single field from 32 KB to 64 KB, but those limits only apply when the 'large summary' feature has been enabled.

If you now try to store data that is > 32 KB but 64 KB, the data isn't automatically serialized and an error is thrown. If you try to store > 64 KB in a field, it is still properly serialized into a Mime object.

Tested this on Domino 12.0.1 with the ODA 12.0.1 release.

This is also related to #175.

Domino limits are described here: https://help.hcltechsw.com/dom_designer/11.0.1/basic/H_NOTES_AND_DOMINO_KNOWN_LIMITS.html
https://help.hcltechsw.com/domino/12.0.0/admin/ods_55_introduced_in_domino_12.html

Test files:

more64.txt
less32.txt
between32and64.txt
almost32.txt

Test code:

`package eu.linqed;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import org.openntf.domino.utils.XSPUtil;
import org.openntf.domino.*;

public class OdaTest {

public static void klik() {

	Database db = XSPUtil.getCurrentDatabase();

	System.out.println(">> AutoMime setting is " + db.getAutoMime());
	
	create(db, "c:/java-dev/testdata/less32.txt");
	create(db, "c:/java-dev/testdata/between32and64.txt");
	create(db, "c:/java-dev/testdata/more64.txt");
	create(db, "c:/java-dev/testdata/almost32.txt");
	
	System.out.println("now store more fields with up to 32 KB of data in a single document");
	
	createMultipleFields(db, "c:/java-dev/testdata/almost32.txt");

}

private static void create(Database db, String path) {
	
	System.out.println("save with data from " + path);
	
	try {
		Document doc = db.createDocument();
		doc.replaceItemValue("form", "user");
		doc.replaceItemValue("path", path);
		doc.replaceItemValue("data", getContents(path));
		doc.save();

		System.out.println("saved contents of " + path + ", doc size is " + doc.getSize());
		
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	} catch (IOException e) {
		e.printStackTrace();
	}

}

private static void createMultipleFields(Database db, String path) {
	
	System.out.println("save multiple fields with data from " + path);
	
	try {
		Document doc = db.createDocument();
		doc.replaceItemValue("form", "user");
		doc.replaceItemValue("path", path);
		doc.replaceItemValue("data", getContents(path));
		doc.replaceItemValue("data2", getContents(path));
		doc.replaceItemValue("data3", getContents(path));
		doc.replaceItemValue("data4", getContents(path));
		doc.save();

		System.out.println("saved contents of " + path + ", doc size is " + doc.getSize());
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	} catch (IOException e) {
		e.printStackTrace();
	}

}

private static String getContents(String path) throws FileNotFoundException, IOException {

	StringBuilder builder = new StringBuilder();

	try (BufferedReader buffer = new BufferedReader(new FileReader(path))) {
		String str;
		while ((str = buffer.readLine()) != null) {
			builder.append(str).append("\n");
		}
	}

	System.out.println("data length = " + builder.toString().length());

	return builder.toString();

}

}
`

@markleusink
Copy link
Contributor Author

Working on a fix & pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant