-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
8.5.14
-
None
-
1
-
Severity 3 - Minor
-
5
-
Issue Summary
This is reproducible on Data Center: yes
There is a default character limit of 4000 for column attribute_value on table cwd_directory_attribute which is not big enough for some use cases.
Steps to Reproduce
- Create a User Directory in Confluence
- Under User Schema Settings, enter a User Object Filter string longer than 4000 characters
- Click Save and Test
Expected Results
The User Directory configuration is saved without any error.
Actual Results
The following error message is shown:
Oops - and error has occurred
System Error
Referer URL: https://<confluence-base-url>/plugins/servlet/embedded-crowd/configure/ldap/?directoryId=xxxx
The following error is shown in the logs:
atlassian-confluence.log
2024-10-14 08:44:50,023 ERROR [https-jsse-nio2-443-exec-3] [atlassian.plugin.servlet.ServletModuleContainerServlet] service Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement -- url: /plugins/servlet/embedded-crowd/configure/ldap/ | userName: localadmin | referer: https://<confluence-base-url>/plugins/servlet/embedded-crowd/configure/ldap/?directoryId=xxxx | traceId: 31d215599332f95e org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement ... Caused by: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement ... Caused by: org.hibernate.exception.DataException: could not execute statement ... Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1624) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:594) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:524) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2979) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:473) at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197) ... 435 more
Running SQL query:
SELECT column_name, data_type, character_maximum_length FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'cwd_directory_attribute';
Shows a limit of 4000 characters for column _attribute_value on table cwd_directory_attribute:
column_name data_type character_maximum_length directory_id numeric NULL attribute_name nvarchar 255 attribute_value nvarchar 4000
Workaround
Remove the 4000 characters limit with this SQL:
ALTER TABLE cwd_directory_attribute ALTER COLUMN attribute_value nvarchar (max);
Linked KB: Adding a long User Object Filter in a User Directory configuration results in "System Error"