Unable to directly open shared images sent via Spark File Transfer (java.io.IOException: Failed to open "image.png". Error message: No application is associated with the specified file for this operation.)

Not sure if this constitutes a bug, a configuration issue, or something else. If I need to add this to the issue tracker, let me know.

I’m trying to troubleshoot a problem noticed with sharing images (so far confirmed with JPG and PNG’s) via Spark’s file transfer mechanism, including directly selecting files, pasting images, or using the screenshot tool embedded within Spark. The behavior that I’m seeing is that the sender sees the image that was sent, but cannot click to open the image successfully. The recipient sees the image that was received, and sees the options to Open or Open Folder, but clicking Open does not work, while clicking Open Folder successfully opens the folder containing the image.

Looking at the error log for Spark, I see the following trace (truncated to what appears to be relevant):

May 03, 2022 10:56:50 AM org.jivesoftware.spark.util.log.Log error
SEVERE: An error occurred while trying to open downloaded file: C:\Users\testuser\AppData\Roaming\Spark\tempImages\image_YM.png
java.io.IOException: Failed to open C:\Users\testuser\AppData\Roaming\Spark\tempImages\image_YM.png. Error message: No application is associated with the specified file for this operation.

at sun.awt.windows.WDesktopPeer.ShellExecute(Unknown Source)
at sun.awt.windows.WDesktopPeer.open(Unknown Source)
at java.awt.Desktop.open(Unknown Source)
at org.jivesoftware.sparkimpl.plugin.filetransfer.transfer.ui.SendFileTransfer.openFile(SendFileTransfer.java:273)
at org.jivesoftware.sparkimpl.plugin.filetransfer.transfer.ui.SendFileTransfer.access$500(SendFileTransfer.java:63)
at org.jivesoftware.sparkimpl.plugin.filetransfer.transfer.ui.SendFileTransfer$4.mouseClicked(SendFileTransfer.java:255)

Not knowing Java well enough, I took to Google. I see others outside of Spark having similar issues, and references to using the edit() method within java.awt.Desktop instead of open(). There are also references to checking the supported method between edit or open first, but I am very much not a Java dev to know where to poke around in Spark’s code to know what to look for.

I can state that the image has a working default application (I can open directly in Explorer or other applications). I’ve also verified this against released builds of 3.0.0 beta, 2.9.4, and 2.8.3. I’m not using the embedded JRE version as we have system instances of Oracle JRE 8 that are kept up to date.

Other file types seem to work by default, such as TXT, PDF, XLSX, etc.

I also realize that there is the HTTP File Upload method, which works, but is not used by some of the default functions (pasting images, the screenshot tool, etc.).

Hi Ricky,

Thanks for taking the time to dig into this. This sounds like a good improvement to me. I’ve raised a new ticket to track this change: [SPARK-2268] - Ignite Realtime Jira

1 Like