Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-4808

Shared project libraries can get clobbered after being renamed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 8.2
    • None
    • projects - Libraries
    • Windows 10 with JDK8 (64bit)

    Description

      I have found a reliable way to completely lose a Library defined as a project/shared library (does not affect global libraries).  Steps to reproduce:

      1. Have a project open which defines a Library location
      2. Go to Tools->Libraries
      3. Choose that project's Library location in the drop-down at the top of the dialog
      4. Create a New Library with the name:  test
      5. Add some JAR/Folders as you see fit
      6. Hit OK
      7. Repeat steps 2 & 3
      8. Click the test library, verify Classpath contents
      9. Change the Library Name to:  modified
      10. Hit OK
      11. Repeat steps 2 & 3
      12. Click the modified library, verify Classpath contents
      13. Create a New Library with the name:  test
      14. Hit OK
      15. Repeat steps 2 & 3
      16. Notice that modified is gone

       

      This all happens because the internal identifier given to the library in the properties file is its initial Libray Name.  When the Libray Name is modified, the internal identifier stays the same.  When creating a new library an "already exists" check only compares against the Library Name, not the identifier used in the property keys.

      Either the "exists" check needs to compare with the identifiers, or the old identifier itself should be updated along with the name.  The latter would let re-use a name that was once used but no longer is – e.g. "MyLib - Latest" after renaming the old Latest one to "MyLib - Previous".  But since there are other things (e.g. project.properties) referencing this identifier that would probably not work.

      I guess a totally random identifier could be used (UUID style), but that isn't something that seems to be commonly done in Netbeans.

       

      I have only run across this using Netbeans 8.2, haven't tried it in newer versions.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              djohle David Johle
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: