ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51110] [PATCH] Ambiguous expected result from the resourceexists condition with URLResource
Date Tue, 14 Feb 2012 11:35:20 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51110

--- Comment #8 from Stefan Bodewig <bodewig@apache.org> 2012-02-14 11:35:20 UTC ---
Created attachment 28330
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28330
Alternative patch using the HTTP status code

Thanks again.

I think we have a problem, though.  The whole point of the closeConnection
parameter is to avoid opening more connections to the server than necessary. 
With your patch we could simply ignore the flag and always close the connection
as the result would be the same.

OTOH your experiments show there is no way to be absolutely sure the URL
actually is connected to an existing resource without using a method that makes
the connection unusable for subsequent calls.  Is this correct?

I have extended your example to cover file and jar URLs as well and the current
code works for those.  I need to dig out an ftp-server to verify there.

For HTTP URLs we could check the status-code and in fact the patch I'll attach
does just that and makes your test pass.  In my simplistic patch I assume the
URLConnection already handles redirects so any 1xx, 2xx and 3xx should mean the
resource exists.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message