URLConnection check fails with exception when it should return false
@@ -61,7 +61,11 @@ def touchTargetFile = { fileName ->
def ifExists = { url ->
if (url == null) return
URLConnection uCon = new URL(url).openConnection()
+ try {
return (uCon as HttpURLConnection).responseCode == 200
+ } catch(Exception e) {
+ return false
+ }
}
def safeDelete = { fileName ->
exec {
