Seems like possible bug in JIRA: I try to create avatar using JIRA API. I dive into JIRA sources and found that JIRA doesn't create directory for storing avatar image.
I do:
//code from ru.sputnik.jira.commons.componentapi.avatar.AvatarBuilder.create() return manager.create( my, //avatar instance avatarFileStream, //valid stream with images selection //null (full file) );
This failes due to:
Caused by: java.lang.NullPointerException at javax.imageio.ImageIO.write(Unknown Source) at com.atlassian.jira.avatar.AvatarManagerImpl.processImage(AvatarManagerImpl.java:256) at com.atlassian.jira.avatar.AvatarManagerImpl.create(AvatarManagerImpl.java:154) at ru.sputnik.jira.commons.componentapi.avatar.AvatarBuilder.create(AvatarBuilder.java:52)
But real reason is:
java.io.FileNotFoundException: /opt/jira-data/data/avatars/10606_xxxlarge@2x_/images/void.png (No such file or directory) at java.io.RandomAccessFile.open(Native Method) at java.io.RandomAccessFile.<init>(Unknown Source) at javax.imageio.stream.FileImageOutputStream.<init>(Unknown Source) at com.sun.imageio.spi.FileImageOutputStreamSpi.createOutputStreamInstance(Unknown Source) at javax.imageio.ImageIO.createImageOutputStream(Unknown Source) at javax.imageio.ImageIO.write(Unknown Source) at com.atlassian.jira.avatar.AvatarManagerImpl.processImage(AvatarManagerImpl.java:256)
Here is ls -al of avatar directory:
[root@atlas-dev avatars]# ls -al /opt/jira-data/data/avatars/ total 48 drwxr-xr-x 2 root root 4096 Июл 8 12:35 . drwxr-xr-x 4 root root 4096 Июл 8 12:35 .. -rw-r--r-- 1 root root 1714 Июл 8 12:35 10400_attachment7886595616537147273jrvtg.png -rw-r--r-- 1 root root 1055 Июл 8 12:35 10400_medium_attachment7886595616537147273jrvtg.png -rw-r--r-- 1 root root 788 Июл 8 12:35 10400_small_attachment7886595616537147273jrvtg.png -rw-r--r-- 1 root root 1722 Июл 8 12:35 10400_xlarge_attachment7886595616537147273jrvtg.png -rw-r--r-- 1 root root 497 Июл 8 12:35 10400_xsmall_attachment7886595616537147273jrvtg.png -rw-r--r-- 1 root root 6590 Июл 8 12:35 10400_xxlarge@2x_attachment7886595616537147273jrvtg.png -rw-r--r-- 1 root root 3525 Июл 8 12:35 10400_xxlarge_attachment7886595616537147273jrvtg.png -rw-r--r-- 1 root root 4078 Июл 8 12:35 10400_xxxlarge@2x_attachment7886595616537147273jrvtg.png -rw-r--r-- 1 root root 2683 Июл 8 12:35 10400_xxxlarge_attachment7886595616537147273jrvtg.png
Disclaimer: This is dev instance and I run this from root.
Here is screenshot at fail point:
https://habrastorage.org/files/bcc/0f2/d72/bcc0f2d722054371a722281c0a8a51db.png (I could paste image here, because of HTTP error)
Community moderators have prevented the ability to post new answers.
Hi Alexander,
the image will be stored in the subdirectory {{10606_xxxlarge
@2x_
/images/}}
which does not exist. I think this is an error - you would need to change the /
character in your image-name so the image can be stored.
Cheers
Reinhard
Hi Reinhard, thanx for you help. I modified my code and passed just file name "void.png" in my case. This was helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.