List of usage examples for java.net MalformedURLException getMessage
public String getMessage()
From source file:org.commonjava.couch.db.CouchManager.java
protected String buildDocUrl(final CouchDocument doc, final boolean includeRevision) throws CouchDBException { if (doc instanceof DenormalizedCouchDoc) { ((DenormalizedCouchDoc) doc).calculateDenormalizedFields(); }/* w w w . java 2 s .co m*/ try { String url; if (includeRevision && doc.getCouchDocRev() != null) { final Map<String, String> params = Collections.singletonMap(REV, doc.getCouchDocRev()); url = buildUrl(config.getDatabaseUrl(), params, doc.getCouchDocId()); } else { url = buildUrl(config.getDatabaseUrl(), (Map<String, String>) null, doc.getCouchDocId()); } return url; } catch (final MalformedURLException e) { throw new CouchDBException("Failed to format document URL for id: %s [revision=%s].\nReason: %s", e, doc.getCouchDocId(), doc.getCouchDocRev(), e.getMessage()); } }
From source file:com.consol.citrus.selenium.client.WebClient.java
public void start() { if (webDriver != null) { logger.warn("There are some open web browsers. They will be stopped."); stop();//from w ww. j a v a2 s. c o m } logger.info("We are opening a web browser of type {}", clientConfiguration.getBrowserType()); if (StringUtils.hasText(clientConfiguration.getSeleniumServer())) { try { webDriver = createRemoteWebDriver(clientConfiguration.getBrowserType(), clientConfiguration.getSeleniumServer()); } catch (MalformedURLException ex) { logger.error(ex.getMessage()); throw new CitrusRuntimeException(ex); } } else { webDriver = createLocalWebDriver(clientConfiguration.getBrowserType()); } }
From source file:org.commonjava.couch.db.CouchManager.java
public void attach(final CouchDocument doc, final Attachment attachment) throws CouchDBException { if (!documentRevisionExists(doc)) { throw new CouchDBException("Cannot attach to a non-existent document: %s", doc.getCouchDocId()); }//from w w w . j a v a 2s .c o m String url; try { url = buildUrl(config.getDatabaseUrl(), Collections.singletonMap(REV, doc.getCouchDocRev()), doc.getCouchDocId(), attachment.getName()); } catch (final MalformedURLException e) { throw new CouchDBException("Failed to format attachment URL for: %s to document: %s. Error: %s", e, attachment.getName(), doc.getCouchDocId(), e.getMessage()); } LOGGER.info("Attaching " + attachment.getName() + " to document: " + doc.getCouchDocId() + "\nURL: " + url); final HttpPut request = new HttpPut(url); request.setHeader(HttpHeaders.CONTENT_TYPE, attachment.getContentType()); try { request.setEntity(new InputStreamEntity(attachment.getData(), attachment.getContentLength())); } catch (final IOException e) { throw new CouchDBException("Failed to read attachment data: %s. Error: %s", e, attachment.getName(), e.getMessage()); } client.executeHttp(request, SC_CREATED, "Failed to attach to document"); }
From source file:org.runnerup.export.RunKeeperSynchronizer.java
@Override public Status connect() { Status s = Status.NEED_AUTH;// www . ja v a 2 s . co m s.authMethod = AuthMethod.OAUTH2; if (access_token == null) { return s; } if (feed_access_token == null && (feed_username != null && feed_password != null)) { return getFeedAccessToken(); } if (fitnessActivitiesUrl != null) { return Synchronizer.Status.OK; } /** * Get the fitnessActivities end-point */ String uri = null; HttpURLConnection conn = null; Exception ex = null; do { try { URL newurl = new URL(REST_URL + "/user"); conn = (HttpURLConnection) newurl.openConnection(); conn.setRequestProperty("Authorization", "Bearer " + access_token); InputStream in = new BufferedInputStream(conn.getInputStream()); uri = SyncHelper.parse(in).getString("fitness_activities"); } catch (MalformedURLException e) { ex = e; } catch (IOException e) { if (REST_URL.contains("https")) { REST_URL = REST_URL.replace("https", "http"); Log.e(Constants.LOG, e.getMessage()); Log.e(Constants.LOG, " => retry with REST_URL: " + REST_URL); continue; // retry } ex = e; } catch (JSONException e) { ex = e; } break; } while (true); if (conn != null) { conn.disconnect(); } if (ex != null) { Log.e(Constants.LOG, ex.getMessage()); } if (uri != null) { fitnessActivitiesUrl = uri; return Synchronizer.Status.OK; } s = Synchronizer.Status.ERROR; s.ex = ex; return s; }
From source file:org.opendatakit.survey.android.tasks.InstanceUploaderTask.java
/** * Uploads to urlString the submission identified by id with filepath of * instance// w w w.j av a2s . c o m * * @param urlString * destination URL * @param id * -- _ID in the InstanceColumns table. * @param instanceFilePath * @param httpclient * - client connection * @param localContext * - context (e.g., credentials, cookies) for client connection * @param uriRemap * - mapping of Uris to avoid redirects on subsequent invocations * @return false if credentials are required and we should terminate * immediately. */ private boolean uploadOneSubmission(String urlString, Uri toUpdate, String id, String submissionInstanceId, FileSet instanceFiles, HttpClient httpclient, HttpContext localContext, Map<URI, URI> uriRemap) { ContentValues cv = new ContentValues(); cv.put(InstanceColumns.SUBMISSION_INSTANCE_ID, submissionInstanceId); URI u = null; try { URL url = new URL(URLDecoder.decode(urlString, CharEncoding.UTF_8)); u = url.toURI(); } catch (MalformedURLException e) { WebLogger.getLogger(appName).printStackTrace(e); mOutcome.mResults.put(id, fail + "invalid url: " + urlString + " :: details: " + e.getMessage()); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } catch (URISyntaxException e) { WebLogger.getLogger(appName).printStackTrace(e); mOutcome.mResults.put(id, fail + "invalid uri: " + urlString + " :: details: " + e.getMessage()); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } catch (UnsupportedEncodingException e) { WebLogger.getLogger(appName).printStackTrace(e); mOutcome.mResults.put(id, fail + "invalid url: " + urlString + " :: details: " + e.getMessage()); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } // NOTE: ODK Survey assumes you are interfacing with an // OpenRosa-compliant server if (uriRemap.containsKey(u)) { // we already issued a head request and got a response, // so we know the proper URL to send the submission to // and the proper scheme. We also know that it was an // OpenRosa compliant server. u = uriRemap.get(u); } else { // we need to issue a head request HttpHead httpHead = WebUtils.get().createOpenRosaHttpHead(u); // prepare response HttpResponse response = null; try { response = httpclient.execute(httpHead, localContext); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == 401) { WebUtils.get().discardEntityBytes(response); // we need authentication, so stop and return what we've // done so far. mOutcome.mAuthRequestingServer = u; return false; } else if (statusCode == 204) { Header[] locations = response.getHeaders("Location"); WebUtils.get().discardEntityBytes(response); if (locations != null && locations.length == 1) { try { URL url = new URL(URLDecoder.decode(locations[0].getValue(), CharEncoding.UTF_8)); URI uNew = url.toURI(); if (u.getHost().equalsIgnoreCase(uNew.getHost())) { // trust the server to tell us a new location // ... and possibly to use https instead. uriRemap.put(u, uNew); u = uNew; } else { // Don't follow a redirection attempt to a // different host. // We can't tell if this is a spoof or not. mOutcome.mResults.put(id, fail + "Unexpected redirection attempt to a different host: " + uNew.toString()); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } } catch (Exception e) { WebLogger.getLogger(appName).printStackTrace(e); mOutcome.mResults.put(id, fail + urlString + " " + e.getMessage()); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } } } else { // may be a server that does not handle WebUtils.get().discardEntityBytes(response); WebLogger.getLogger(appName).w(t, "Status code on Head request: " + statusCode); if (statusCode >= 200 && statusCode <= 299) { mOutcome.mResults.put(id, fail + "Invalid status code on Head request. If you have a web proxy, you may need to login to your network. "); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } } } catch (ClientProtocolException e) { WebLogger.getLogger(appName).printStackTrace(e); WebLogger.getLogger(appName).e(t, e.getMessage()); ClientConnectionManagerFactory.get(appName).clearHttpConnectionManager(); mOutcome.mResults.put(id, fail + "Client Protocol Exception"); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } catch (ConnectTimeoutException e) { WebLogger.getLogger(appName).printStackTrace(e); WebLogger.getLogger(appName).e(t, e.getMessage()); ClientConnectionManagerFactory.get(appName).clearHttpConnectionManager(); mOutcome.mResults.put(id, fail + "Connection Timeout"); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } catch (UnknownHostException e) { WebLogger.getLogger(appName).printStackTrace(e); ClientConnectionManagerFactory.get(appName).clearHttpConnectionManager(); mOutcome.mResults.put(id, fail + e.getMessage() + " :: Network Connection Failed"); WebLogger.getLogger(appName).e(t, e.getMessage()); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } catch (SocketTimeoutException e) { WebLogger.getLogger(appName).printStackTrace(e); WebLogger.getLogger(appName).e(t, e.getMessage()); ClientConnectionManagerFactory.get(appName).clearHttpConnectionManager(); mOutcome.mResults.put(id, fail + "Connection Timeout"); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } catch (HttpHostConnectException e) { WebLogger.getLogger(appName).printStackTrace(e); WebLogger.getLogger(appName).e(t, e.toString()); ClientConnectionManagerFactory.get(appName).clearHttpConnectionManager(); mOutcome.mResults.put(id, fail + "Network Connection Refused"); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } catch (Exception e) { WebLogger.getLogger(appName).printStackTrace(e); ClientConnectionManagerFactory.get(appName).clearHttpConnectionManager(); mOutcome.mResults.put(id, fail + "Generic Exception"); WebLogger.getLogger(appName).e(t, e.getMessage()); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } } // At this point, we may have updated the uri to use https. // This occurs only if the Location header keeps the host name // the same. If it specifies a different host name, we error // out. // // And we may have set authentication cookies in our // cookiestore (referenced by localContext) that will enable // authenticated publication to the server. // // get instance file File instanceFile = instanceFiles.instanceFile; if (!instanceFile.exists()) { mOutcome.mResults.put(id, fail + "instance XML file does not exist!"); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } List<MimeFile> files = instanceFiles.attachmentFiles; boolean first = true; int j = 0; int lastJ; while (j < files.size() || first) { lastJ = j; first = false; HttpPost httppost = WebUtils.get().createOpenRosaHttpPost(u, mAuth); long byteCount = 0L; // mime post MultipartEntity entity = new MultipartEntity(); // add the submission file first... FileBody fb = new FileBody(instanceFile, "text/xml"); entity.addPart("xml_submission_file", fb); WebLogger.getLogger(appName).i(t, "added xml_submission_file: " + instanceFile.getName()); byteCount += instanceFile.length(); for (; j < files.size(); j++) { MimeFile mf = files.get(j); File f = mf.file; String contentType = mf.contentType; fb = new FileBody(f, contentType); entity.addPart(f.getName(), fb); byteCount += f.length(); WebLogger.getLogger(appName).i(t, "added " + contentType + " file " + f.getName()); // we've added at least one attachment to the request... if (j + 1 < files.size()) { long nextFileLength = (files.get(j + 1).file.length()); if ((j - lastJ + 1 > 100) || (byteCount + nextFileLength > 10000000L)) { // the next file would exceed the 10MB threshold... WebLogger.getLogger(appName).i(t, "Extremely long post is being split into multiple posts"); try { StringBody sb = new StringBody("yes", Charset.forName(CharEncoding.UTF_8)); entity.addPart("*isIncomplete*", sb); } catch (Exception e) { WebLogger.getLogger(appName).printStackTrace(e); // never happens... } ++j; // advance over the last attachment added... break; } } } httppost.setEntity(entity); // prepare response and return uploaded HttpResponse response = null; try { response = httpclient.execute(httppost, localContext); int responseCode = response.getStatusLine().getStatusCode(); WebUtils.get().discardEntityBytes(response); WebLogger.getLogger(appName).i(t, "Response code:" + responseCode); // verify that the response was a 201 or 202. // If it wasn't, the submission has failed. if (responseCode != 201 && responseCode != 202) { if (responseCode == 200) { mOutcome.mResults.put(id, fail + "Network login failure? Again?"); } else { mOutcome.mResults.put(id, fail + response.getStatusLine().getReasonPhrase() + " (" + responseCode + ") at " + urlString); } cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } } catch (Exception e) { WebLogger.getLogger(appName).printStackTrace(e); mOutcome.mResults.put(id, fail + "Generic Exception. " + e.getMessage()); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMISSION_FAILED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; } } // if it got here, it must have worked mOutcome.mResults.put(id, appContext.getString(R.string.success)); cv.put(InstanceColumns.XML_PUBLISH_STATUS, InstanceColumns.STATUS_SUBMITTED); appContext.getContentResolver().update(toUpdate, cv, null, null); return true; }
From source file:org.apache.manifoldcf.authorities.authorities.sharepoint.SharePointAuthority.java
/** Check connection for sanity. *//*from w w w . j a v a2s.c o m*/ @Override public String check() throws ManifoldCFException { getSharePointSession(); try { URL urlServer = new URL(serverUrl); } catch (MalformedURLException e) { return "Illegal SharePoint url: " + e.getMessage(); } try { proxy.checkConnection("/"); } catch (ManifoldCFException e) { return e.getMessage(); } return super.check(); }
From source file:com.aol.webservice_base.util.http.HttpHelper.java
/** * Http client call.// w w w. j a va2 s .c o m * * callers to this are responsible for ensuring connection is closed properly - httpHelper.releaseResponse() * * @param requestMethod the request method * @param url the url * @param headers the headers * @param content the content * @return the http response * @throws HttpException the http exception */ protected HttpResponse httpClientCall(String requestMethod, String url, Map<String, String> headers, Object content) throws HttpException { HttpResponse response = null; if (!inited) { throw new Error("HttpHelper used when not initialized (call init) for " + url); } final String METHOD = "HttpHelper.httpClientCall()"; HttpRequestBase httpRequest = null; boolean success = false; int iter = 0; int status; String statusMsg; do { try { long begin = System.currentTimeMillis(); new URL(url); httpRequest = getHttpRequest(requestMethod, url, content); if (headers != null && headers.size() > 0) { for (Map.Entry<String, String> headerSet : headers.entrySet()) { httpRequest.addHeader(headerSet.getKey(), headerSet.getValue()); } } Header[] requestHeaders = httpRequest.getAllHeaders(); for (int i = 0; i < requestHeaders.length; i++) { String name = requestHeaders[i].getName(); String value = requestHeaders[i].getValue(); if (logger.isDebugEnabled()) { logger.debug("Request header " + name + " = [" + value + "]"); } } // make the request //httpRequest.setFollowRedirects(false); response = httpClient.execute(httpRequest); status = response.getStatusLine().getStatusCode(); statusMsg = response.getStatusLine().getReasonPhrase(); if (logger.isDebugEnabled()) { logger.debug(METHOD + " status=" + status + " status desc: [" + statusMsg + "] url=[" + url + "] took=" + (System.currentTimeMillis() - begin) + " ms"); } if (status == 302 || status == 301) { Header loc = httpRequest.getFirstHeader("Location"); if (loc != null) { String origUrl = url; url = loc.getValue(); if (!url.startsWith("http")) { url = addHost(origUrl, url); } continue; } } if (status != 200 /* && status != 304 */) { throw new HttpException(status, statusMsg); } if (logger.isDebugEnabled()) { Header[] responseHeaders = response.getAllHeaders(); for (int i = 0; i < responseHeaders.length; i++) { String name = responseHeaders[i].getName(); String value = responseHeaders[i].getValue(); logger.debug("Response header " + name + " = [" + value + "]"); } } success = true; return response; } catch (MalformedURLException e) { String msg = "target URL = [" + url + "] is invalid."; logger.error(msg); throw new HttpException(HttpServletResponse.SC_NOT_FOUND, msg); } catch (HttpException e) { logger.error("HttpException " + METHOD + " url=" + url + " exception=" + e.getMessage()); throw e; } catch (java.net.SocketTimeoutException e) { logger.error("SocketTimeoutException " + METHOD + " url=" + url + " exception=" + e.getMessage()); throw new HttpException(HttpServletResponse.SC_GATEWAY_TIMEOUT, "Connection or Read timeout exception: " + e); } catch (Throwable t) { logger.error("HttpException " + METHOD + " url=" + url + " exception=" + t.getMessage()); throw new HttpException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, t); } finally { // release the connection whenever we are not successful if ((!success) && (response != null)) { try { releaseResponse(response); response = null; } catch (IOException e) { logger.error("HttpHelper - problem releasing connection", e); } } } } while (!success && (++iter <= this.followRedirectMax)); throw new HttpException(status, statusMsg); }
From source file:com.bdaum.zoom.gps.internal.operations.GeotagOperation.java
protected Waypoint getPlaceInfo(Meta meta, int i, double lat, double lon, IProgressMonitor aMonitor, IAdaptable info) throws UnknownHostException, EOFException { RasterCoordinate coord = new RasterCoordinate(lat, lon, 2); Waypoint place = coord.findClosestMatch(placeMap, 0.06d, 'K'); if (place != null) return place; try {/* ww w.j a v a 2 s. c o m*/ if (!lastAccessFailed && yieldWebservice(aMonitor)) return null; lastAccessFailed = true; place = GpsUtilities.fetchPlaceInfo(lat, lon); if (place != null && !Double.isNaN(place.getLat()) && !Double.isNaN(place.getLon())) { double elevation = getElevation(place.getLat(), place.getLon(), aMonitor); if (!Double.isNaN(elevation)) place.setElevation(elevation); } if (place != null) { placeMap.put(coord, place); lastAccessFailed = false; return place; } } catch (MalformedURLException e) { // should never happen } catch (SocketTimeoutException e) { addError(Messages.getString("GeotagOperation.connection_timed_out"), //$NON-NLS-1$ null); } catch (HttpException e) { String message = e.getMessage(); if (message.indexOf("(503)") >= 0) { //$NON-NLS-1$ addError(Messages.getString("GeotagOperation.geonaming_aborted"), e); //$NON-NLS-1$ if (aMonitor != null) aMonitor.setCanceled(true); } else addError(NLS.bind(Messages.getString("GeotagOperation.http_exception"), message), //$NON-NLS-1$ null); } catch (IOException e) { if (e instanceof UnknownHostException) throw (UnknownHostException) e; addError(Messages.getString("GeotagOperation.IO_Error_parsing_response"), //$NON-NLS-1$ e); } catch (NumberFormatException e) { addError(Messages.getString("GeotagOperation.Number_format_parsing_response"), //$NON-NLS-1$ e); } catch (WebServiceException e) { addWarning(Messages.getString("GeotagOperation.Geoname_signalled_exception"), e); //$NON-NLS-1$ Throwable e2 = e.getCause(); if (e2 instanceof WebServiceException && e2 != e) { try { int code = Integer.parseInt(e2.getMessage()); if (code >= 18 && code <= 20) { handleResume(meta, code, i, info); throw new EOFException(); } } catch (NumberFormatException e1) { // do nothing } addError(Messages.getString("GeotagOperation.geonaming_aborted"), e2); //$NON-NLS-1$ if (aMonitor != null) aMonitor.setCanceled(true); } } catch (SAXException e) { addError(Messages.getString("GeotagOperation.XML_problem_parsing_response"), e); //$NON-NLS-1$ } catch (ParserConfigurationException e) { addError(Messages.getString("GeotagOperation.internal_error_configuring_sax"), e); //$NON-NLS-1$ } return null; }
From source file:org.geoserver.geofence.gui.server.service.impl.RulesManagerServiceImpl.java
/** * @param rule//from ww w .ja va 2s. co m * @return List<LayerAttribUI> */ private List<LayerAttribUI> loadAttribute(RuleModel rule) { List<LayerAttribUI> layerAttributesDTO = new ArrayList<LayerAttribUI>(); // Set<LayerAttribute> layerAttributes = null; GSInstanceModel gsInstance = rule.getInstance(); GeoServerRESTReader gsreader; try { gsreader = new GeoServerRESTReader(gsInstance.getBaseURL(), gsInstance.getUsername(), gsInstance.getPassword()); RESTLayer layer = gsreader.getLayer(rule.getLayer()); if (layer.getType().equals(RESTLayer.TYPE.VECTOR)) { // layerAttributes = new HashSet<LayerAttribute>(); // /////////////////////// // Vector Layer // /////////////////////// RESTFeatureType featureType = gsreader.getFeatureType(layer); for (RESTFeatureType.Attribute attrFromGS : featureType.getAttributes()) { LayerAttribUI layAttrUI = new LayerAttribUI(); layAttrUI.setName(attrFromGS.getName()); layAttrUI.setDataType(attrFromGS.getBinding()); layAttrUI.setAccessType("READWRITE"); layerAttributesDTO.add(layAttrUI); } } else { // /////////////////////// // Raster Layer // /////////////////////// layerAttributesDTO = null; } } catch (MalformedURLException e) { logger.error(e.getMessage(), e); throw new ApplicationException(e.getMessage(), e); } return layerAttributesDTO; }
From source file:org.kie.smoke.wb.util.unit.GetIgnoreRule.java
@Override public Statement apply(Statement base, FrameworkMethod method, Object target) { Statement result = base;//from w ww . j a v a2 s. co m if (hasConditionalIgnoreAnnotation(method)) { String urlString = getGetUrl(target, method); String message = "Ignored because [GET] " + urlString + " failed."; boolean liveServer = false; try { new URL(urlString); // check that url is a valid url string liveServer = true; } catch (MalformedURLException e) { liveServer = false; message = "Ignored because [" + urlString + "] is not a valid URL."; } if (liveServer) { try { Response response = Request.Get(urlString).execute(); int code = response.returnResponse().getStatusLine().getStatusCode(); if (code > 401) { liveServer = false; message = "Ignored because [GET] " + urlString + " returned " + code; } } catch (HttpHostConnectException hhce) { liveServer = false; message = "Ignored because server is not available: " + hhce.getMessage(); } catch (Exception e) { liveServer = false; message = "Ignored because [GET] " + urlString + " threw: " + e.getMessage(); } } if (!liveServer) { result = new IgnoreStatement(message); } } return result; }