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.
Summary: | Saving a file changes its line separator | ||
---|---|---|---|
Product: | editor | Reporter: | terje7601 |
Component: | Actions/Menu/Toolbar | Assignee: | Miloslav Metelka <mmetelka> |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 8.2 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | example file for which this bug occurred |
Description
terje7601
2016-07-11 08:45:26 UTC
NB editor scans a newline of the first line of the file to determine the line separator and then uses it for all lines when saving the file. Could you attach the problematic file or double-check that there's a Unix EOL on the first line too? What's extension of the file is it .java or anything else? Thanks. The file was a .java file. I noticed git diff showed the whole file as modified, so I changed back to Unix EOL using Notepad++. Notepad++ always changes all EOLs - even if the file contains mixed EOLs - so I'm sure every line had the correct Unix EOL. However, NetBeans kept saving with Windows EOLs. Only after stopping, clearing NetBeans' cache and starting again, did it work correctly. When the NB editor reads from a file, does it always read from the actual file on disk? Or is it possible that it reads from a cached version in memory or NetBeans' cache? I just had this occur again: an .sql file with nothing but Unix EOLs, no \r character at all in the file. In attachment is the .sql file. However, as explained in the initial report, the file itself doesn't cause the issue: after restarting NetBeans, it works as expected with the exact same file and the EOLs aren't changed (note that I didn't clear the Cache directory this time). PS: related to this, I filed bug 267397, so that I could at least detect this bug with the Diff view Product Version: NetBeans IDE Dev (Build 201607110002) Updates: Updates available Java: 1.8.0_91; Java HotSpot(TM) 64-Bit Server VM 25.91-b15 Runtime: Java(TM) SE Runtime Environment 1.8.0_91-b15 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb) Created attachment 161529 [details]
example file for which this bug occurred
|