Example usage for java.net SocketTimeoutException getMessage

List of usage examples for java.net SocketTimeoutException getMessage

Introduction

In this page you can find the example usage for java.net SocketTimeoutException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.mpower.daktar.android.tasks.DownloadFormsTask.java

@Override
protected HashMap<String, String> doInBackground(final ArrayList<FormDetails>... values) {
    final ArrayList<FormDetails> toDownload = values[0];

    final int total = toDownload.size();
    int count = 1;

    final HashMap<String, String> result = new HashMap<String, String>();

    for (int i = 0; i < total; i++) {
        final FormDetails fd = toDownload.get(i);
        publishProgress(fd.formName, Integer.valueOf(count).toString(), Integer.valueOf(total).toString());

        String message = "";

        try {/* www . j  a v a2 s .  c  o m*/
            // get the xml file
            // if we've downloaded a duplicate, this gives us the file
            final File dl = downloadXform(fd.formName, fd.downloadUrl);

            final String[] projection = { BaseColumns._ID, FormsColumns.FORM_FILE_PATH };
            final String[] selectionArgs = { dl.getAbsolutePath() };
            final String selection = FormsColumns.FORM_FILE_PATH + "=?";
            final Cursor alreadyExists = MIntel.getInstance().getContentResolver()
                    .query(FormsColumns.CONTENT_URI, projection, selection, selectionArgs, null);

            Uri uri = null;
            if (alreadyExists.getCount() <= 0) {
                // doesn't exist, so insert it
                final ContentValues v = new ContentValues();
                v.put(FormsColumns.FORM_FILE_PATH, dl.getAbsolutePath());

                final HashMap<String, String> formInfo = FileUtils.parseXML(dl);
                v.put(FormsColumns.DISPLAY_NAME, formInfo.get(FileUtils.TITLE));
                v.put(FormsColumns.MODEL_VERSION, formInfo.get(FileUtils.MODEL));
                v.put(FormsColumns.UI_VERSION, formInfo.get(FileUtils.UI));
                v.put(FormsColumns.JR_FORM_ID, formInfo.get(FileUtils.FORMID));
                v.put(FormsColumns.SUBMISSION_URI, formInfo.get(FileUtils.SUBMISSIONURI));
                uri = MIntel.getInstance().getContentResolver().insert(FormsColumns.CONTENT_URI, v);
            } else {
                alreadyExists.moveToFirst();
                uri = Uri.withAppendedPath(FormsColumns.CONTENT_URI,
                        alreadyExists.getString(alreadyExists.getColumnIndex(BaseColumns._ID)));
            }

            if (fd.manifestUrl != null) {
                final Cursor c = MIntel.getInstance().getContentResolver().query(uri, null, null, null, null);
                if (c.getCount() > 0) {
                    // should be exactly 1
                    c.moveToFirst();

                    final String error = downloadManifestAndMediaFiles(
                            c.getString(c.getColumnIndex(FormsColumns.FORM_MEDIA_PATH)), fd, count, total);
                    if (error != null) {
                        message += error;
                    }
                }
            } else {
                // TODO: manifest was null?
                Log.e(t, "Manifest was null.  PANIC");
            }
        } catch (final SocketTimeoutException se) {
            se.printStackTrace();
            message += se.getMessage();
        } catch (final Exception e) {
            e.printStackTrace();
            if (e.getCause() != null) {
                message += e.getCause().getMessage();
            } else {
                message += e.getMessage();
            }
        }
        count++;
        if (message.equalsIgnoreCase("")) {
            message = MIntel.getInstance().getString(R.string.success);
        }
        result.put(fd.formName, message);
    }

    return result;
}

From source file:gda.device.scannable.keyence.Keyence.java

/**
 * Send command to the server.// ww  w .  ja  va 2s . com
 * 
 * @param msg
 *            an unterminated command
 * @param expectedReplyItems 
 * @return the reply string.
 * @throws DeviceException
 */
