From 7da6835d7fcd0739ea046b807ce895d0a5791c93 Mon Sep 17 00:00:00 2001 From: ManuSayure Date: Wed, 1 Mar 2017 07:39:43 -0300 Subject: [PATCH] replace constant with named constant --- src/magic/ui/helpers/UrlHelper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/magic/ui/helpers/UrlHelper.java b/src/magic/ui/helpers/UrlHelper.java index c0a705b885..6783063bc6 100644 --- a/src/magic/ui/helpers/UrlHelper.java +++ b/src/magic/ui/helpers/UrlHelper.java @@ -57,6 +57,7 @@ public final class UrlHelper { * Quickly checks to see whether URL is reachable. */ public static boolean isUrlValid(final URL url) { + final int timeout= 2000; // time, in milliseconds, used for open a link referenced by this URLConnection. if (url == null) return false; @@ -64,7 +65,7 @@ public final class UrlHelper { try { final HttpURLConnection huc = (HttpURLConnection) url.openConnection(); huc.setRequestMethod("HEAD"); - huc.setConnectTimeout(2000); + huc.setConnectTimeout(timeout); // Using constant named final int responseCode = huc.getResponseCode(); return responseCode == HttpURLConnection.HTTP_OK;