Skip to content

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

Description

@markleusink

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();

}

}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions