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 165735 - More robust handling of invalid URLs returned from XML API
Summary: More robust handling of invalid URLs returned from XML API
Status: RESOLVED FIXED
Alias: None
Product: connecteddeveloper
Classification: Unclassified
Component: Hudson (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks: 165067
  Show dependency tree
 
Reported: 2009-05-21 17:30 UTC by Jesse Glick
Modified: 2009-05-23 06:59 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2009-05-21 17:30:58 UTC
Sometimes $root/xml/api produces absolute URLs (e.g. for jobs) that look quite different from $root itself; sometimes
these URLs do not work at all. The URL base can be configured for the Mailer task, otherwise defaulting to what the
servlet container claims. (A recent Hudson release fixed a bug in the priority here.) If the admin did not configure a
base URL for Mailer, the container may well have it wrong; even if they did, the URL might be incorrect (or out of date)
- it is quite possible that no one would notice if they had hitherto just been using the web UI.

Currently the IDE assumes that the XML API URLs are valid and accepts them uncritically, which has led to a number of
bug reports that had to be solved on the user side. Options include:

1. As now, simply trust that URLs reported from the XML API are valid and ask Hudson admins to do a better job.

2. #1 but when adding a server check whether these URLs seem to use a different base than the URL the user passed in,
and display a warning to the user if so.

3. Ignore URLs in the XML API and reconstruct them from the user-specified base URL, taking care to escape metachars in
job names and so on.

Kohsuke further suggested

4. Ignore the protocol, host, and port from the XML API URLs but keep their paths. This I think will not work in cases
where pattern-based URL redirections employ path translations.
Comment 1 kohsuke 2009-05-21 17:56:13 UTC
Just a minor factual correction. Until 1.307, Hudson has always consulted the servlet API for absolutization, instead of
relying on the user configured value (see http://www.netbeans.org/issues/show_bug.cgi?id=165067).

This bug was fixed in 1.307 to put the priority on the user configured value first, and only when it's not available it
falls back to the value given by the servlet API.
Comment 2 Jesse Glick 2009-05-21 18:18:47 UTC
#3a: It should be possible to look in $root/api/xml for

http://junk.here/and/here/job/%C2%A1Viva%20Hudson%21/

and create

$root/job/%C2%A1Viva%20Hudson%21/

by extracting the last two path components - that will make the IDE code not need to do its own escaping.
Comment 3 Jesse Glick 2009-05-21 20:06:02 UTC
Issue #165067 claims the fix is in 1.306, but whichever it is the original description ("a recent Hudson release
fixed...") is about right.
Comment 4 Jesse Glick 2009-05-22 17:17:41 UTC
Test case: add "http://hudson.sfbay.sun.com/", select a job name, and Open in Browser. Should open to .sun.com address,
not just http://hudson.sfbay/job/whatever/ as before.

cdev #c1bf664e1246
Comment 5 Quality Engineering 2009-05-23 06:59:54 UTC
Integrated into 'main-golden', will be available in build *200905230201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c1bf664e1246
User: Jesse Glick <jglick@netbeans.org>
Log: #165735: retain the same base URL as the user originally specified, picking up only suffix from api/xml.