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 37669

Summary: new files from templates doesn't preserve line endings
Product: java Reporter: maartenc <maartenc>
Component: UnsupportedAssignee: Daniel Prusa <dprusa>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: dkonecny, rmatous
Priority: P3    
Version: 3.x   
Hardware: PC   
OS: Windows ME/2000   
Issue Type: DEFECT Exception Reporter:
Attachments: a sample template file

Description maartenc 2003-12-02 13:56:51 UTC
I have several templates which use windows line
endings. However, if I create new files using
these templates, these files are saved using the
unix line endings.

When I was using Netbeans 3.5, the line endings of
my templates were preserved correctly.

I'm using:
- Netbeans Q-buid (Build 200311251900)
- JDK 1.4.2_02
- Windows XP
Comment 1 Miloslav Metelka 2004-01-23 16:53:42 UTC
The actual template instantiation should be done in openide/loaders.
Reassinging to openide for evaluation.
Comment 2 rmatous 2004-01-28 15:49:45 UTC
The behaviour depends on implementation of
DataObject.createFromTemplate that can be overloaded for individual
DataObjects. 

Impl. in FileEntry [snipped] :
  while ((current = r.readLine ()) != null) {
     w.write (frm.format (current));
     // Cf. #7061.
     w.newLine ();
  }

seems to be OK.


Now is important to know wich templates do you use. 
Comment 3 rmatous 2004-01-28 15:51:10 UTC
Once again with question mark. Wich templates do you use ?
Comment 4 rmatous 2004-02-03 10:19:46 UTC
No response. Anyway looks like java problem and its
IndentFileEntry.createFromTemplate. Please investigate. 
Comment 5 maartenc 2004-02-12 11:57:29 UTC
Sorry I didn't react, but I thought I would receive mails as soon as
someone add extra comments on this issue. But I didn't receive any ...
strange ... I did receive such notification mails in the past.

I'll upload one of the templates I'm using

btw, the problem is still present with this system:
- Netbeans build 200402101900
- JDK 1.5.0 beta  (build 1.5.0-beta-b31)

Maarten
Comment 6 maartenc 2004-02-12 11:58:53 UTC
Created attachment 13385 [details]
a sample template file
Comment 7 Martin Matula 2004-11-08 16:55:31 UTC
Dane, could you please try to reproduce this on Windows?
Comment 8 Daniel Prusa 2004-11-11 15:56:39 UTC
I can confirm that this is reproducible on Windows.
Comment 9 Daniel Prusa 2004-11-11 16:10:16 UTC
I can confirm that this is reproducible on Windows.
Comment 10 Jiri Prox 2005-08-16 16:21:01 UTC
It is still reproducible
Win XP
NB 4.2 dev build 20050816
JDK 1.5.0_04

BTW I found out that the template is in the userdir stored correctly with win
line-endings. 
Comment 11 Tomas Hurka 2005-08-19 14:58:11 UTC

*** This issue has been marked as a duplicate of 58236 ***