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:org.forgerock.maven.plugins.LinkTester.java

private void checkUrl(String path, String docUrl) {
    if (shouldSkipUrl(docUrl)) {
        debug("Skipping " + docUrl + " since it matches a skipUrlPattern");
        return;/*  w  ww  .j a  v  a 2s . c  om*/
    }
    if (tested.contains(docUrl)) {
        if (failedUrls.containsValue(docUrl)) {
            failedUrls.put(path, docUrl);
        }
        return;
    }
    debug("Checking " + docUrl + " from file: " + path);
    try {
        URL url = new URL(docUrl);
        URLConnection urlConn = url.openConnection();
        if (urlConn instanceof HttpURLConnection) {
            HttpURLConnection conn = (HttpURLConnection) urlConn;
            if (conn instanceof HttpsURLConnection) {
                HttpsURLConnection httpsConn = (HttpsURLConnection) conn;
                httpsConn.setHostnameVerifier(new TrustAllHostnameVerifier());
                httpsConn.setSSLSocketFactory(TRUST_ALL_SOCKET_FACTORY);
            }

            conn.setConnectTimeout(1000);
            //if we don't get anything back within 15 seconds it is safe to assume that something is really wrong
            //with that site..
            conn.setReadTimeout(15000);
            int responseCode = conn.getResponseCode();
            if (responseCode >= 400) {
                warn(docUrl + ": received unexpected response code: " + responseCode);
                failedUrls.put(path, docUrl);
            }
        }
    } catch (SocketTimeoutException ste) {
        warn(docUrl + ": " + ste.getClass().getName() + " " + ste.getMessage());
        timedOutUrls.put(path, docUrl);
    } catch (Exception ex) {
        warn(docUrl + ": " + ex.getClass().getName() + " " + ex.getMessage());
        failedUrls.put(path, docUrl);
    }
    tested.add(docUrl);
}

From source file:org.proto.led.network.WiFiControllerService.java

void startListenForUDPBroadcast() {
    UDPBroadcastThread = new Thread(new Runnable() {
        public void run() {
            try {
                InetAddress broadcastIP = InetAddress.getByName("192.168.1.101"); //172.16.238.42 //192.168.1.255
                Integer port = 6000;
                while (shouldRestartSocketListen) {
                    try {
                        listenAndWaitAndThrowIntent(broadcastIP, port);

                    } catch (SocketTimeoutException e) {
                        Log.d("UDP", "timeout");
                    }/*  w w  w.ja  v  a  2s  .com*/
                }
                //if (!shouldListenForUDPBroadcast) throw new ThreadDeath();
            } catch (Exception e) {
                Log.i(TAG, "no longer listening for UDP broadcasts cause of error " + e.getMessage());
            }
        }
    });
    UDPBroadcastThread.start();
}

From source file:org.deegree.tile.persistence.remotewmts.RemoteWMTSTile.java

@Override
public FeatureCollection getFeatures(int i, int j, int limit) {
    FeatureCollection fc = null;/*from   w  w  w. jav  a 2 s. co m*/
    try {
        Map<String, String> overriddenParameters = new HashMap<String, String>();
        RequestUtils.replaceParameters(overriddenParameters,
                RequestUtils.getCurrentThreadRequestParameters().get(), defaultGetFeatureInfo,
                hardGetFeatureInfo);
        Operation op = client.getOperations().getOperation("GetFeatureInfo");
        if (op == null) {
            throw new OWSException("The remote WMTS claims not to support GetFeatureInfo.",
                    OPERATION_NOT_SUPPORTED);
        }
        Layer l = client.getLayer(this.request.getLayer());
        String infoformat = null;
        for (String fmt : l.getInfoFormats()) {
            if (fmt.startsWith("application/gml+xml")) {
                // use first gml format found
                infoformat = fmt;
                break;
            }
            if (fmt.startsWith("text/xml")) {
                infoformat = fmt;
                // continue, perhaps a proper gml format is found later on
            }
        }
        if (infoformat == null) {
            throw new OWSException("The remote WMTS does not offer a GML or XML format for this layer.",
                    OPERATION_NOT_SUPPORTED);
        }
        LOG.debug("Selected {} as info format for GFI request.");
        GetFeatureInfo request = new GetFeatureInfo(this.request.getLayer(), this.request.getStyle(),
                infoformat, this.request.getTileMatrixSet(), this.request.getTileMatrix(),
                this.request.getTileRow(), this.request.getTileCol(), i, j, overriddenParameters);
        fc = client.getFeatureInfo(request).getFeatures();
    } catch (SocketTimeoutException e) {
        String msg = "Error performing GetFeatureInfo request, read timed out.";
        throw new TileIOException(msg);
    } catch (UnknownHostException e) {
        throw new TileIOException(
                "Error performing GetFeatureInfo request, host could not be resolved: " + e.getMessage());
    } catch (Exception e) {
        String msg = "Error executing GetFeatureInfo request on remote server: " + e.getMessage();
        throw new RuntimeException(msg, e);
    }
    return fc;
}