public Object[] processImageRequest(String msg, int expectedReplyItems) throws DeviceException {
    if (expectedReplyItems < 2)
        throw new IllegalArgumentException("need at least two values for images (length definition and data)");
    String command = msg + '\r';
    Object reply[] = new Object[expectedReplyItems + 1];
    logger.debug(getName() + ": sent command: " + msg);
    synchronized (socketAccessLock) {
        try {
            if (!isConnected()) {
                throw new DeviceException("not connected");
            }
            cleanPipe();
            socketChannel.write(encoder.encode(CharBuffer.wrap(command)));

            ByteBuffer singleByte = ByteBuffer.allocate(1);

            StringBuilder sb = new StringBuilder();
            int argCounter = 0;
            while (argCounter < expectedReplyItems) {
                singleByte.clear();
                socketChannel.socket().setSoTimeout(socketTimeOut);
                socketChannel.configureBlocking(true);
                while (singleByte.position() == 0)
                    socketChannel.read(singleByte);
                singleByte.flip();
                String c = decoder.decode(singleByte).toString();
                logger.debug(c.toString());
                if (c.equals(",")) {
                    reply[argCounter] = sb.toString();
                    sb = new StringBuilder();
                    argCounter++;
                } else if (c.equals("\r")) {
                    throw new DeviceException(
                            "sendCommand: not enough data for image received - suspect an error");
                } else {
                    sb.append(c);
                }
            }

            int imageLength = Integer.parseInt(reply[expectedReplyItems - 1].toString());

            byte[] imageData = new byte[imageLength];
            ByteBuffer bybu = ByteBuffer.wrap(imageData);

            while (bybu.remaining() != 0) {
                socketChannel.read(bybu);
            }

            reply[expectedReplyItems] = imageData;
        } catch (SocketTimeoutException ex) {
            throw new DeviceException("sendCommand read timeout " + ex.getMessage(), ex);
        } catch (IOException ex) {
            // treat as fatal
            connected = false;
            throw new DeviceException("sendCommand: " + ex.getMessage(), ex);
        }
    }
    return reply;
}

From source file:org.infoscoop.web.WidgetConfServlet.java

protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("text/plain; charset=UTF-8");
    response.setHeader("Pragma", "no-cache");
    response.setHeader("Cache-Control", "no-cache");

    //String types = request.getParameter("types");
    String type = request.getParameter("type");
    //String displayFlag = request.getParameter("displayFlag");
    //String reload = request.getParameter("reload");

    Writer writer = response.getWriter();

    Locale locale = request.getLocale();

    WidgetConfService service = (WidgetConfService) SpringUtil.getBean("WidgetConfService");
    try {/* w  w w. j ava  2s  .  c  om*/
        String json = null;
        //if (types != null) {
        //   json = getWidgetConfJSON(types.split(","), request);
        //} else if (displayFlag != null) {
        //   json = getWidgetConfRSSList(displayFlag, request);
        //} else {
        if (type != null) {
            if (type.startsWith("g_")) {
                type = type.substring(2);

                json = getGadgetConfJson(request, type, locale);
            } else {
                json = service.getWidgetConfJsonByType(type, locale, true);
            }
        } else {
            String uid = (String) request.getSession().getAttribute("Uid");
            json = service.getWidgetConfsJson(uid, locale);
        }

        writer.write(json);
        // Copy from ProxyServlet
    } catch (SocketTimeoutException ex) {
        // When the status code was 408, Firefox did not move well.
        // Because the cords such as 10408 are converted into 500 by Apache-GlassFish cooperation, we set it in a header.Apache-GlassFish.
        log.error("", ex);
        response.setHeader(HttpStatusCode.HEADER_NAME, HttpStatusCode.MSD_SC_TIMEOUT);
        response.sendError(500);
    } catch (ConnectTimeoutException ex) {
        log.error("", ex);
        response.sendError(500, ex.getMessage());
    } catch (Exception e) {
        log.error("Unexpected exception occurred.", e);
        response.sendError(500, e.getMessage());
    } finally {
        writer.flush();
        //writer.close();
    }
}

