ASF Bugzilla – Attachment 36899 Details for
Bug 63945
NPE when opening a file after file system change
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Use a more consistent logic to choose initial dir for FileChooser
filechooser.patch (text/plain), 2.18 KB, created by
Felix Schumacher
on 2019-11-24 10:24:53 UTC
(
hide
)
Description:
Use a more consistent logic to choose initial dir for FileChooser
Filename:
MIME Type:
Creator:
Felix Schumacher
Created:
2019-11-24 10:24:53 UTC
Size:
2.18 KB
patch
obsolete
>diff --git a/src/core/src/main/java/org/apache/jmeter/gui/util/FileDialoger.java b/src/core/src/main/java/org/apache/jmeter/gui/util/FileDialoger.java >index 23c795e..a8ad63e 100644 >--- a/src/core/src/main/java/org/apache/jmeter/gui/util/FileDialoger.java >+++ b/src/core/src/main/java/org/apache/jmeter/gui/util/FileDialoger.java >@@ -180,18 +180,16 @@ > } else { > jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); > } >- if(!StringUtils.isEmpty(existingFileName)) { >- File existingFileStart = new File(existingFileName); >- if(existingFileStart.exists() && existingFileStart.canRead()) { >- jfc.setCurrentDirectory(new File(existingFileName)); >- } >- } >- else if (lastJFCDirectory == null) { >+ if (!StringUtils.isEmpty(existingFileName)) { >+ setCurrentDirOnJFC(existingFileName); >+ } else if (lastJFCDirectory == null) { > String start = System.getProperty("user.dir", ""); //$NON-NLS-1$//$NON-NLS-2$ > > if (start.length() > 0) { >- jfc.setCurrentDirectory(new File(start)); >+ setCurrentDirOnJFC(start); > } >+ } else { >+ setCurrentDirOnJFC(lastJFCDirectory); > } > clearFileFilters(); > if(exts != null && exts.length > 0) { >@@ -200,10 +198,6 @@ > jfc.setAcceptAllFileFilterUsed(true); > jfc.setFileFilter(currentFilter); > } >- if(lastJFCDirectory==null) { >- lastJFCDirectory = System.getProperty("user.dir", ""); //$NON-NLS-1$//$NON-NLS-2$ >- } >- jfc.setCurrentDirectory(new File(lastJFCDirectory)); > int retVal = jfc.showOpenDialog(parentComponent); > lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath(); > >@@ -213,6 +207,13 @@ > return null; > } > >+ private static void setCurrentDirOnJFC(String currentDirName) { >+ File currentDir = new File(currentDirName); >+ if (currentDir.exists() && currentDir.canRead()) { >+ jfc.setCurrentDirectory(currentDir); >+ } >+ } >+ > private static void clearFileFilters() { > FileFilter[] filters = jfc.getChoosableFileFilters(); > for (FileFilter filter : filters) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 63945
:
36899
|
36900