From source file:org.apache.manifoldcf.crawler.connectors.webcrawler.DataCache.java

/** Add a data entry into the cache.
* This method is called whenever the data from a fetch is considered interesting or useful, and will
* be thus passed on from getDocumentVersions() to the processDocuments() phase.  At the moment that's
* usually a 200 or a 302 response.//from  w  w  w . j  av a2  s.  c o m
*@param documentIdentifier is the document identifier (url).
*@param connection is the connection, upon which a fetch has been done that needs to be
* cached.
*@return a "checksum" value, to use as a version string.
*/
public String addData(IProcessActivity activities, String documentIdentifier, IThrottledConnection connection)
        throws ManifoldCFException, ServiceInterruption {
    // Grab the response code, and the content-type header
    int responseCode = connection.getResponseCode();
    String contentType = connection.getResponseHeader("Content-Type");
    String referralURI = connection.getResponseHeader("Location");

    // Create a temporary file; that's what we will cache
    try {
        // First, get the stream.
        InputStream dataStream = connection.getResponseBodyStream();
        if (dataStream == null)
            return null;
        try {
            File tempFile = File.createTempFile("_webcache_", "tmp");
            try {
                // Causes memory leaks if left around; there's no way to release
                // the record specifying that the file should be deleted, even
                // after it's removed.  So disable this and live with the occasional
                // dangling file left as a result of shutdown or error. :-(
                // tempFile.deleteOnExit();
                ManifoldCF.addFile(tempFile);

                // Transfer data to temporary file
                long checkSum = 0L;
                OutputStream os = new FileOutputStream(tempFile);
                try {
                    byte[] byteArray = new byte[65536];
                    while (true) {
                        int amt;
                        try {
                            amt = dataStream.read(byteArray, 0, byteArray.length);
                        } catch (java.net.SocketTimeoutException e) {
                            Logging.connectors.warn(
                                    "Socket timeout exception reading socket stream: " + e.getMessage(), e);
                            long currentTime = System.currentTimeMillis();
                            throw new ServiceInterruption("Socket timeout: " + e.getMessage(), e,
                                    currentTime + 300000L, currentTime + 12 * 60 * 60000L, -1, false);
                        } catch (ConnectTimeoutException e) {
                            Logging.connectors.warn(
                                    "Socket connect timeout exception reading socket stream: " + e.getMessage(),
                                    e);
                            long currentTime = System.currentTimeMillis();
                            throw new ServiceInterruption("Socket timeout: " + e.getMessage(), e,
                                    currentTime + 300000L, currentTime + 12 * 60 * 60000L, -1, false);
                        } catch (InterruptedIOException e) {
                            //Logging.connectors.warn("IO interruption seen",e);
                            throw new ManifoldCFException("Interrupted: " + e.getMessage(),
                                    ManifoldCFException.INTERRUPTED);
                        } catch (IOException e) {
                            Logging.connectors.warn("IO exception reading socket stream: " + e.getMessage(), e);
                            long currentTime = System.currentTimeMillis();
                            throw new ServiceInterruption("Read timeout: " + e.getMessage(), e,
                                    currentTime + 300000L, currentTime + 12 * 60 * 60000L, -1, false);
                        }
                        if (amt == -1)
                            break;
                        int i = 0;
                        while (i < amt) {
                            byte x = byteArray[i++];
                            long bytevalue = (long) x;
                            checkSum = (checkSum << 5) ^ (checkSum >> 3) ^ (bytevalue << 2) ^ (bytevalue >> 3);
                        }

                        os.write(byteArray, 0, amt);
                        // Check if job is alive before looping
                        activities.checkJobStillActive();
                    }
                } finally {
                    os.close();
                }

                synchronized (this) {
                    deleteData(documentIdentifier);
                    cacheData.put(documentIdentifier,
                            new DocumentData(tempFile, responseCode, contentType, referralURI));
                    return new Long(checkSum).toString();
                }

            } catch (IOException e) {
                ManifoldCF.deleteFile(tempFile);
                throw e;
            } catch (ManifoldCFException e) {
                ManifoldCF.deleteFile(tempFile);
                throw e;
            } catch (ServiceInterruption e) {
                ManifoldCF.deleteFile(tempFile);
                throw e;
            } catch (Error e) {
                ManifoldCF.deleteFile(tempFile);
                throw e;
            }
        } finally {
            try {
                dataStream.close();
            } catch (java.net.SocketTimeoutException e) {
                Logging.connectors.warn(
                        "WEB: Socket timeout exception closing data stream, ignoring: " + e.getMessage(), e);
            } catch (ConnectTimeoutException e) {
                Logging.connectors.warn("WEB: Socket connect timeout exception closing data stream, ignoring: "
                        + e.getMessage(), e);
            } catch (InterruptedIOException e) {
                throw e;
            } catch (IOException e) {
                // We can get this if the socket was unexpectedly closed by the server; treat this
                // as a Service Interruption.  Generally, this is ok - warn but don't do anything else.
                Logging.connectors.warn("WEB: IO exception closing data stream, ignoring: " + e.getMessage(),
                        e);
            }
        }
    } catch (java.net.SocketTimeoutException e) {
        throw new ManifoldCFException("Socket timeout exception creating temporary file: " + e.getMessage(), e);
    } catch (ConnectTimeoutException e) {
        throw new ManifoldCFException(
                "Socket connect timeout exception creating temporary file: " + e.getMessage(), e);
    } catch (InterruptedIOException e) {
        //Logging.connectors.warn("IO interruption seen",e);
        throw new ManifoldCFException("Interrupted: " + e.getMessage(), ManifoldCFException.INTERRUPTED);
    } catch (IOException e) {
        throw new ManifoldCFException("IO exception creating temporary file: " + e.getMessage(), e);
    }
}

