java.lang.NullPointerException while uploading/downloading attachments with non-latin characters

お困りですか?

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

コミュニティに質問

プラットフォームについて: 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 the end user is trying to upload the attachment with unicode non-latin characters in the file name Confluence throw Internal Server Error because of the NullPointerException

atlassian-confluence.log に次のメッセージが出力される。

2017-01-25 17:28:59,563 ERROR [http-nio-8090-exec-5] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
 -- url: /pages/doattachfile.action | traceId: 9fca5b65981e2fab | userName: username | referer: http://confluence.com:8090/pages/viewpageattachments.action?pageId=9535506
java.lang.NullPointerException
	at com.atlassian.confluence.pages.actions.beans.AttachmentStorer.attachFiles(AttachmentStorer.java:57)
	at com.atlassian.confluence.pages.actions.AbstractViewAttachmentsAction.execute(AbstractViewAttachmentsAction.java:98)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:168)
	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)
	at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(ConfluenceWorkflowInterceptor.java:33)
....

診断

環境

  • You have Confluence installed with PostgreSQL database

Diagnostic Steps

  1. Check Encoding, Collation and CType of the database used by Confluence
  2. The correct values should be:
    1. Encoding: UTF8
    2. Collation: en_US.UTF-8 (or any other ISO 15897 compatible unicode locale i.e. cs_CZ.UTF-8 for Czech and de_CH.UTF-8 for Swiss German)
    3. CType: en_US.UTF-8 (or any other ISO 15897 compatible unicode locale i.e.  cs_CZ.UTF-8 for Czech and de_CH.UTF-8 for Swiss German)
  3. If you have different values for the mentioned parameters - your database is not configured correctly.

原因

According to Configuring Database Character Encoding:

 If LC_CTYPE is set to either "C" or "POSIX" then certain string functions such as converting to and from upper and lower case will not work correctly with international characters. Correct settings for this value take the form <LOCALE>.<ENCODING> (en_AU.UTF8 for example).

ソリューション

In case of PostgreSQL there is no solution which can allow you changing the collation and CType of the database with the data. Check in with the following documentation: How to fix the collation of a Postgres Confluence database

The only solution is to create new database with the correct Collation and CType and migrate the data with Pg_dump

Please follow PostgreSQL documentation in order to create the database with correct collation and CType: PostgreSQL: Chapter 22. Localization 

説明 uploading attachment with non-latin characters will cause internal server errors
製品Confluence
最終更新日: 2019 年 2 月 19 日

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

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