Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8227257: javax/swing/JFileChooser/4847375/bug4847375.java fails with AssertionError #11789

Closed
wants to merge 2 commits into from

Conversation

mrserb
Copy link
Member

@mrserb mrserb commented Dec 26, 2022

This assertion happens when we try to build the path linked by the shortcut file when part of that path is not accessible. For example, if the ".lnk" file is pointed to the "windows-update. settings" inside the "Internet.settings".

After the change, we will skip the target of the link if any part of the path to the target is not a folder and is not traversable in JFileChooser.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8227257: javax/swing/JFileChooser/4847375/bug4847375.java fails with AssertionError

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11789/head:pull/11789
$ git checkout pull/11789

Update a local copy of the PR:
$ git checkout pull/11789
$ git pull https://git.openjdk.org/jdk pull/11789/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11789

View PR using the GUI difftool:
$ git pr show -t 11789

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11789.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 26, 2022

👋 Welcome back serb! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 26, 2022

@mrserb The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Dec 26, 2022
@mrserb mrserb marked this pull request as ready for review December 26, 2022 23:07
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 26, 2022
@mlbridge
Copy link

mlbridge bot commented Dec 26, 2022

Webrevs

@aivanov-jdk
Copy link
Member

So, to reproduce this issue, one has to put a shortcut (.lnk file) which points to a virtual folder which has no file system path, any Control Panel applets or Control Panel itself could trigger this.

Is my understanding correct?

@mrserb
Copy link
Member Author

mrserb commented Jan 4, 2023

So, to reproduce this issue, one has to put a shortcut (.lnk file) which points to a virtual folder which has no file system path, any Control Panel applets or Control Panel itself could trigger this.

Is my understanding correct?

The user should actually open that 'place in Control Panel" first so the link will have appeared in the "recent files" folder, the exception occurs when the JFC tries to build a "files tree". This is how I get the lnk file for the test.

@prrace
Copy link
Contributor

prrace commented Jan 5, 2023

What do people mean by Control Panel ? Do you mean Windows (File) Explorer ?
If you do mean Control Panel I think I need a picture or two to show me how that affects FileChooser.
Is that lnk file format something that is "stable" across Windows releases ?

@aivanov-jdk
Copy link
Member

What do people mean by Control Panel ? Do you mean Windows (File) Explorer ? If you do mean Control Panel I think I need a picture or two to show me how that affects FileChooser. Is that lnk file format something that is "stable" across Windows releases ?

I mean the classical Control Panel that's launched in Windows Explorer as opposed to the modern Settings app.

A shortcut, .lnk, can point to any object in the Shell namespace (a COM object) not only to objects on file system.

From the linked email, I infer there's The Internet object (on a desktop? ) which is marked with ATTRIB_BROWSABLE but not ATTRIB_FOLDER. That is the Windows (File) Explorer can navigate to this object, yet JFileChooser can't because this object is not a file system object.

If I understand @mrserb's scenario where he reproduced the problem, one of the folders (Recent) contained a shortcut which has the same or similar properties: the File Explorer can navigate to the object to which the shortcut points, yet JFileChooser can't because it shows and navigates file system objects object.

A .lnk object is stable across Windows releases, basically it's a serialised form of IShellLink interface. Yet the shell would fail to resolve the .lnk if the shell extension it points to is not installed.

Copy link
Member

@aivanov-jdk aivanov-jdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this resolves the problem. And I reproduced the original issue with AssertionError by running bug4847375.java with enabled assertions.

You're right, the Recent folder contains a handful of link files which point to the new Setting app which use ms-settings: protocol, File Explorer displays the target location as "The Internet".

@openjdk
Copy link

openjdk bot commented Jan 6, 2023

@mrserb This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8227257: javax/swing/JFileChooser/4847375/bug4847375.java fails with AssertionError

Reviewed-by: aivanov, tr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 133 new commits pushed to the master branch:

  • 95b102c: 8299309: Test "java/awt/Dialog/ModalDialogTest/ModalDialogTest.java" fails because new frame was not displayed when "New Frame" button was clicked
  • f312c99: 8299482: Remove metaprogramming/isIntegral.hpp
  • 10a747c: 8299479: Remove metaprogramming/decay.hpp
  • ddca2b9: 8299701: Remove unused GCCause::_wb_conc_mark
  • c595f96: 8299278: tools/jpackage/share/AddLauncherTest.java#id1 failed AddLauncherTest.bug8230933
  • 3c99e78: 8298735: Some tools/jpackage/windows/* tests fails with jtreg test timeout
  • 5a51ef2: 8297874: get_dump_directory() in jfrEmergencyDump.cpp should pass correct length to jio_snprintf
  • a86b6f6: 8299183: Invokers.checkExactType passes parameters to create WMTE in opposite order
  • 8b0133f: 8299259: C2: Div/Mod nodes without zero check could be split through iv phi of loop resulting in SIGFPE
  • d68de02: 8299845: Remove obsolete comments in DirtyCardToOopClosure::get_actual_top
  • ... and 123 more: https://git.openjdk.org/jdk/compare/19373b2ff0cd795afa262c17dcb3388fd6a5be59...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 6, 2023
@aivanov-jdk
Copy link
Member

By the way, JFileChooser can navigate the .lnk files which point to the classic Control Panel. I created a shortcut to Devices and Printers folder on the desktop. Double-clicking it, opens the folder but shows no items; the combo box at the top shows the structure: DesktopControl PanelHardware and SoundDevices and Printers followed by This PC and other common items.

Copy link
Contributor

@TejeshR13 TejeshR13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good to me.

@mrserb
Copy link
Member Author

mrserb commented Jan 12, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Jan 12, 2023

Going to push as commit 78b1686.
Since your change was applied there have been 156 commits pushed to the master branch:

  • 33f3bd8: Merge
  • 945ef07: 8299862: OfAddress setter should disallow heap segments
  • 636976a: 8299849: Revert JDK-8294461: wrong effectively final determination by javac
  • 0abb87a: 8299227: host exif.org not found in link in doc comment
  • de79162: 8299715: IR test: VectorGatherScatterTest.java fails with SVE randomly
  • 151450e: 8294744: AArch64: applications/kitchensink/Kitchensink.java crashed: assert(oopDesc::is_oop(obj)) failed: not an oop
  • 21d468e: 8299733: AArch64: "unexpected literal addressing mode" assertion failure with -XX:+PrintC1Statistics
  • 5826a07: 8299693: Change to Xcode12.4+1.1 devkit for building on macOS at Oracle
  • 8db73f7: 8300001: ProblemList test java/security/Policy/Root/Root.java
  • 43847c4: 8298065: Provide more information in message of NoSuchFieldError
  • ... and 146 more: https://git.openjdk.org/jdk/compare/19373b2ff0cd795afa262c17dcb3388fd6a5be59...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 12, 2023
@openjdk openjdk bot closed this Jan 12, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 12, 2023
@openjdk
Copy link

openjdk bot commented Jan 12, 2023

@mrserb Pushed as commit 78b1686.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@mrserb mrserb deleted the JDK-8227257 branch January 12, 2023 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
4 participants