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 45373 - Mixed CRNL and NL in project XML files on Windows
Summary: Mixed CRNL and NL in project XML files on Windows
Status: CLOSED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P4 blocker (vote)
Assignee: David Konecny
URL:
Keywords:
: 48938 (view as bug list)
Depends on:
Blocks: 41535
  Show dependency tree
 
Reported: 2004-06-22 16:16 UTC by Jesse Glick
Modified: 2006-03-24 10:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2004-06-22 16:16:10 UTC
Seems like for Windows users, project.xml is NL
format and build.xml/build-impl.xml are mostly
CRNL with block comments being NL format. Strange
and liable to confuse a VCS. May depend on the
newline gender of the machine that made the build,
so check against an official dev build made on
Solaris.
Comment 1 David Konecny 2004-09-13 15:31:57 UTC
*** Issue 48938 has been marked as a duplicate of this issue. ***
Comment 2 Milan Kubec 2004-09-17 09:53:19 UTC
It seems to be more general issue of XML files - see
${userdir}/config/Services/*.settings files.
Comment 3 David Konecny 2004-09-17 10:13:48 UTC
The project.xml case was fixed in:

Checking in src/org/openide/xml/XMLUtilImpl.java
new revision: 1.13; previous revision: 1.12
Comment 4 David Konecny 2004-09-17 10:36:23 UTC
As for the build.xml and build-impl.xml generation I'm close to giving
this up.

It is job of serializer to produce correct EOL character. Looking at
source code of com.sun.org.apache.xml.internal.serializer.ToStream
which is serializer used on JDK1.5 (on JDK1.4.2 it is different class)
and grepping usage of "m_lineSep" it looks that it is aware of line
ending issue, but then if you look at method comment() it simply
writes whatever it gets. Bug?

On JDK1.4.2 when <xsl:comment> contains some other xsl tag (that's
what build.xsl does) the line ending is correct! But I guess it is bug
which was fixed in JDK1.5 because line endings are always consistenly
wrong for comments on Windows on JDK1.5.

The possible workaround is:

1.) wrap each line of comment in <xsl:comment></xsl:comment>. We
wanted to moved most of the comments to user documentation anyway, so
this seems the easiest to do.

2.) After getting result byte stream in
GeneratedFilesHelper.generateBuildScriptFromStylesheet simply fix all
the line endings according to platform.

Re. "settings files" - I need to look at it yet.
Comment 5 David Konecny 2004-09-17 10:58:27 UTC
Re. "settings files" - no, it is different bug directly in
core/settings module. I will fix that too.
Comment 6 David Konecny 2004-09-17 11:36:37 UTC
.setting files problems fixed in:
src/org/netbeans/modules/settings/convertors/XMLPropertiesConvertor.java;
new revision: 1.8; previous revision: 1.7
src/org/netbeans/modules/settings/convertors/XMLSettingsSupport.java;
new revision: 1.25; previous revision: 1.24
Comment 7 Jesse Glick 2004-09-17 15:47:22 UTC
Suggest workaround #2 for project.xml, together with filing a JDK bug
(JAXP component I guess). But only where we are using proper JAXP APIs
(i.e. XSLT output to stream); not XMLUtil, where we just use
reflection to find the serializer.
Comment 8 David Konecny 2004-09-23 14:19:01 UTC
Fixed, but JDK issue needs to be filed.

src/org/netbeans/spi/project/support/ant/GeneratedFilesHelper.java;
new revision: 1.8; previous revision: 1.7
test/unit/src/org/netbeans/spi/project/support/ant/GeneratedFilesHelperTest.java;
new revision: 1.5; previous revision: 1.4
test/unit/src/org/netbeans/spi/project/support/ant/data/build.xsl;
new revision: 1.4; previous revision: 1.3
Comment 9 David Konecny 2004-11-01 10:12:21 UTC
Filed as JDK bug
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6185184>
Comment 10 Marian Mirilovic 2005-12-20 15:46:21 UTC
This issue was solved long time ago. Because nobody has reopened it neither
added comments, we are verifying/closing it now. 
If you are still able to reproduce the problem, please reopen. Thanks in advance.