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 31902

Summary: <genlist> broken w/ xerces.jar from Ant 1.5.2
Product: www Reporter: Jesse Glick <jglick>
Component: Builds & RepositoriesAssignee: Jesse Glick <jglick>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P1    
Version: 3.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 29331    

Description Jesse Glick 2003-03-11 16:46:22 UTC
If you try to use <genlist> using the Ant 1.5.2
distribution (i.e. using Xerces 2.3.0 which is
shipped with it, as opposed to 2.2.0 shipped with
1.5.1) you get an error:

UnsupportedEncodingException: UTF8

At least w/ JDK 1.4.1_01 on Linux.

In fact this *is* a bogus encoding; should be "UTF-8".

There are two serious bugs in UpdateTracking.write():

1. It should not use an OutputStreamWriter! With
rare exceptions, XML documents should always be
read from InputStream's and written to
OutputStream's. Using Reader and Writer is
generally wrong because the document itself
specifies its encoding, and the reader/writer can
at best not get it wrong.

Suggest that the FileOutputStream be used
directly, and that the code in XMLUtil to support
Writer be deleted.

2. UpdateTracking.write() catches Exception,
prints a stack trace, and returns normally. This
is terrible error handling. In fact if you use Ant
1.5.2, the stack traces are printed, but the build
continues - with an empty (and thus corrupt)
update_tracking/*.xml file. The catch block should
first try to delete trackingFile, then throw a
BuildException.

While you're at it, please fix the incorrect line
endings in XMLUtil.java - it has CRNL endings on a
Unix checkout from CVS, which means someone took a
file from a Windows machine, copied it to a Unix
machine without doing the correct CRNL -> NL
conversion, and checked it in.

Since this bug prevents use of Ant 1.5.2 I
consider it very high priority. If you will not
fix it in the next couple of days, assign to me
and I will. It should be merged to 3.5 as well.
Comment 1 Jesse Glick 2003-03-11 17:17:10 UTC
Actually I already have a patch that seems to work.
Comment 2 Jesse Glick 2003-03-11 18:58:07 UTC
committed   * Up-To-Date  1.17       
nbbuild/antsrc/org/netbeans/nbbuild/UpdateTracking.java
committed   * Up-To-Date  1.10       
nbbuild/antsrc/org/netbeans/nbbuild/XMLUtil.java

Comment 3 Jesse Glick 2003-03-11 19:45:08 UTC
Also XMLUtil.java 1.12 for Crimson.
Comment 4 Jesse Glick 2003-03-11 21:03:56 UTC
Merged.

committed   * Up-To-Date  1.16.2.1   
nbbuild/antsrc/org/netbeans/nbbuild/UpdateTracking.java
committed   * Up-To-Date  1.9.2.1    
nbbuild/antsrc/org/netbeans/nbbuild/XMLUtil.java
Comment 5 Jesse Glick 2003-04-24 19:45:47 UTC
Also cleaning up a couple other places where DOM -> Writer was coded
(but unused), in the trunk for 4.0:

committed   * Up-To-Date  1.6        
openide/src/org/openide/xml/XMLUtilImpl.java
committed   * Up-To-Date  1.6        
autoupdate/libsrc/org/netbeans/updater/XMLUtil.java