From source file:org.elasticsearch.xpack.watcher.common.http.HttpClientTests.java

public void testThatClientTakesTimeoutsIntoAccountAfterHeadersAreSent() throws Exception {
    webServer.enqueue(/*from  w w w.j a va  2  s  .  c o m*/
            new MockResponse().setResponseCode(200).setBody("foo").setBodyDelay(TimeValue.timeValueSeconds(2)));

    HttpRequest request = HttpRequest.builder("localhost", webServer.getPort()).path("/foo")
            .method(HttpMethod.POST).body("foo").connectionTimeout(TimeValue.timeValueMillis(500))
            .readTimeout(TimeValue.timeValueMillis(500)).build();
    SocketTimeoutException e = expectThrows(SocketTimeoutException.class, () -> httpClient.execute(request));
    assertThat(e.getMessage(), is("Read timed out"));
}

From source file:org.openhab.binding.pulseaudio.internal.PulseaudioClient.java

private String _sendRawRequest(String command) {
    checkConnection();//  w  w  w.  j  av a2  s.c om
    String result = "";
    try {
        PrintStream out = new PrintStream(client.getOutputStream(), true);
        out.print(command + "\r\n");

        InputStream instr = client.getInputStream();

        try {
            byte[] buff = new byte[1024];
            int ret_read = 0;
            int lc = 0;
            do {
                ret_read = instr.read(buff);
                lc++;
                if (ret_read > 0) {
                    String line = new String(buff, 0, ret_read);
                    //System.out.println("'"+line+"'");
                    if (line.endsWith(">>> ") && lc > 1) {
                        result += line.substring(0, line.length() - 4);
                        break;
                    }
                    result += line.trim();
                }
            } while (ret_read > 0);
        } catch (SocketTimeoutException e) {
            // Timeout -> send was has been received so far
            return result;
        } catch (IOException e) {
            System.err.println("Exception while reading socket:" + e.getMessage());
        }
        instr.close();
        out.close();
        client.close();
        return result;
    } catch (IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    }
    return result;
}

From source file:gov.nasa.ensemble.common.io.RemotableFile.java

private File getConsistentFile(long modified, REMOTE_FILE_MODES myMode, int socketTimeout)
        throws SocketTimeoutException {
    Date modifiedDate = new Date(modified);
    DateFormat df = new SimpleDateFormat(DATE_FORMAT_STR);
    String formatedModifiedDate = df.format(modifiedDate);
    if (remoteFile == null) {
        return localFile;
    }/*from w  w  w.jav  a  2 s. c om*/
    HttpConnectionParams.setSoTimeout(client.getParams(), socketTimeout);

    // tell the client to use the credential we got as parameter
    // if we have an authenticator
    Authenticator auth = AuthenticationUtil.getAuthenticator();
    if (auth != null) {
        if (client instanceof AbstractHttpClient) {
            ((AbstractHttpClient) client).getCredentialsProvider().setCredentials(
                    new AuthScope(null, AuthScope.ANY_PORT, null, AuthScope.ANY_SCHEME), auth.getCredentials());
        }
        //         state.setAuthenticationPreemptive(true);
    }

    HttpResponse response = null;
    HttpGet get = new HttpGet(remoteFile.toString());
    HttpClientParams.setRedirecting(get.getParams(), false);
    HttpClientParams.setAuthenticating(get.getParams(), true);
    try {
        get.setHeader(HttpHeaders.IF_MODIFIED_SINCE, formatedModifiedDate);
        response = client.execute(get);
        if (HttpStatus.SC_NOT_MODIFIED == response.getStatusLine().getStatusCode()) {
            return localFile;
        } else if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode()) {
            InputStream is = response.getEntity().getContent();
            getRemoteFileFromStream(is);
            if (REMOTE_FILE_MODES.CHECK_CUSTOM_TIMESTAMP == myMode) {
                localFile.setLastModified(customTimeStamp);
            } else {
                setModifiedTime(get);
            }
            return localFile;
        } else if (HttpStatus.SC_NOT_FOUND == response.getStatusLine().getStatusCode()) {
            remoteFileNotFound();
        }
    } catch (SocketTimeoutException e1) {
        throw e1;
    } catch (IOException e1) {
        // HACK HACK HACK HACK
        if (e1.getMessage().contains("SocketTimeoutException"))
            throw new SocketTimeoutException();
        else
            trace.warn("Error connecting to server when " + "checking the file modified time ", e1);
    } finally {
        try {
            HttpUtils.consume(get, response);
        } catch (IOException e) {
            trace.error(e);
        }
    }
    return localFile;

}

