Long Test Class Names cause builds to fail to finish

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

When a build runs with test class names longer than 4000 characters, the following may appear in the atlassian-bamboo.log

1 2 3 4 5 6 7 8 9 10 11 12 2018-05-22 19:43:34,104 INFO [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [AbstractBatchImpl] HHH000010: On release of batch it still contained JDBC statements 2018-05-22 19:43:34,104 ERROR [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [BatchingBatch] HHH000315: Exception executing batch [java.sql.BatchUpdateException: String or binary data would be truncated.], SQL: insert into TEST_CLASS (TEST_CLASS_NAME, PLAN_ID, TEST_CLASS_ID) values (?, ?, ?) 2018-05-22 19:43:34,104 WARN [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [SqlExceptionHelper] SQL Error: 8152, SQLState: 22001 2018-05-22 19:43:34,104 ERROR [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [SqlExceptionHelper] String or binary data would be truncated. 2018-05-22 19:43:34,104 INFO [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [DefaultErrorHandler] Recording an error: Could not save the build results. Data could be in an inconsistent state. : USAPI-USAPIREGR-JOB1 : org.hibernate.exception.DataException: could not execute batch 2018-05-22 19:43:34,104 FATAL [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [PlanStatePersisterImpl] Could not save the build results BuildResults: PROJ-PLAN-JOB-###. Data could be in an inconsistent state. javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute batch ... Caused by: org.hibernate.exception.DataException: could not execute batch ... Caused by: java.sql.BatchUpdateException: String or binary data would be truncated. ...

Cause

The TEST_CLASS_NAME column in the TEST_CLASS table, which stores the Test class name has a limit of 4000 characters. If this is too long, the SQL query to INSERT the value will fail with the stack trace above. The build will run successfully, but the error will appear when saving the test results.

Resolution

  1. Find any Test classes in your test suite that have names with 4000 characters or more

  2. Edit those test classes to have name less than 4000 characters

  3. Run the failing build again

Updated on April 14, 2025

Still need help?

The Atlassian Community is here for you.