This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 40286

Summary: File property Editor does not store values to property
Product: platform Reporter: Ondrej Rypacek <rypacek>
Component: Property EditorsAssignee: Jiri Rechtacek <jrechtacek>
Status: RESOLVED WONTFIX    
Severity: blocker    
Priority: P4    
Version: 3.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Ondrej Rypacek 2004-02-19 16:52:40 UTC
The custom property editor for File properties -
file chooser dialog - does not support for
selecting non-existent filename. The file selected
in the editor is stored to the property only when
an existing file is selected, not when a new
filename is typed in.

Steps to reproduce: create a jarRecipe, select its
Jar Target property, click (...) to bring up the
file chooser, select some other directory, where
the target jar file should be put, click o.k. =>
the property value was not updated
Comment 1 David Simonek 2004-02-19 17:59:39 UTC
Property editors?
Comment 2 _ tboudreau 2004-02-20 12:52:36 UTC
I just tested this with a very simple bean with one property of type File.  Create such a 
bean, and add logging when the File property is set.  Run Customize Bean.  Use the 
custom editor to enter a non-existent file and click OK.  The file is updated correctly.

Then I tested this with the Location property of a new Jar Recipe.  It also works correctly.  I 
don't know what the Jar Target property is, the jar recipe I created did not have a property 
with that name.

Anyway, the custom editor for File supports nonexistent files with no problem.  Maybe you 
are passing a file filter as a hint or something, which blocks use of nonexistent filenames?
Comment 3 Marian Mirilovic 2004-02-29 09:41:15 UTC
verified
Comment 4 Ondrej Rypacek 2004-04-06 14:40:08 UTC
Just got another bug report for this and reproduced it easilly. I
don't know what is verified but it does not work and jarpackager is
not using in any special way and , as also mentioned in the duplicate,
it appears for other properties not in jarpackager. 

Reopening.
Comment 5 Ondrej Rypacek 2004-04-06 14:40:12 UTC
*** Issue 41080 has been marked as a duplicate of this issue. ***
Comment 6 _ ttran 2004-04-06 17:24:43 UTC
not a showstopper for 3.6 -> promo-d
Comment 7 _ tboudreau 2004-04-17 19:22:45 UTC
Given that jar packager is dead, what is the priority of this?  I could reasonably see this as 
an enhancement that a property could provide a hint that the chooser should allow non-
existent files.  Status?
Comment 8 Ondrej Rypacek 2004-04-19 08:29:46 UTC
Given that jar-packager is dead, I don't mind if you can close it as
wontfix. 
Comment 9 _ tboudreau 2004-04-19 13:37:21 UTC
Ondrej, I'd rather make sure there's no bug here.  Can you provide *exact* steps to 
reproduce when customizing a simple bean, ala.

public class Foo {
  private File file = new File("/tmp/foo");
  public File getFile() {
    return file;
  }
  public void setFile (File f) {
    this.file = f;
  }
}

As I mentioned, I had no problem making this work whatsoever - so I will assume that 
something was wrong in JarPackager;  also I still don't know what the jar target property is.
Comment 10 Ondrej Rypacek 2004-04-19 14:38:22 UTC
1. create new java class
2. paste the code for Foo, add import for java.io.File , compile
3. Right-click - "Customize bean"
4. Click ... to bring up the property editor 

Bug1: 
5a. click "<--" (for parent folder) , ok ---> ! no change saved

Bug2: 
5b. navigate to some folder
6b. skip to "File Name" text field and fill in "foo.jar", OK --> ! the
new value is just the folder, the filename "foo.jar" was stripped off


In jar-pacakger, the "Location" property (that's my "jar target" as
you have correctly guessed, sorry for the confusion, it's called "jar
target" in the code) is just a plain ReadWrite property of type
"java.io.File". It has the following two properties set (see
jarpackager/src/org/netbeans/modules/jarpackager/JarDataObject.java,
line 708):

 p.setValue("files", Boolean.TRUE); 
 p.setValue("directories", Boolean.FALSE); 

The property editor behaves somewhat differently in that the name of
the jar file remains filled in the "File Name" text field while
browsing the filesystem by dbl-clicking folders. In the testing bean,
the filename is overwritten when a folder is clicked with the folder
name. In jar-packager, when you click OK , nothing is saved unless a
file was selected by dbl-click. If it was typed by hand, nothing is
saved. In the testing bean, a filename typed by hand is stripped off. 

Anyway, you can just stop by and I'll show you. 


Comment 11 _ tboudreau 2004-04-19 14:53:07 UTC
Passing property editor issues to new owner, Jirka
Comment 12 Jiri Rechtacek 2004-06-29 14:31:22 UTC
There is the workaround and almost all clients of this chooser are
dead, the issue's relevance is marked lower => I decrease the priority
to P4.
Comment 13 Marian Mirilovic 2004-12-23 09:45:23 UTC
I guess this won't be fixed for NB4.0 , please evaluate again.

Comment 14 Jiri Rechtacek 2006-11-23 14:50:24 UTC
Per Ondrej's agreement it's closed as WONTFIX.