From source file:com.radicaldynamic.groupinform.tasks.DownloadFormsTask.java

@Override
protected HashMap<String, String> doInBackground(ArrayList<FormDetails>... values) {
    ArrayList<FormDetails> toDownload = values[0];

    int total = toDownload.size();
    int count = 1;

    HashMap<String, String> result = new HashMap<String, String>();

    for (int i = 0; i < total; i++) {
        FormDetails fd = toDownload.get(i);
        publishProgress(fd.formName, Integer.valueOf(count).toString(), Integer.valueOf(total).toString());

        String message = "";

        try {/* w ww .  ja  v a  2 s. c o m*/
            // get the xml file
            // if we've downloaded a duplicate, this gives us the file
            File dl = downloadXform(fd.formName, fd.downloadUrl);

            // BEGIN custom
            //                String[] projection = {
            //                        FormsColumns._ID, FormsColumns.FORM_FILE_PATH
            //                };
            //                String[] selectionArgs = {
            //                    dl.getAbsolutePath()
            //                };
            //                String selection = FormsColumns.FORM_FILE_PATH + "=?";
            //                Cursor alreadyExists =
            //                    Collect.getInstance()
            //                            .getContentResolver()
            //                            .query(FormsColumns.CONTENT_URI, projection, selection, selectionArgs,
            //                                null);
            //
            //                Uri uri = null;
            //                if (alreadyExists.getCount() <= 0) {
            //                    // doesn't exist, so insert it
            //                    ContentValues v = new ContentValues();
            //                    v.put(FormsColumns.FORM_FILE_PATH, dl.getAbsolutePath());
            //
            //                    HashMap<String, String> formInfo = FileUtils.parseXML(dl);
            //                    v.put(FormsColumns.DISPLAY_NAME, formInfo.get(FileUtils.TITLE));
            //                    v.put(FormsColumns.MODEL_VERSION, formInfo.get(FileUtils.MODEL));
            //                    v.put(FormsColumns.UI_VERSION, formInfo.get(FileUtils.UI));
            //                    v.put(FormsColumns.JR_FORM_ID, formInfo.get(FileUtils.FORMID));
            //                    v.put(FormsColumns.SUBMISSION_URI, formInfo.get(FileUtils.SUBMISSIONURI));
            //                    uri =
            //                        Collect.getInstance().getContentResolver()
            //                                .insert(FormsColumns.CONTENT_URI, v);
            //                } else {
            //                    alreadyExists.moveToFirst();
            //                    uri =
            //                        Uri.withAppendedPath(FormsColumns.CONTENT_URI,
            //                            alreadyExists.getString(alreadyExists.getColumnIndex(FormsColumns._ID)));
            //                }
            // END custom

            if (fd.manifestUrl != null) {
                // BEGIN custom
                //                    Cursor c =
                //                        Collect.getInstance().getContentResolver()
                //                                .query(uri, null, null, null, null);
                //                    if (c.getCount() > 0) {
                //                        // should be exactly 1
                //                        c.moveToFirst();
                //
                //                        String error =
                //                            downloadManifestAndMediaFiles(
                //                                c.getString(c.getColumnIndex(FormsColumns.FORM_MEDIA_PATH)), fd,
                //                                count, total);
                //                        if (error != null) {
                //                            message += error;
                //                        }
                //                    }
                String error = downloadManifestAndMediaFiles(dl.getParent(), fd, count, total);

                if (error != null) {
                    message += error;
                }
                // END custom
            } else {
                // TODO: manifest was null?
                Log.e(t, "Manifest was null.  PANIC");
            }

            // BEGIN custom
            HashMap<String, String> formInfo = FileUtils.parseXML(dl);

            // Create form document and add attachments; commit to database
            FormDefinition fDoc = new FormDefinition();
            fDoc.setName(formInfo.get(FileUtils.TITLE));
            fDoc.setModelVersion(formInfo.get(FileUtils.MODEL));
            fDoc.setUiVersion(formInfo.get(FileUtils.UI));
            fDoc.setJavaRosaId(formInfo.get(FileUtils.FORMID));
            fDoc.setSubmissionUri(formInfo.get(FileUtils.SUBMISSIONURI));
            fDoc.setStatus(FormDefinition.Status.active);
            fDoc.setXmlHash(FileUtils.getMd5Hash(dl));
            Collect.getInstance().getDbService().getDb().create(fDoc);

            String revision = fDoc.getRevision();

            for (File f : dl.getParentFile().listFiles()) {
                String fileName = f.getName();
                String attachmentName = fileName;

                if (Collect.Log.VERBOSE)
                    Log.v(Collect.LOGTAG, t + ": attaching " + fileName + " to " + fDoc.getId());

                if (fileName.equals(dl.getName()))
                    attachmentName = "xml";

                String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
                String contentType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);

                FileInputStream fis = new FileInputStream(f);
                AttachmentInputStream ais = new AttachmentInputStream(attachmentName, fis, contentType,
                        f.length());
                revision = Collect.getInstance().getDbService().getDb().createAttachment(fDoc.getId(), revision,
                        ais);
                fis.close();
            }

            // Remove temporary download directory
            FileUtilsExtended.deleteFolder(dl.getParent());
            // END custom
        } catch (SocketTimeoutException se) {
            se.printStackTrace();
            message += se.getMessage();
            // BEGIN custom
        } catch (DuplicateXFormFile e) {
            message = " SKIPPED (duplicate)";
            // END custom
        } catch (Exception e) {
            e.printStackTrace();
            if (e.getCause() != null) {
                message += e.getCause().getMessage();
            } else {
                message += e.getMessage();
            }
        }
        count++;
        if (message.equalsIgnoreCase("")) {
            message = Collect.getInstance().getString(R.string.success);
        }
        result.put(fd.formName, message);
    }

    return result;
}

