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 121301

Summary: When you rename a template, the template is lost
Product: platform Reporter: Petr Pisl <ppisl>
Component: Data SystemsAssignee: Jaroslav Tulach <jtulach>
Status: VERIFIED FIXED    
Severity: blocker CC: anebuzelsky, juhrik, mmirilovic, rmatous
Priority: P1 Keywords: REGRESSION
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Petr Pisl 2007-11-06 15:30:33 UTC
- Create an application. In my case web application. 
- In the index.jsp add some text and then invoke action Save as Template. Place the template to a category.
- Go to Tools -> Templates and find your new template in the Template Manager.
- Rename it and close the Template Manager
- Go to new file dialog and try to find your template. The template is not there. If you open the Template Manager, the
template is not there anymore either.
Comment 1 Jiri Rechtacek 2007-11-06 16:59:09 UTC
It's a regression on NB5.5.1 but if an user don't rename the template then s/he can use it w/o problems. Maybe the
priority should be reconsider.
Comment 2 Jaroslav Tulach 2007-11-06 21:21:00 UTC
Jirka is right, there is no reason for this problem to be P1.
Comment 3 Petr Pisl 2007-11-06 21:40:29 UTC
I think this is P1. It's data lost. I lost my template, which is not very nice.  What else should be P1? At least
disable the Rename action in the Template manager. 

- What i did is that I create a new jsp page. 
- Modified the page to have this page as template
- I saved this page as template and deleted the original page. I didn't need it in my project. 
- Then I renamed the template in the Template Manager -> my work was lost. 
Comment 4 Jaroslav Tulach 2007-11-07 08:30:44 UTC
It is not data loss. The data are untouched on your disk.
Comment 5 Jaroslav Tulach 2007-11-07 08:33:13 UTC
The problem is that after rename of the template, the .nbattrs in the template directory contain old entry:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE attributes PUBLIC "-//NetBeans//DTD DefaultAttributes 
1.0//EN" "http://www.netbeans.org/dtds/attributes-1_0.dtd">
<attributes version="1.0">
    <fileobject name="pokus.jsp">
        <attr name="Content-Encoding" stringvalue="UTF-8"/>
        <attr name="template" boolvalue="true"/>
    </fileobject>
</attributes>


I think I want to pass it to filesystems...
Comment 6 rmatous 2007-11-07 10:41:29 UTC
Trivial fix:
/cvs/core/startup/src/org/netbeans/core/startup/layers/LocalFileSystemEx.java,v  <--  LocalFileSystemEx.java
new revision: 1.9; previous revision: 1.8
Comment 7 rmatous 2007-11-07 10:44:20 UTC
REGRESSION caused by - #79722 "extend file system to allow deleting writable instances of files from xml layers"

I think, its candidate for fixing in 6.0.
Comment 8 Stanislav Aubrecht 2007-11-07 11:09:24 UTC
reviewed, the patch is ok
Comment 9 Jaromir Uhrik 2007-11-07 13:49:07 UTC
I have verified in the latest hudson build. It works as expected now. I agree with the integration to the 6.0.
Comment 10 rmatous 2007-11-08 10:47:59 UTC
Fixed in 6.0:
/cvs/core/startup/src/org/netbeans/core/startup/layers/LocalFileSystemEx.java,v  <--  LocalFileSystemEx.java
new revision: 1.8.6.1; previous revision: 1.8
Comment 11 Jaromir Uhrik 2007-11-09 09:33:52 UTC
Verified in the following build from RC1-branch:
Product Version: NetBeans IDE 6.0 RC1 (Build 200711090000)
Java: 1.5.0_07; Java HotSpot(TM) Client VM 1.5.0_07-87
System: Mac OS X version 10.4.10 running on i386; MacRoman; en_US (nb)