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 227906 - Export Options: Some settings not checked get exported too
Summary: Export Options: Some settings not checked get exported too
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Options&Settings (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-25 14:12 UTC by MackSix
Modified: 2013-07-08 05:25 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot A (55.63 KB, image/png)
2013-05-07 14:28 UTC, MackSix
Details
Screenshot B (32.04 KB, image/png)
2013-05-07 14:29 UTC, MackSix
Details
proposed fix (3.58 KB, patch)
2013-05-29 14:59 UTC, Theofanis Oikonomou
Details | Diff
options.editor diff. (1.94 KB, patch)
2013-05-30 10:45 UTC, Jiri Skrivanek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2013-03-25 14:12:03 UTC
When Exporting Options, if single category is checked, other categories may be exported.

For example if I export only Formatting, Editor:General is exported too.

Another example is if I export PHP, General:All other unspecified is exported too.

Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Theofanis Oikonomou 2013-05-07 12:59:19 UTC
What do you mean by "exported too"? Do you see the respective checkboxes checked in the export dialog?
Comment 2 MackSix 2013-05-07 14:27:57 UTC
See screenshot A. I have PHP Checked, it is the only thing I checked and nothing else is checked, except "All" which is another bug [1], it should not check when I check PHP.

See screenshot B. I go to import the settings and it shows that "General:All other unspecified" was exported to the file too, although  never checked it.

[1] https://netbeans.org/bugzilla/show_bug.cgi?id=227903
Comment 3 MackSix 2013-05-07 14:28:38 UTC
Created attachment 134192 [details]
Screenshot A
Comment 4 MackSix 2013-05-07 14:29:01 UTC
Created attachment 134193 [details]
Screenshot B
Comment 5 Theofanis Oikonomou 2013-05-29 14:59:55 UTC
Created attachment 135079 [details]
proposed fix

I think this is caused by false positive. A problem with the include regular expressions. Could you check that in the created zip after exporting the options only the desired files are present? This is happening for me at least. I am attaching a fix that fixes the issue. Jiri, as I am not 100% sure what you meant to include or not, could you comment on the proposed changes in the regular expressions?
Comment 6 Jiri Skrivanek 2013-05-30 08:15:52 UTC
"General:All other unspecified" is meant to include all from config/Preferences which were not specified elsewhere. It is for the case when you want to export everything (like after installation of new IDE version). Your patch breaks that assumption and I don't recommend it.
On the other hand I must admit that current state is not ideal and there is no straightforward solution for this bug. I think we have to write a notice to exported zip file (build.info or some empty flag file) that "All other unspecified" was not selected for export and then while importing set the status of the "All other unspecified" item according to that flag.
Comment 7 Theofanis Oikonomou 2013-05-30 09:09:47 UTC
(In reply to comment #6)
> "General:All other unspecified" is meant to include all from config/Preferences
> which were not specified elsewhere. It is for the case when you want to export
> everything (like after installation of new IDE version). Your patch breaks that
> assumption and I don't recommend it.

Thank you for making this clear

> On the other hand I must admit that current state is not ideal and there is no
> straightforward solution for this bug. I think we have to write a notice to
> exported zip file (build.info or some empty flag file) that "All other
> unspecified" was not selected for export and then while importing set the
> status of the "All other unspecified" item according to that flag.

This could work for the "General:All other unspecified" case. What would you propose for the "Editor:General" case from comment 1? Or the part of the patch for the latter case is accepted?

Thank you
Comment 8 Jiri Skrivanek 2013-05-30 10:43:22 UTC
> This could work for the "General:All other unspecified" case. What would you
> propose for the "Editor:General" case from comment 1? Or the part of the patch
> for the latter case is accepted?

No, I think it is similar case. But it is question whether fix of bug 143494 is correct. It introduces "Formatting|Indentation" and "Formatting|Java" but ignores formatting settings of other languages. Also it is question whether org-netbeans-modules-editor-settings-CustomPreferences.xml contains only formatting/indentation properties. If yes, then better seems to me to export formatting settings together for all languages. Just to collect .*CustomPreferences.xml.

             <file name="Other">
                 <attr name="include" stringvalue="config/Editors/(?!.*(Macros|CodeTemplates|FontsColors)).+|config/.nbattrs"/>
-                <attr name="exclude" stringvalue="config/Editors/.*/(macros.xml|Popup.*|Settings\.settings|.*\.instance)"/>
+                <attr name="exclude" stringvalue="config/Editors/.*/(macros.xml|Popup.*|Settings\.settings|.*\.instance|org-netbeans-modules-editor-settings-CustomPreferences.xml)"/>
                 <attr name="displayName" bundlevalue="org.netbeans.modules.options.editor.Bundle#Editor.Options.Export.Other.displayName"/>
             </file>
-        </folder>
-        <folder name="Formatting">
-                <attr name="position" intvalue="250"/>
+            <file name="Formatting">
+                <attr name="include" stringvalue="config/Editors/.*/org-netbeans-modules-editor-settings-CustomPreferences.xml"/>
                 <attr name="displayName" bundlevalue="org.netbeans.modules.options.editor.Bundle#Editor.Options.Export.Formatting.displayName"/>
-                <file name="Indentation">
-                    <attr name="include" stringvalue="config/Editors/Preferences/org-netbeans-modules-editor-settings-CustomPreferences.xml"/>
-                    <attr name="displayName" bundlevalue="org.netbeans.modules.options.editor.Bundle#Editor.Options.Export.Indentation.displayName"/>
                 </file>
         </folder>
         <folder name="FontsAndColors">
Comment 9 Jiri Skrivanek 2013-05-30 10:45:35 UTC
Created attachment 135121 [details]
options.editor diff.
Comment 10 Milutin Kristofic 2013-05-30 15:23:09 UTC
CustomPreferences.xml has many information - old folding, code templates, bracematching, breadcrumbs, search-type, etc. Infrastructure for import/export can restrict files, not a value in files.
Comment 11 Theofanis Oikonomou 2013-05-30 15:30:20 UTC
(In reply to comment #10)
> Infrastructure for import/export
> can restrict files, not a value in files.

This is not true. you can include/exclude key-value pairs inside a properties file. have a look in etc/netbeans.import file for examples, e.g.

exclude build[.]properties#nbplatform[.]default[.]netbeans[.]dest[.]dir
but
include build[.]properties#nbplatform[.].+[.].+|var[.].*
Comment 12 Milutin Kristofic 2013-05-30 15:32:17 UTC
Oh, thanks, I honestly didn't know. Then this should be clean up in each module.
Comment 13 Jiri Skrivanek 2013-05-31 06:30:02 UTC
(In reply to comment #11)
> This is not true. you can include/exclude key-value pairs inside a properties
> file. have a look in etc/netbeans.import file for examples, e.g.

Yes, but it is not applicable to xml files like CustomPreferences.xml.
Comment 14 Theofanis Oikonomou 2013-06-18 09:50:45 UTC
(In reply to comment #13)
> (In reply to comment #11)
> > This is not true. you can include/exclude key-value pairs inside a properties
> > file. have a look in etc/netbeans.import file for examples, e.g.
> 
> Yes, but it is not applicable to xml files like CustomPreferences.xml.

true. sorry for that. I will go ahead and follow your suggestion from comment 6 at least for these two cases. Thank you for the input.
Comment 15 Theofanis Oikonomou 2013-06-19 15:50:27 UTC
Fixed: http://hg.netbeans.org/core-main/rev/0b7d46a1f732
Comment 16 Quality Engineering 2013-06-22 02:07:03 UTC
Integrated into 'main-golden', will be available in build *201306212301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/0b7d46a1f732
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: #227906 - Export Options: Some settings not checked get exported too
Comment 17 MackSix 2013-07-08 05:25:40 UTC
Verified Fixed in:

Product Version: NetBeans IDE 7.3.1 (Build 201306052037)
Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b16
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)