From source file:com.ebay.pulsar.analytics.metricstore.druid.query.DruidQueryProcessor.java

public TraceAbleResponse queryDruid(DruidQueryParameter parameterObject, DBConnector connector)
        throws IOException, JsonParseException, JsonMappingException, ParseException,
        DataSourceConfigurationException, DataSourceException, SqlTranslationException,
        InvalidQueryParameterException {

    BaseQuery query;//from   ww w  .  ja v a 2  s  .  com

    // Get All Druid Parameters from DruidSpecs
    DruidSpecs druidSpec = parameterObject.getDruidSpecs();
    List<String> strIntervals = PulsarDateTimeFormatter.buildStringIntervals(druidSpec.getIntervals());

    String dataSource = druidSpec.getFromTable();
    List<String> dimensions = druidSpec.getDimensions();
    BaseFilter filter = druidSpec.getFilter();
    BaseHaving having = druidSpec.getHaving();
    List<BaseAggregator> aggregations = druidSpec.getAggregators();
    List<BasePostAggregator> postAggregations = druidSpec.getPostAggregators();
    Table tableMeta = druidSpec.getTableColumnsMeta();

    int maxResults = druidSpec.getLimit();
    DefaultLimitSpec limitSpec = druidSpec.getLimitSpec();

    boolean useGroupBy4TopN = false;
    if (dimensions != null && dimensions.size() == 1) {
        String topNdim = dimensions.get(0);
        if (tableMeta.getDimensionByName(topNdim).isMultiValue()) {
            useGroupBy4TopN = true;
        }
        if (having != null) {
            useGroupBy4TopN = true;
        }

        if (limitSpec != null) {
            List<OrderByColumnSpec> orderByColumns = limitSpec.getColumns();
            if (orderByColumns != null && orderByColumns.size() > 1) {
                useGroupBy4TopN = true;
            } else if (orderByColumns != null && orderByColumns.size() == 1) {
                OrderByColumnSpec orderBySpec = orderByColumns.get(0);
                if (orderBySpec.getDirection() == SortDirection.ascending) {
                    useGroupBy4TopN = true;
                }
            }
        }
    }

    boolean topNRevise = false;
    if (dimensions == null || dimensions.size() == 0) {
        query = new TimeSeriesQuery(dataSource, strIntervals, druidSpec.getGranularity(), aggregations);
    } else if (dimensions.size() == 1 && !useGroupBy4TopN) {
        if (!BaseGranularity.ALL.equals(druidSpec.getGranularity())) {
            topNRevise = true;
            // Expand limit
            if (maxResults > TOPN_EXPAND_LIMIT) {
                maxResults = (int) Math.floor(maxResults * EXPAND_RATE);
            }
        }
        query = new TopNQuery(dataSource, strIntervals, druidSpec.getGranularity(), aggregations,
                dimensions.get(0), maxResults, new NumericMetric(druidSpec.getSort()));

    } else {
        DefaultLimitSpec defaultLimitSpec = null;
        if (limitSpec != null) {
            defaultLimitSpec = limitSpec;
        } else {
            OrderByColumnSpec orderByColumnSpec = new OrderByColumnSpec(druidSpec.getSort(),
                    SortDirection.descending);
            List<OrderByColumnSpec> columns = Lists.newArrayList();
            columns.add(orderByColumnSpec);
            defaultLimitSpec = new DefaultLimitSpec(maxResults, columns);
        }
        GroupByQuery groupByQuery = new GroupByQuery(dataSource, strIntervals, druidSpec.getGranularity(),
                aggregations, dimensions);

        if (having != null) {
            groupByQuery.setHaving(having);
        }
        groupByQuery.setLimitSpec(defaultLimitSpec);
        query = groupByQuery;
    }
    TraceQuery trace = new TraceQuery();
    trace.setQuery(query);

    TraceAbleResponse tresp = new TraceAbleResponse();
    tresp.setQuery(trace);

    query.setFilter(filter);
    if (postAggregations != null) {
        query.setPostAggregations(postAggregations);
    }

    StringBuilder catchKeyNSBuilder = new StringBuilder();
    Joiner.on('_').skipNulls().appendTo(catchKeyNSBuilder, parameterObject.getNs(),
            parameterObject.getDbNameSpaces(), query.getQueryType().name());
    String catchkeyNS = catchKeyNSBuilder.toString();
    try {
        if (topNRevise) {
            if (maxResults <= TOPN_EXPAND_LIMIT) {
                String druidRsp = reviseTopNWithTwoQueries(parameterObject, connector, query, trace,
                        catchkeyNS);
                tresp.setQueryResult(postQuery(druidRsp, druidSpec, useGroupBy4TopN, false));
            } else {
                String druidRsp = getQueryResultsFromCache(query, trace, connector, catchkeyNS,
                        parameterObject.getNs());
                tresp.setQueryResult(postQuery(druidRsp, druidSpec, useGroupBy4TopN, true));
            }
        } else {
            String druidRsp = getQueryResultsFromCache(query, trace, connector, catchkeyNS,
                    parameterObject.getNs());
            tresp.setQueryResult(postQuery(druidRsp, druidSpec, useGroupBy4TopN, false));
        }
    } catch (SocketTimeoutException ex) {
        List<Map<String, Object>> result = Lists.newArrayList();
        Map<String, Object> errorMap = Maps.newHashMap();
        errorMap.put("Error", ex.getMessage());
        result.add(errorMap);
        tresp.setQueryResult(result);
    }
    return tresp;
}