From source file:org.rhq.modules.plugins.jbossas7.ASConnection.java

/**
 * Execute an operation against the domain api. This method is doing the
 * real work by talking to the remote server and sending JSON data, that
 * is obtained by serializing the operation.
 *
 * Please do not use this API , but execute()
 * @return JsonNode that describes the result
 * @param operation an Operation that should be run on the domain controller
 * @see #execute(org.rhq.modules.plugins.jbossas7.json.Operation)
 * @see #execute(org.rhq.modules.plugins.jbossas7.json.Operation, boolean)
 * @see #executeComplex(org.rhq.modules.plugins.jbossas7.json.Operation)
 *///from  w w  w.j  a  va 2 s.  c om
public JsonNode executeRaw(Operation operation) {

    InputStream inputStream = null;
    BufferedReader br = null;
    InputStream es = null;
    HttpURLConnection conn = null;
    long t1 = System.currentTimeMillis();
    try {
        conn = (HttpURLConnection) url.openConnection();
        conn.setDoOutput(true);
        conn.setRequestMethod("POST");
        conn.addRequestProperty("Content-Type", "application/json");
        conn.addRequestProperty("Accept", "application/json");
        conn.setConnectTimeout(10 * 1000); // 10s
        conn.setReadTimeout(10 * 1000); // 10s

        if (conn.getReadTimeout() != 10 * 1000)
            log.warn("JRE uses a broken timeout mechanism - nothing we can do");

        OutputStream out = conn.getOutputStream();

        String json_to_send = mapper.writeValueAsString(operation);

        //check for spaces in the path which the AS7 server will reject. Log verbose error and
        // generate failure indicator.
        if ((operation != null) && (operation.getAddress() != null)
                && operation.getAddress().getPath() != null) {
            if (containsSpaces(operation.getAddress().getPath())) {
                Result noResult = new Result();
                String outcome = "- Path '" + operation.getAddress().getPath()
                        + "' in invalid as it cannot contain spaces -";
                if (verbose) {
                    log.error(outcome);
                }
                noResult.setFailureDescription(outcome);
                noResult.setOutcome("failure");
                JsonNode invalidPathResult = mapper.valueToTree(noResult);
                return invalidPathResult;
            }
        }

        if (verbose) {
            log.info("Json to send: " + json_to_send);
        }

        mapper.writeValue(out, operation);

        out.flush();
        out.close();

        int responseCode = conn.getResponseCode();
        if (responseCode == HttpURLConnection.HTTP_OK) {
            inputStream = conn.getInputStream();
        } else {
            inputStream = conn.getErrorStream();
        }

        if (inputStream != null) {

            br = new BufferedReader(new InputStreamReader(inputStream));
            String line;
            StringBuilder builder = new StringBuilder();
            while ((line = br.readLine()) != null) {
                builder.append(line);
            }

            String outcome;
            JsonNode operationResult;
            if (builder.length() > 0) {
                outcome = builder.toString();
                operationResult = mapper.readTree(outcome);
                if (verbose) {
                    ObjectMapper om2 = new ObjectMapper();
                    om2.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
                    String tmp = om2.writeValueAsString(operationResult);
                    log.info(tmp);
                }
            } else {
                outcome = "- no response from server -";
                Result noResult = new Result();
                noResult.setFailureDescription(outcome);
                noResult.setOutcome("failure");
                operationResult = mapper.valueToTree(noResult);
            }
            return operationResult;
        } else {
            //if not properly authorized sends plugin exception for visual indicator in the ui.
            if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED
                    || responseCode == HttpURLConnection.HTTP_BAD_METHOD) {
                if (log.isDebugEnabled()) {
                    log.debug("[" + url + "] Response was empty and response code was " + responseCode + " "
                            + conn.getResponseMessage() + ".");
                }
                throw new InvalidPluginConfigurationException(
                        "Credentials for plugin to connect to AS7 management interface are invalid. Update Connection Settings with valid credentials.");
            } else {
                log.error("[" + url + "] Response was empty and response code was " + responseCode + " "
                        + conn.getResponseMessage() + ".");
            }
        }
    } catch (IllegalArgumentException iae) {
        log.error("Illegal argument " + iae);
        log.error("  for input " + operation);
    } catch (SocketTimeoutException ste) {
        log.error("Request to AS timed out " + ste.getMessage());
        conn.disconnect();
        Result failure = new Result();
        failure.setFailureDescription(ste.getMessage());
        failure.setOutcome("failure");
        failure.setRhqThrowable(ste);

        JsonNode ret = mapper.valueToTree(failure);
        return ret;

    } catch (IOException e) {
        log.error("Failed to get data: " + e.getMessage());

        //the following code is in place to help keep-alive http connection re-use to occur.
        if (conn != null) {//on error conditions it's still necessary to read the response so JDK knows can reuse
            //the http connections behind the scenes.
            es = conn.getErrorStream();
            if (es != null) {
                BufferedReader dr = new BufferedReader(new InputStreamReader(es));
                String ignore = null;
                try {
                    while ((ignore = dr.readLine()) != null) {
                        //already reported error. just empty stream.
                    }
                    es.close();
                } catch (IOException e1) {
                    // ignore
                }
            }
        }

        Result failure = new Result();
        failure.setFailureDescription(e.getMessage());
        failure.setOutcome("failure");
        failure.setRhqThrowable(e);

        JsonNode ret = mapper.valueToTree(failure);
        return ret;

    } finally {
        if (br != null) {
            try {
                br.close();
            } catch (IOException e) {
                log.error(e.getMessage());
            }
        }
        if (es != null) {
            try {
                es.close();
            } catch (IOException e) {
                log.error(e.getMessage());
            }
        }
        long t2 = System.currentTimeMillis();
        PluginStats stats = PluginStats.getInstance();
        stats.incrementRequestCount();
        stats.addRequestTime(t2 - t1);
    }

    return null;
}

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

