Bug 31902 - <genlist> broken w/ xerces.jar from Ant 1.5.2
<genlist> broken w/ xerces.jar from Ant 1.5.2
Status: RESOLVED FIXED
Product: www
Classification: Unclassified
Component: Builds & Repositories
3.x
PC Linux
: P1 (vote)
: 3.x
Assigned To: Jesse Glick
nbbuild-issues@ide
:
Depends on:
Blocks: 29331
  Show dependency treegraph
 
Reported: 2003-03-11 16:46 UTC by Jesse Glick
Modified: 2003-04-24 19:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo