Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Bug in Builder.canonicalizeURL

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Adam Constabaris <adam.constabaris AT gmail.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Bug in Builder.canonicalizeURL
  • Date: Fri, 18 Jun 2010 14:36:48 -0400

Hello,

It would appear there is a rather nasty bug in XOM 1.2.5's Builder
class, in that it will duplicate the query string on URIs that contain
'em when canonicalizeURL is called, viz. the result of passing

http://www.example.com/?id=1

to canonicalizeURL (which is called by Builder.build(String)) yields
up the "canonical"

http://www.example.com/?id=1?id=1

The culprit appears to be the use of URL.getFile() to get the "path"
portion of the systemId -- on JDK 1.6, this value *includes* the query
string, which is later appended.

Diff against Builder.java from 1.2.5 distribution is attached; if
it's stripped by the list software, the fix that worked on my test
cases was 1110 (String path = u.getPath() ) and 1121 add check for
null query before appending "/" to path.

cheers,

AC



Archive powered by MHonArc 2.6.24.

Top of Page