java.lang.IllegalStateException: Character set is not defined for uploadItem

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.

Platform Notice: Server, Data Center, and Cloud By Request - This article was written for the Atlassian server and data center platforms but may also be useful for Atlassian Cloud customers. If completing instructions in this article would help you, please contact Atlassian Support and mention it.

Problem

Whenever you try opening a review the following error can be found in the atlassian-fisheye.log:


2019-08-02 13:42:03,071 ERROR [qtp943573036-841 ] fisheye FRXDO-mapInlineComments - Error mapping comments. Cannot display comments on review CR-1. Error: Character set is not defined for uploadItem file.txt
java.lang.IllegalStateException: Character set is not defined for uploadItem file.txt
	at com.cenqua.crucible.revision.managers.DefaultEncodedContentProvider.getCharset(DefaultEncodedContentProvider.java:103) [fisheye.jar:?]
	at com.cenqua.crucible.revision.managers.DefaultEncodedContentProvider.getContent(DefaultEncodedContentProvider.java:86) [fisheye.jar:?]
	at com.cenqua.crucible.revision.managers.DefaultContentManager.getContents(DefaultContentManager.java:641) [fisheye.jar:?]
	at com.cenqua.fisheye.diff.DiffHelper.getHunkList(DiffHelper.java:135) [fisheye.jar:?]
	at com.cenqua.crucible.revision.source.Source.getHunkList(Source.java:224) [fisheye.jar:?]
	at com.cenqua.crucible.view.FRXDO.getHunkList(FRXDO.java:1298) [fisheye.jar:?]
	at com.cenqua.crucible.view.FRXDO.getTetrisGrid(FRXDO.java:811) [fisheye.jar:?]
	at com.cenqua.crucible.view.FRXDO.mapInlineComments(FRXDO.java:829) [fisheye.jar:?]
	at com.cenqua.crucible.view.FRXDO.<init>(FRXDO.java:213) [fisheye.jar:?]
	at com.cenqua.crucible.revision.managers.DefaultContentManager.makeFRXDO(DefaultContentManager.java:130) [fisheye.jar:?]
	at com.atlassian.crucible.actions.ReviewBaseAction.makeFRXDO(ReviewBaseAction.java:546) [fisheye.jar:?]
	at com.atlassian.crucible.actions.ViewFRXAction$1.doInTransaction(ViewFRXAction.java:193) [fisheye.jar:?]
	at com.atlassian.crucible.actions.ViewFRXAction$1.doInTransaction(ViewFRXAction.java:166) [fisheye.jar:?]
	at com.atlassian.fisheye.spi.impl.DefaultTxTemplate.execute(DefaultTxTemplate.java:78) [fisheye.jar:?]
	at com.atlassian.crucible.actions.ViewFRXAction.execute(ViewFRXAction.java:166) [fisheye.jar:?]
	...

Cause

This problem may happen when the review has files uploaded as Attachments or as Pre-commit patches.

At the moment these files get uploaded they don't have a charset / encoding defined (or Crucible fails to detect it), and this information goes missing into the database.

The error happens when Crucible tries to retrieve the information from the database and the charset cannot be found.

Resolution

  1. Shut down Crucible

  2. Backup the database using the database vendor software, just to be on the safe side.
  3. Query the database for the file mentioned in the stack trace (e.g., file.txt in the example above) by running this query:

    SELECT cru_charset, cru_upload_id, cru_original_name FROM cru_upload_item WHERE cru_original_name = 'file.txt';
  4. You may get a multiple rows in the query output, and among them you may see a few rows with cru_charset empty (or null):

     cru_charset | cru_upload_id | cru_original_name
    -------------+---------------+-------------------
     UTF-8       |         35205 | file.txt
     UTF-8       |         35206 | file.txt
     UTF-8       |         35264 | file.txt
     UTF-8       |         35265 | file.txt
                 |         35377 | file.txt
                 |         35376 | file.txt
  5. Fix the problem by adding 'UTF-8' to cru_charset where they're missing by running this query:

    UPDATE cru_upload_item SET cru_charset = 'UTF-8' WHERE cru_upload_id = 35376 AND cru_original_name = 'file.txt';
    UPDATE cru_upload_item SET cru_charset = 'UTF-8' WHERE cru_upload_id = 35377 AND cru_original_name = 'file.txt';
  6. Start Crucible


DescriptionAn IllegalStateException error happens when opening a review that contains uploaded files because no charset is found at database level
ProductCrucible
Last modified on Aug 6, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.