/**
 * Send command to the server.//from w w w  . j  a v  a  2 s.com
 * 
 * @param msg
 *            an unterminated command
 * @return the reply string.
 * @throws DeviceException
 */
public String processCommand(String msg) throws DeviceException {
    String command = msg + '\r';
    String reply = null;
    logger.debug(getName() + ": sent command: |" + msg + "|");
    synchronized (socketAccessLock) {
        if (!isConnected()) {
            throw new DeviceException("not connected");
        }
        try {
            cleanPipe();
            socketChannel.write(encoder.encode(CharBuffer.wrap(command)));
            bb.clear();
            socketChannel.read(bb);
            bb.flip();
            reply = decoder.decode(bb).toString();
            logger.debug(getName() + ": got reply: |" + reply.trim() + "|");
        } catch (SocketTimeoutException ex) {
            throw new DeviceException("sendCommand read timeout " + ex.getMessage(), ex);
        } catch (IOException ex) {
            connected = false;
            throw new DeviceException("sendCommand: " + ex.getMessage(), ex);
        }
    }
    return reply;
}

From source file:org.odk.collect.android.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 w  w .j  av 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);

            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)));
            }

            if (fd.manifestUrl != null) {
                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;
                    }
                }
            } else {
                // TODO: manifest was null?
                Log.e(t, "Manifest was null.  PANIC");
            }
        } catch (SocketTimeoutException se) {
            se.printStackTrace();
            message += se.getMessage();
        } catch (Exception e) {
            e.printStackTrace();
            message += e.getMessage();
        }
        count++;
        if (message.equalsIgnoreCase("")) {
            message = Collect.getInstance().getString(R.string.success);
        }
        result.put(fd.formName, message);
    }

    return result;
}

