Mailhandler: Overly long subject containing Umlauts causes SQL Exception with Oracle

HermannS July 24, 2012

When the Mail-Handler of JIRA parses a Mail it truncates Mail-subjects to the maximum allowed length of the summary column of the underlying DB-table. But if the Mail-subject contains (german) Umlauts (or any other character that is encoded with more than one byte) this fails with an Oracle-DB as in Oracle the DB column length is specified in bytes (NOT in characters) by default.

A text that contains e.g. 10 characters that are all german Umlauts has a size of 10 *characters* but 20 *bytes*.

How to reproduce:

Send an Email to a JIRA instance that uses Oracle as its DB and is configured to create issues from mails. Use the following text as the subject of your mail:

{noformat}

TEST äöü test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test

{noformat}

This subject has as size of 268 characters and 271 bytes. It will be truncated to 255 characters and 258 bytes respectively.

You will see the following error in your log-file and no issue will be created:

{noformat}

com.atlassian.jira.exception.CreateException: com.atlassian.jira.workflow.WorkflowException: Error occurred while storing issue.

at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:427)

at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssueObject(DefaultIssueManager.java:493)

at com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createIssue(DefaultMessageHandlerContext.java:73)

at com.atlassian.jira.plugins.mail.handlers.CreateIssueHandler.handleMessage(CreateIssueHandler.java:242)

at com.atlassian.jira.plugins.mail.handlers.CreateOrCommentHandler.handleMessage(CreateOrCommentHandler.java:133)

at com.atlassian.jira.service.services.file.FileService.runImpl(FileService.java:163)

at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:250)

at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61)

at com.atlassian.jira.service.ServiceRunner.execute(ServiceRunner.java:47)

at org.quartz.core.JobRunShell.run(JobRunShell.java:195)

at com.atlassian.multitenant.quartz.MultiTenantThreadPool$MultiTenantRunnable.run(MultiTenantThreadPool.java:72)

at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

Caused by: com.atlassian.jira.workflow.WorkflowException: Error occurred while storing issue.

at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:846)

at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:416)

... 11 more

Caused by: com.atlassian.jira.exception.DataAccessException: Error occurred while storing issue.

at com.atlassian.jira.issue.IssueImpl.store(IssueImpl.java:1252)

at com.atlassian.jira.workflow.function.issue.IssueCreateFunction.execute(IssueCreateFunction.java:76)

at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1050)

at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1446)

at com.opensymphony.workflow.AbstractWorkflow.initialize(AbstractWorkflow.java:615)

at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:805)

... 12 more

Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: GenericEntity:Issue summary,TEST äöü test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test tes... status,1 votes,0 assignee,null security,null resolutiondate,null type,6 timespent,null id,15454 reporter,marmus@mailinator.com project,10002 environment,null created,2012-07-25 11:44:53.121 updated,2012-07-25 11:44:53.121 workflowId,15454 description,test

priority,3 timeestimate,null duedate,null timeoriginalestimate,null watches,0 key,EIN-781 (SQL Exception while executing the following:INSERT INTO jiraissue (ID, pkey, PROJECT, REPORTER, ASSIGNEE, issuetype, SUMMARY, DESCRIPTION, ENVIRONMENT, PRIORITY, RESOLUTION, issuestatus, CREATED, UPDATED, DUEDATE, RESOLUTIONDATE, VOTES, WATCHES, TIMEORIGINALESTIMATE, TIMEESTIMATE, TIMESPENT, WORKFLOW_ID, SECURITY, FIXFOR, COMPONENT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ORA-12899: value too large for column C1471017.JIRAISSUE.SUMMARY (actual: 258, maximum: 255)

))

at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:133)

at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:98)

at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:64)

at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:487)

at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:467)

at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:98)

at com.atlassian.core.ofbiz.util.EntityUtils.createValue(EntityUtils.java:71)

at com.atlassian.jira.issue.IssueImpl.store(IssueImpl.java:1235)

... 17 more

{noformat}

2 answers

1 accepted

0 votes
Answer accepted
HermannS October 9, 2012

This is a known problem and there is a related Issue in the JIRA bugtracker (https://jira.atlassian.com/browse/JRA-12304) including some hints to work around it.

So for me the problem is "solved" espescially as it's only a minor problem.

0 votes
Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 22, 2012

Is your database set to support UTF-8 characters?

HermannS October 9, 2012

Hello Andy

Sorry for the late response: Yes the database is configured to store anything in UTF-8. But as I said: Oracle has this distinction in column-widths between "CHAR" and "BYTES" and defaults to "BYTES" for varchar2...

Suggest an answer

Log in or Sign up to answer