Updating a custom field context fails with HTTP 500 "java.lang.ArrayIndexOutOfBoundsException"

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

要約

When updating the context of a custom field, saving the new configuration fails. 

An HTTP 500 is shown in the UI with the text: 

Sorry, we had some technical problems during your last operation.

Request assistance
Copy the content below and send it to your Jira Administrator

Technical details
Log's referral number: b81add7a-0746-4664-aea0-13f72328e507

Cause
Referer URL: https://jira.example.com/secure/admin/ManageConfigurationScheme!default.jspa?atl_token=BWJ2-FNVR-C0IJ-9MEY_4d88c472bd4189605a74f9053297fdbb2cc7bd5f_lin&fieldConfigSchemeId=20504&customFieldId=16302&returnUrl=ConfigureCustomField%21default.jspa%3FcustomFieldId%3D16302

java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at com.atlassian.jira.web.action.admin.customfields.ManageConfigurationScheme.doExecute(ManageConfigurationScheme.java:185) [classes/:?]


診断

This error will occur if no issue types are selected for the field context, not even the Any issue type option. 

原因

When a change is done to a field context, the entries from the fieldconfigschemeissuetype and configurationcontext (among others) are deleted and re-added. In this scenario, the attempt to delete the entry from the fieldconfigschemeissuetype table fails with an NPE.

This can be validated if the SQL query below returns no rows: 

SELECT * FROM fieldconfigschemeissuetype WHERE fieldconfigscheme = <fieldconfigscheme_id>;

(info) Note that <fieldconfigscheme_id> in the query should have the value from the fieldConfigSchemeId parameter in the referer URL of the error above. 

It's still not known why such a row would be absent from the table. This could happen if the re-insertion failed or the user interrupted the process after the deletion. 

ソリューション

Solution 1:

Create a new context that's identical to the original context (the one that can't be saved) then delete the original. 

This action does not cause any data loss in the custom field. 


Solution 2:

In some scenario it may happen that no issueType  is available for Global context and there is no option to delete the context. Users may also want to avoid deleting existing context. In these scenarios, below mentioned steps would be useful.

  • As per the document Manually inserting records, if user want to manually insert records into Jira database tables, user must update SEQUENCE\_VALUE\_ITEM manually. Set the relevant rows’ SEQ\_ID values to a value greater than the actual maximum ID in the table. To ensure all database caches are reset, need Jira restart.
  • User would have to insert the entry in the fieldconfigschemeissuetype table. This entry is the mapping of fieldConfigSchemeId with  issueType id.

    データベースの変更を行う場合は 必ず事前にバックアップを取得してください。可能な場合はテスト サーバーで変更を試すことをおすすめします。


select * from SEQUENCE_VALUE_ITEM where seq_name like '%FieldConfigSchemeIssueType%';
seq_name | seq_id
----------------------------+--------
FieldConfigSchemeIssueType | 27400

select id from fieldconfigscheme where fieldid = 'customfield_16302';
ID   |
-----+
20504|

select id from fieldconfiguration where fieldid = 'customfield_16302';
ID   |
-----+
20504|

select Max(id) from fieldconfigschemeissuetype;
MAX(ID)|
-------+
  27352|

SELECT id FROM ISSUETYPE i WHERE PNAME = 'Test' ;
ID   |
-----+
10300|

INSERT INTO fieldconfigschemeissuetype (id, issuetype, fieldconfigscheme, fieldconfiguration) VALUES(27353, 10300, 20504, 20504);



Restart of JIRA is required, so that changes are visible.



最終更新日: 2022 年 10 月 5 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.