From source file:com.crawler.app.run.CrawlSite.java

/**
 * This function is called when a page is fetched and ready to be processed
 * by your program.//from  w ww .  j a  v a2 s . c o m
 */

public org.jsoup.nodes.Element convertUrlToDocument(String url) {
    try {

        Connection.Response response =

                Jsoup.connect(url)
                        //enable for error urls
                        .ignoreHttpErrors(true)
                        //MAXIMUN TIME
                        .timeout(50000)
                        //This is to prevent producing garbage by attempting to parse a JPEG binary image
                        .ignoreContentType(true).execute();

        int status = response.statusCode();
        //after done
        if (status == 200) {
            org.jsoup.nodes.Document doc = response.parse();
            Element body = doc.body();
            return body;
        } else {
            return null;
        }
    } catch (SocketTimeoutException se) {

        System.out.println("getContentOnly: SocketTimeoutException");
        System.out.println(se.getMessage());
        return null;
    }

    catch (Exception e) {

        System.out.println("getContentOnly: Exception");
        e.printStackTrace();
        return null;
    }
}

From source file:no.sesat.search.mode.command.AbstractFast4SearchCommand.java

public ResultList<ResultItem> execute() {

    try {/* w  ww.  j  a  v  a  2 s .  co  m*/
        final IFastSearchEngine engine = getSearchEngine();

        final IQuery fastQuery = createQuery();

        IQueryResult result = null;
        try {

            LOG.debug(DEBUG_EXECUTE_QR_URL + queryServerUrl);
            LOG.debug(DEBUG_EXECUTE_COLLECTIONS + getSearchConfiguration().getCollections());
            LOG.debug(DEBUG_EXECUTE_QUERY + fastQuery.getQueryString());
            LOG.debug(DEBUG_EXECUTE_FILTER + getSearchConfiguration().getCollectionFilterString());

            result = engine.search(fastQuery);

        } catch (SocketTimeoutException ste) {

            LOG.error(getSearchConfiguration().getName() + " --> " + ste.getMessage());
            return new FastSearchResult<ResultItem>();

        } catch (IOException ioe) {

            LOG.error(getSearchConfiguration().getName() + ERR_FAST_FAILURE, ioe);
            return new FastSearchResult<ResultItem>();

        } catch (SearchEngineException fe) {

            LOG.error(getSearchConfiguration().getName() + ERR_FAST_FAILURE + '[' + fe.getErrorCode() + ']',
                    fe);
            return new FastSearchResult<ResultItem>();

        }

        DUMP.info(fastQuery.toString());

        final FastSearchResult<ResultItem> searchResult = collectResults(result);

        if (getSearchConfiguration().isSpellcheck()) {
            collectSpellingSuggestions(result, searchResult);
        }

        if (getSearchConfiguration().isRelevantQueries() && null == getParameter("qs")) {
            collectRelevantQueries(result, searchResult);
        }

        if (getNavigators() != null) {
            collectModifiers(result, searchResult);
        }

        final String collapseId = getParameter(COLLAPSE_PARAMETER);

        if (getSearchConfiguration().isCollapsing() && getSearchConfiguration().isExpansion()) {

            if (collapseId != null && !collapseId.equals("")) {

                if (searchResult.getResults().size() > 0) {
                    final ResultItem itm = searchResult.getResults().get(0);
                    final URL url = new URL(itm.getField("url"));
                    searchResult.addField("collapsedDomain", url.getHost());
                }
            }
        }

        return searchResult;

    } catch (ConfigurationException e) {
        LOG.error(ERR_EXECUTE_FAILURE, e);
        throw new SearchCommandException(e);

    } catch (MalformedURLException e) {
        LOG.error(ERR_EXECUTE_FAILURE, e);
        throw new SearchCommandException(e);
    }
}