From source file:org.deegree.tile.persistence.remotewms.RemoteWMSTile.java

@Override
public InputStream getAsStream() throws TileIOException {
    try {/* w w w  .ja  va 2 s.c  o m*/
        InputStream map = client.getMap(gm);

        if (map == null) {
            throw new TileIOException("A tile could not be fetched from remote WMS for an unknown reason.");
        }

        if (outputFormat != null) {
            BufferedImage img = ImageIO.read(map);
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            ImageIO.write(img, outputFormat, out);
            out.close();
            return new ByteArrayInputStream(out.toByteArray());
        }
        return map;
    } catch (SocketTimeoutException e) {
        String msg = "Error performing GetMap request, read timed out (timeout configured is "
                + client.getReadTimeout() + " seconds).";
        throw new TileIOException(msg);
    } catch (UnknownHostException e) {
        throw new TileIOException(
                "Error performing GetMap request, host could not be resolved: " + e.getMessage());
    } catch (IOException e) {
        throw new TileIOException("Error performing GetMap request: " + e.getMessage(), e);
    } catch (OWSException e) {
        throw new TileIOException("Error performing GetMap request: " + e.getMessage(), e);
    }
}

From source file:com.mpower.mintel.android.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 {/*from   w  w  w . j av  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);

            String[] projection = { FormsColumns._ID, FormsColumns.FORM_FILE_PATH };
            String[] selectionArgs = { dl.getAbsolutePath() };
            String selection = FormsColumns.FORM_FILE_PATH + "=?";
            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
                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 = MIntel.getInstance().getContentResolver().insert(FormsColumns.CONTENT_URI, v);
            } else {
                alreadyExists.moveToFirst();
                uri = Uri.withAppendedPath(FormsColumns.CONTENT_URI,
                        alreadyExists.getString(alreadyExists.getColumnIndex(FormsColumns._ID)));
            }

            if (fd.manifestUrl != null) {
                Cursor c = MIntel.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;
                    }
                }
            } else {
                // TODO: manifest was null?
                Log.e(t, "Manifest was null.  PANIC");
            }
        } catch (SocketTimeoutException se) {
            se.printStackTrace();
            message += se.getMessage();
        } catch (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:org.deegree.tile.persistence.remotewms.RemoteWMSTile.java

@Override
public FeatureCollection getFeatures(int i, int j, int limit) {
    FeatureCollection fc = null;/*from  ww w  .java 2  s .c o m*/
    try {
        List<String> layers = new ArrayList<String>();
        for (LayerRef layerRef : gm.getLayers()) {
            layers.add(layerRef.getName());
        }
        int width = gm.getWidth();
        int height = gm.getHeight();
        Envelope bbox = gm.getBoundingBox();
        ICRS crs = gm.getCoordinateSystem();
        GetFeatureInfo request = new GetFeatureInfo(layers, width, height, i, j, bbox, crs, limit);
        Map<String, String> overriddenParameters = new HashMap<String, String>();
        RequestUtils.replaceParameters(overriddenParameters,
                RequestUtils.getCurrentThreadRequestParameters().get(), defaultGetFeatureInfo,
                hardGetFeatureInfo);
        fc = client.doGetFeatureInfo(request, overriddenParameters);
    } catch (SocketTimeoutException e) {
        String msg = "Error performing GetFeatureInfo request, read timed out (timeout configured is "
                + client.getReadTimeout() + " seconds).";
        throw new TileIOException(msg);
    } catch (UnknownHostException e) {
        throw new TileIOException(
                "Error performing GetFeatureInfo request, host could not be resolved: " + e.getMessage());
    } catch (Exception e) {
        String msg = "Error executing GetFeatureInfo request on remote server: " + e.getMessage();
        throw new RuntimeException(msg, e);
    }
    return fc;
}