-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
6616245: NullPointerException when using JFileChooser with a custom FileView #10485
Conversation
👋 Welcome back tr! A progress list of the required criteria for merging this PR into |
@TejeshR13 The following label will be automatically applied to this pull request:
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. |
Webrevs
|
The instruction are not quite clear. Can you please modify it as we discussed over call? |
Updated. |
@kumarabhi006 Can you please review this PR. |
@azuev-java Can you please review this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You say that the current directory in JFileChooser
gets set to null
because of forbidden navigation to a folder which is not traversable. You avoid the NPE by a null-check.
However, you should prevent the current directory to be set to null
. If navigation is not allowed, the current directory should remain unchanged instead of being reset to null
.
if (!getFileChooser().getCurrentDirectory().equals(f)) { | ||
File curDir = getFileChooser().getCurrentDirectory(); | ||
|
||
if (curDir != null && !curDir.equals(f)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If f
is always not null, you can you use !f.equals(curDir)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prevention of not setting to null means I have to modify JFileChooser
class itself, so just handling here. And yeahf
can't be null, can do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it bad to modify JFileChooser
class itself?
I think setting the current directory to null
while it displays a directory kind of breaks the invariant.
JFileChooser
navigated to a directory and the current directory is set to it. You tried navigating to another directory, FileSystem
didn't allow the navigation, so JFileChooser
continues to display the files in the directory that is showed before. Thus, the current directory hasn't changed. From this point of view, the current directory should remain unchanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentDirectory = dir; |
Here the above logic checks if the current selected directory is traversable and if not it goes up to parent directory till top level and when every check fails then null is set to
currentDirectory
. Should we think of modifying this logic to not to set to null, rather remain in previously valid folder......?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the logic there tries to prevent the current directory from becoming null
. Yet it traverses up the tree:
jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java
Lines 603 to 607 in ccc1d31
File prev = null; | |
while (!isTraversable(dir) && prev != dir) { | |
prev = dir; | |
dir = getFileSystemView().getParentDirectory(dir); | |
} |
Probably, if dir
becomes null
in the end, it should resort to its default behaviour: getFileSystemView().getDefaultDirectory()
. Or not change at all?
Then, you can handle the situation here: if getFileChooser().getCurrentDirectory()
returns null
, restore the previous current directory.
And what about other L&F? If the same code runs in Windows L&F, Nimbus L&F, any other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other L&F the same problem exist, but NPE is does not occurs because previous state check is not done, directly the clicked file is been set.
jdk/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java
Line 1328 in ccc1d31
getFileChooser().setCurrentDirectory(f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the logic there tries to prevent the current directory from becoming
null
. Yet it traverses up the tree:jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java
Lines 603 to 607 in ccc1d31
File prev = null; while (!isTraversable(dir) && prev != dir) { prev = dir; dir = getFileSystemView().getParentDirectory(dir); } Probably, if
dir
becomesnull
in the end, it should resort to its default behaviour:getFileSystemView().getDefaultDirectory()
. Or not change at all?
This behaviour is specified.
jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java
Lines 576 to 580 in ccc1d31
* If the file passed in as <code>currentDirectory</code> is not a | |
* directory, the parent of the file will be used as the currentDirectory. | |
* If the parent is not traversable, then it will walk up the parent tree | |
* until it finds a traversable directory, or hits the root of the | |
* file system. |
Yet it doesn't take into account a custom implementation of FileSystem
which does not allow navigating up. It may be a problem in FileSystem
implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other L&F the same problem exist, but NPE is does not occurs because previous state check is not done, directly the clicked file is been set.
jdk/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java
Line 1328 in ccc1d31
getFileChooser().setCurrentDirectory(f);
Maybe it's the way to go for Metal too? I mean call setCurrentDirectory
unconditionally.
What do other L&Fs do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other L&F, null gets assigned to currentDirectory
and NPE doesn't occur since that previous directory check is not done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… NPE doesn't occur since that previous directory check is not done.
Then I suggest going this way and just drop the checks from Metal L&F.
The test should set Metal L&F explicitly. Or better yet, it should be run in all L&Fs to ensure NPE isn't thrown.
As for preserving the current value of currentDirectory
if the passed in folder cannot be navigated to. I think it should be done yet it's a separate issue from this one. Shall I submit a new bug? Does anyone have an opinion on this?
if ((filePath != null) && (filePath.isDirectory())) { | ||
return filePath.getAbsolutePath().startsWith(basePath); | ||
} else { | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be simplified to:
if ((filePath != null) && (filePath.isDirectory())) { | |
return filePath.getAbsolutePath().startsWith(basePath); | |
} else { | |
return false; | |
} | |
return ((filePath != null) && (filePath.isDirectory()) | |
&& filePath.getAbsolutePath().startsWith(basePath)); |
I'm not insisting though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be done, no issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
jfc = new JFileChooser(); | ||
String path = ""; | ||
if (Platform.isWindows()) { | ||
path = "C:" + File.separator + "temp"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's rare but possible that Windows is installed not on C:
drive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since temp will be better option without creating any new directory for the test, I didn't change it (it was reused from JBS report). Any other alternative......?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not request the path to the system temporary directory?
Temporary directory on Windows is not located in C:\temp
. Likely this folder does not exist. You should use TMP
or TEMP
environment variable. Alternatively, you can use createTempFile
from from java.io.File
or java.nio.Files
to create a file in the temp directory, its parent is the path to the temp directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User's home could be a better option. It's guaranteed to exist, user.home
system property points to it. And it's a more real-life scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I can just make user.home directory as the only traversable.......?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
* @test | ||
* @bug 6616245 | ||
* @key headful | ||
* @requires (os.family == "windows" | os.family == "linux") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason to exclude macOS? Is it only because the default L&F isn't Metal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, was not able to reproduce in macOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can set Metal L&F explicitly on macOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I checked it now and the issue is reproducible in macOS also, have to update the test to include macOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had thought that default L&F in macOS will be metal, didn't realize have to set it explicitly. My mistake, thank you @aivanov-jdk and @mrserb for pointing it out.
@aivanov-jdk I have updated as per the review comments. Please let me know if its fine. I have put up the mach5 test link in JBS for reference. |
@TejeshR13 Verified latest fix on ubuntu and fix is working fine. |
|
||
//Initialize the components | ||
final String INSTRUCTIONS = """ | ||
Instructions to Test: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JFileChooser extends JComponent, probably we can create a frame with embedded JFileChooser and programmatically change the value of that "Look-In ComboBox"-> and catch an exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Means in Test INSTRUCTIONS a link to Look-In
can be attached......?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or suggesting to make the test automatic......?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrserb is suggesting making the test automatic. JFileChooser
is embedded in a frame in the test. It should be possible… I'm fine with manual test though… for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, since the test has to select non traversable folders in both windows and linux I had thought that making it as manual would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably it will be good to automate it, and cover the macOS? I do not see a reason why we cannot set Metal L&F and verify the fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to reproduce the issue in macOS, so didn't include it in test...... And the fix is for metal L&F and should we explicitly set the L&F? Anyhow default L&F is metal right....?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably it will be good to automate it
I've submitted JDK-8295298: Automate javax/swing/JFileChooser/FileViewNPETest.java
… and cover the macOS? I do not see a reason why we cannot set Metal L&F and verify the fix.
Agreed.
I wasn't able to reproduce the issue in macOS, so didn't include it in test...... And the fix is for metal L&F and should we explicitly set the L&F? Anyhow default L&F is metal right....?
The default Look and Feel is Metal except for macOS where the default one is Aqua which is the system L&F. The default L&F can be changed using a property file or setting the system property.
You can always change the L&F in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok will check in macOS again then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I had not set Metal L&F while checking in macOS, the is reproducible in macOS also, and the test case has to be updated for macOS.
jfc = new JFileChooser(); | ||
String path = System.getProperty("user.home"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test does not work for me on Windows. It starts with user.home
as the current folder as expected; when select C:\
, it goes to Desktop which is the root of the Shell namespace.
I guess, you have to change it to System.getProperty("user.home") + File.separator + "Documents"
as you and I discussed. It'll make Desktop unreachable.
On Linux, the test works correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
} | ||
|
||
class CustomFileView extends FileView { | ||
private String basePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private String basePath; | |
private final String basePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
return ((filePath != null) && (filePath.isDirectory())) && | ||
filePath.getAbsolutePath().startsWith(basePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return ((filePath != null) && (filePath.isDirectory())) && | |
filePath.getAbsolutePath().startsWith(basePath); | |
return ((filePath != null) && (filePath.isDirectory())) | |
&& filePath.getAbsolutePath().startsWith(basePath); |
I prefer wrapping before the operator, it makes it clear that it's a continuation line. Java Coding Style suggests wrapping this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
|
||
//Initialize the components | ||
final String INSTRUCTIONS = """ | ||
Instructions to Test: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet you control which folders are non-traversable. Anyway… A test is better than no test; an automatic test is better than a manual one.
import javax.swing.WindowConstants; | ||
|
||
import javax.swing.filechooser.FileView; | ||
import jdk.test.lib.Platform; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not used any more, please remove.
Leave one blank line after the last import and the following comment with the jtreg tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
* @test | ||
* @bug 6616245 | ||
* @key headful | ||
* @requires (os.family == "windows" | os.family == "linux") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can set Metal L&F explicitly on macOS.
* @library /java/awt/regtesthelpers /test/lib | ||
* @build PassFailJFrame jdk.test.lib.Platform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @library /java/awt/regtesthelpers /test/lib | |
* @build PassFailJFrame jdk.test.lib.Platform | |
* @library /java/awt/regtesthelpers | |
* @build PassFailJFrame |
Platform
class from /test/lib
is not used any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In mac the issue was not reproducible.....
JFrame frame; | ||
JFileChooser jfc; | ||
|
||
//Initialize the components |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the comment is redundant. Being placed before the instruction text, it's confusing. The method name initialize
is self-explanatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Instructions to Test: | ||
1. The traversable folder set is to "user/home" Directory, | ||
other than these folder all other | ||
folders are considered as non-traversable. | ||
2. When file chooser appears on screen, select any | ||
non-traversable folder from "Look-In" ComboBox by mouse | ||
click/key press. (The folder will not be opened since its | ||
non-traversable). Select the same folder again. | ||
3. If NPE occurs on second selection then test FAILS, else test | ||
is PASS. | ||
"""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose the following text:
Instructions to Test:
1. The traversable folder is set to the Documents folder,
if it exists, in the user's home folder, otherwise
it's the user's home. Other folders are non-traversable.
2. When the file chooser appears on the screen, select any
non-traversable folder from "Look-In" combo box,
for example the user's folder or a folder above it.
(The folder will not be opened since it's non-traversable).
3. Select the Documents folder again.
4. If NullPointerException occurs in the step 3, click Fail,
otherwise click Pass.
It consistently uses “folder”, no mention of “directory”. It explains that the user's home could be the root of the traversable tree. The instructions use imperative to select either Fail or Pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4th point has been modified, since user can only select Pass, otherwise the test itself fails.
frame = new JFrame("JFileChooser File View NPE test"); | ||
passFailJFrame = new PassFailJFrame("Test Instructions", INSTRUCTIONS, 5L, 13, 40); | ||
jfc = new JFileChooser(); | ||
String path = System.getProperty("user.home") + File.separator + "Documents"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String path = System.getProperty("user.home") + File.separator + "Documents"; | |
String userHome = System.getProperty("user.home"); | |
String docs = userHome + File.separator + "Documents"; | |
String path = (new File(docs).exists()) ? docs : userHome; |
This will make the test more robust, it can continue to run even if Documents
folder does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
String path = System.getProperty("user.home") + File.separator + "Documents"; | ||
|
||
jfc.setCurrentDirectory(new File(path)); | ||
jfc.setFileView(new CustomFileView(path)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jfc.setFileView(new CustomFileView(path)); | |
jfc.setFileView(new CustomFileView(path)); | |
jfc.setControlButtonsAreShown(false); |
Hide Open and Cancel buttons in the file chooser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this 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 now.
String path = System.getProperty("user.home") + File.separator + "Documents"; | ||
String userHome = System.getProperty("user.home"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer a blank line here to logically separate dealing with paths from creating the components. But it's a nit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
@TejeshR13 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:
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 138 new commits pushed to the
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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@aivanov-jdk) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
4. If NullPointerException does not occurs in the step 3, | ||
click Pass, otherwise the Test Fails. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4. If NullPointerException does not occurs in the step 3, | |
click Pass, otherwise the Test Fails. | |
4. If NullPointerException does not occur in the step 3, | |
click Pass, otherwise the test fails automatically. |
I guess this is better and has no grammar mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
/* | ||
* @test | ||
* @bug 6616245 | ||
* @key headful |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required to have a key
tag for manual test case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required to have a
key
tag for manual test case?
A manual test is declared by its @run
tag:
* @run main/manual FileViewNPETest
If -a
(automatic tests) is passed to jtreg, this test isn't selected for running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I admit I misunderstood the question. I thought @kumarabhi006 had asked for adding another keyword to @key
to specify a manual test.
I didn't think about removing @key headful
. At the same time, a manual test implies being headful to the UI with instructions.
click Pass, otherwise the Test Fails. | ||
"""; | ||
frame = new JFrame("JFileChooser File View NPE test"); | ||
passFailJFrame = new PassFailJFrame("Test Instructions", INSTRUCTIONS, 5L, 13, 40); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few lines are going beyond 80 columns, can you please update them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few lines are going beyond 80 columns, can you please update them?
I agree, line 80 could be wrapped, it's 92 columns long. At the same, I wouldn't have insisted because it contains the parameters to PassFailJFrame
which aren't so important to understanding the logic of the test.
Line 92 with the position is better left untouched, it's not too long (five chars outside of 80-column limit) and it's cleaner unwrapped. You may statically-import PassFailJFrame.Position
in which case the line would become shorter:
PassFailJFrame.positionTestWindow(frame, Position.HORIZONTAL);
I am for keeping line 61 as it is now even though it doesn't fit the limit by 5 characters. It's still readable. In fact, this throws
clause could be avoided altogether by restructuring the code. The constructor of PassFailJFrame
is designed to be called on the main thread, yet Tejesh prefers it this way. I don't think it's worth moving the code around at this point when it's approved already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Verified the latest fix and is working fine. |
@@ -36,7 +36,6 @@ | |||
/* | |||
* @test | |||
* @bug 6616245 | |||
* @key headful |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove headful
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added again, though some manual tests have this tag and some don't better to keep it as an indication that represents as headful test......
/integrate |
@TejeshR13 |
/sponsor |
Going to push as commit 33d0618.
Your commit was automatically rebased without conflicts. |
@aivanov-jdk @TejeshR13 Pushed as commit 33d0618. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
When a custom
FileView
is used and folder traversal is restricted to a particular directory NPE occurs when user tries to traverse/select other folders except traversable folder. This is caused because when user selects folder other than traversable, the traversal is rejected and hence no file is selected ascurrentDirectory
ofJFileChooser
. When user tries to access the restricted folder second time, previous selected file check is failing because of NPE sincegetFileChooser().getCurrentDirectory();
is null. To fix the issue, NPE check is added.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10485/head:pull/10485
$ git checkout pull/10485
Update a local copy of the PR:
$ git checkout pull/10485
$ git pull https://git.openjdk.org/jdk pull/10485/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10485
View PR using the GUI difftool:
$ git pr show -t 10485
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10485.diff