Skip to content

Comments

Don't call deprecated FileUtil::preventFileChooserSymlinkTraversal#9217

Open
mbien wants to merge 1 commit intoapache:masterfrom
mbien:cleanup-filechooser-traversal-util-usage
Open

Don't call deprecated FileUtil::preventFileChooserSymlinkTraversal#9217
mbien wants to merge 1 commit intoapache:masterfrom
mbien:cleanup-filechooser-traversal-util-usage

Conversation

@mbien
Copy link
Member

@mbien mbien commented Feb 22, 2026

Method is non-functional since java 6 and can be inlined as simple JFileChooser::setCurrentDirectory call. A code template used it too.

Reduces warning noise.

@mbien mbien added this to the NB30 milestone Feb 22, 2026
@mbien mbien added Code cleanup Label for cleanup done on the Netbeans IDE ci:all-tests [ci] enable all tests labels Feb 22, 2026
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

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

I started looking through this and in many places the call to setCurrentDirectory is redundant. Redundant in this case means, that it is either implicitly set as a side effect of setSelectedFile or explicitly by invocations of setCurrentDirectory.

While it is good to remove the call to the "magic function" (preventFileChooserSymlinkTraversal), we get multiple calls to functions that do the same thing.

This is not a blocker, but I noticed it. The replacements themselfes look sane to me.

@mbien
Copy link
Member Author

mbien commented Feb 23, 2026

will do another pass since all sequences of:

     JFileChooser chooser = new JFileChooser();
     chooser.setCurrentDirectory(null);

are already redundant, since the user dir is the JFileChooser's default dir after construction.

Method is non-functional since java 6 and can be inlined as simple
JFileChooser::setCurrentDirectory call, most can be removed since
the default dir after construction is the user dir already.

One usage was within a template file.

Reduces warning noise.
@mbien mbien force-pushed the cleanup-filechooser-traversal-util-usage branch 2 times, most recently from 14dffa1 to 346e178 Compare February 23, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:all-tests [ci] enable all tests Code cleanup Label for cleanup done on the Netbeans IDE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants