Short overlfow

Have you ever thought how many values repeating attribute can have? Another interpretations of this question:

  • How many records can access list have?
  • How many direct subgroups can single group have?
  • How many direct members can single group have?
  • How many direct/indirect groups can single group belong to?

Let’s check:

/**
 * @author Andrey B. Panfilov <andrey@panfilov.tel>
 */
public class Test {

	public static void main(String[] args) throws Exception {
		IDfSessionManager sessionManager = new DfClientX()
                .getLocalClient().newSessionManager();
		sessionManager.setIdentity("DCTM_DEV", 
                new DfLoginInfo("dmadmin", "dmadmin"));
		IDfSession session = sessionManager.getSession("DCTM_DEV");
		IDfSysObject object = (IDfSysObject) session.newObject("dm_sysobject");
		for (int i = 0; i < 32780; i++) {
			object.setAuthors(i, String.valueOf(i));
		}
		System.out.println("Saving: " + object.getObjectId());
		object.save();
		session.flushObject(object.getObjectId());
		session = sessionManager.newSession("DCTM_DEV");
		object = (IDfSysObject) session.getObject(object.getObjectId());
		for (int i = 0; i < 32780; i++) {
			int value = Integer.parseInt(object.getAuthors(i));
			if (value != i) {
				System.out.println("author[" + i + "] has " 
                        + "wrong value of " + value + ", expected: " + i);
			}
		}
	}

}

[dmadmin@docu72dev01 ~]$ java Test 
Saving: 08024be98004be94
author[0] has wrong value of 32768, expected: 0
author[1] has wrong value of 32769, expected: 1
author[2] has wrong value of 32770, expected: 2
author[3] has wrong value of 32771, expected: 3
author[4] has wrong value of 32772, expected: 4
author[5] has wrong value of 32773, expected: 5
author[6] has wrong value of 32774, expected: 6
author[7] has wrong value of 32775, expected: 7
author[8] has wrong value of 32776, expected: 8
author[9] has wrong value of 32777, expected: 9
author[10] has wrong value of 32778, expected: 10
author[11] has wrong value of 32779, expected: 11
author[12] has wrong value of 0, expected: 12

...

author[32767] has wrong value of 32755, expected: 32767
author[32768] has wrong value of 32756, expected: 32768
author[32769] has wrong value of 32757, expected: 32769
author[32770] has wrong value of 32758, expected: 32770
author[32771] has wrong value of 32759, expected: 32771
author[32772] has wrong value of 32760, expected: 32772
author[32773] has wrong value of 32761, expected: 32773
author[32774] has wrong value of 32762, expected: 32774
author[32775] has wrong value of 32763, expected: 32775
author[32776] has wrong value of 32764, expected: 32776
author[32777] has wrong value of 32765, expected: 32777
author[32778] has wrong value of 32766, expected: 32778
author[32779] has wrong value of 32767, expected: 32779

So, the “safe” amount of repeating values is 32767, after that Content Server starts to corrupt data.