Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Closes silently given CFBundleIconFile without ".icns" extension #75

Closed
1 of 3 tasks
symbioquine opened this issue Oct 13, 2019 · 9 comments
Closed
1 of 3 tasks
Assignees
Labels
Milestone

Comments

@symbioquine
Copy link

I'm submitting a…

  • bug report
  • feature request
  • other

Short description of the issue/suggestion:

Both of the following CFBundleIconFile configurations seem to be valid in one's Info.plist file - shows the icon in Finder and such correctly.

<key>CFBundleIconFile</key>    <string>icon.icns</string>
<key>CFBundleIconFile</key>    <string>icon</string>

However, the later - without the ".icns" extension - causes universalJavaApplicationStub to silently exit instead of showing the expected dialog.

Steps to reproduce the issue/enhancement:

  1. Take an otherwise working app bundle which uses universalJavaApplicationStub and change the CFBundleIconFile key in its Info.plist file to remove the ".icns" extension.
  2. Try launching the bundle under conditions that should show a dialog - such as the required Java version not being available.

What is the expected behavior?

One or more of the following;

  • universalJavaApplicationStub should still show dialogs - perhaps without the icon
  • universalJavaApplicationStub should explicitly complain in the syslog if the icon is specified in an invalid way
  • The documentation should explicitly call out this gotcha since it is unintuitive and moderately hard to troubleshoot

What is the current behavior?

universalJavaApplicationStub silently exits instead of showing the expected dialog.

Do you have screenshots, GIFs, demos or samples which demonstrate the problem or enhancement?

N/A

What is the motivation / use case for changing the behavior?

Make onboarding with this utility more fool-proof.

Please tell us about your environment:

  • universalJavaApplicationStub version: 3.0.4
  • Mac OS version: MacOSX Mojave 10.14
  • Java version(s): N/A - Current branch of testing uses OS image prior to installation of any JVM

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

N/A

@tofi86 tofi86 self-assigned this Oct 14, 2019
@tofi86 tofi86 added the bug label Oct 14, 2019
@tofi86 tofi86 added this to the Version 3.0.5 milestone Oct 14, 2019
@tofi86
Copy link
Owner

tofi86 commented Oct 14, 2019

Thanks for the report. Looks legit. I will have a closer look at the weekend.

@tofi86
Copy link
Owner

tofi86 commented Dec 8, 2019

This seems to be an issue with Oracle's Java. In my tests, it works well without the file type extension in AdoptOpenJDK 11 for example, but fails as described in Oralce JDK 8 or 9.

So technically it's not an issue with this launcher script.

I could add a function which add's .icns to icons which don't have an .icns extension, but that would be wrong as well, because also .png is an allowed filetype for the CFBundleIconFile key.

@symbioquine would you agree if I close this as invalid/out-of-scope?

@tofi86 tofi86 added wontfix and removed bug labels Dec 8, 2019
@symbioquine
Copy link
Author

@tofi86 That conclusion is a little surprising to me since I was testing under conditions where no JVM/JRE has ever been installed. I'd assumed this behavior is an artifact of how this tool uses AppleScript for displaying dialogs prior to invoking Java. Would you be willing to share your test methodology which shows the behavior to be specific to a particular Java distribution?

@tofi86 tofi86 added bug and removed wontfix labels Dec 8, 2019
@tofi86
Copy link
Owner

tofi86 commented Dec 8, 2019

Oh, so I experienced and investigated another issue while testing this and misunderstood your report. Sorry for that.

I read too quickly and interpreted "dialog" as your application GUI. So I changed the CFBundleIconFile in my demo app and removed the .icns extension and then tried to start the app.

Using AdoptOpen JDK this worked fine and the GUI was displayed. Then I switched to Oracle JDK and the GUI didn't show anymore. At this point I was sure I hit your issue and stopped investigating.

I will have another look in the next couple of days. Sorry for the delay.

tofi86 added a commit that referenced this issue Dec 9, 2019
check for undefined icons or icon names without .icns extension and prepare an osascript statement for those cases when the icon can be shown in the dialog
@tofi86
Copy link
Owner

tofi86 commented Dec 9, 2019

Okay, I tested this again, and I was able to reproduce the issue.

I pushed a fix to the develop branch. Could you probably test it as well?

@tofi86
Copy link
Owner

tofi86 commented Dec 9, 2019

Just out of curiosity: do you also get a system security events dialog before the AppleScript dialog? => #77

@tofi86
Copy link
Owner

tofi86 commented Dec 9, 2019

I pushed a fix to the develop branch.

To be a bit more verbose: The script now checks for the CFBundleIconFile in the Resources folder: if present, displays dialogs with icon. If not ending with *.icns but present with .icns in the Resources folder: displays dialogs with icon. In any other case, the dialog is displayed without an icon.

@tofi86 tofi86 closed this as completed Dec 9, 2019
@symbioquine
Copy link
Author

Thanks! Confirming the updated version appears to have solved the problem for me - the dialog works regardless of whether the .icns extension is specified.

Just out of curiosity: do you also get a system security events dialog before the AppleScript dialog?

I'm not sure. I wasn't seeing it in my latest testing this evening, but I think I've seen it in the past.

@tofi86
Copy link
Owner

tofi86 commented Dec 12, 2019

Perfect, thanks for testing!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants