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 159642 - Profiler saves nbproject/private/profiler/configurations.xml into autoproject
Summary: Profiler saves nbproject/private/profiler/configurations.xml into autoproject
Status: RESOLVED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
: 147929 (view as bug list)
Depends on: 168414
Blocks:
  Show dependency tree
 
Reported: 2009-03-04 23:14 UTC by Jesse Glick
Modified: 2009-09-15 03:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed patch (6.53 KB, patch)
2009-07-14 01:52 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2009-03-04 23:14:19 UTC
I just found that if I run the Profiler on an autoproject, it creates a nbproject/private/profiler/configurations.xml
file, polluting the project directory. Do _not_ assume that there is an nbproject/ subdir of a project or that you are
permitted to create one. Use ProjectUtils.getPreferences if you need to associate some module-specific metadata with a
project.
Comment 1 Jiri Sedlacek 2009-06-08 12:18:56 UTC
Not for 6.7.
Comment 2 Jesse Glick 2009-06-12 01:44:28 UTC
The Profiler is violating a basic project system design principle and it results in a major bug for autoprojects. If you
don't have time to fix it, can I?
Comment 3 Jiri Sedlacek 2009-06-12 08:54:52 UTC
We know about the problem, we were going to fix it as a part of profiler/IDE integration rewrite for 6.8. Unfortunately
it looks like it's not a priority now...

Feel free to fix it yourself, but please provide a patch here before integrating it - we'll review and test it. Thanks.
Comment 4 Jesse Glick 2009-06-12 15:45:26 UTC
Things that need to be fixed (all apparently in main profiler module):

1. IDEUtils.getProjectSettingsFolder needs to be rewritten:

1a. Name should change to indicate that it may be used for storing snapshots and the like but should not be used for
settings.

1b. Should use CacheDirectoryProvider going forward.

1c. For compatibility it can return nbproject/private/profiler/ if this dir already exists, but should no longer create it.

1d. Return value needs to be considered. In some places it is written to return null now. Callers are not expecting
null. Probably should be changed to always throw IOException if it cannot provide a folder.

1e. getProjectFromSettingsFolder also needs to be rewritten accordingly.

2. ProfilerSettingsManager, ProfilingPointFactory, and NetBeansProfiler should:

2a. Use ProjectUtils.getPreferences going forward for keeping settings, not IDEUtils.getProjectSettingsFolder (or
whatever its new name is).

2b. For compatibility, may read from nbproject/private/profiler/*.xml when the appropriate file already exists, but
should then delete that file and store the settings using Preferences.

Let me know if you object, else I will try to prepare a patch that does the above.
Comment 5 Jesse Glick 2009-07-14 01:45:15 UTC
Part 2 is looking like too much work, and probably something module owners should do. (OQL queries also apparently have
their own XML properties storage which ought to be rewritten to NbPreferences.) Instead I will just prepare 1b/1c. (To
1d, it seems that return value is intended to be non-null if create is set.)
Comment 6 Jesse Glick 2009-07-14 01:52:08 UTC
Created attachment 84680 [details]
Proposed patch
Comment 7 Jesse Glick 2009-07-21 20:58:26 UTC
core-main #8df200ec0fdb
Comment 8 Jesse Glick 2009-09-15 03:38:56 UTC
*** Issue 147929 has been marked as a duplicate of this issue. ***