Package org.rssowl.core.connection

Examples of org.rssowl.core.connection.ConnectionException


          if (reader != null)
            reader.close();
        }
      }
    } catch (URISyntaxException e) {
      throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
    } catch (IOException e) {
      throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
    }

    return null;
  }
View Full Code Here


      lastArticleId = groupInfo.getLastArticle();
    }

    /* Wrap Exceptions */
    catch (IOException e) {
      throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
    }

    /* Disconnect */
    finally {
      try {
        if (client.isConnected())
          client.disconnect();
      } catch (IOException e) {
        throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
      }
    }

    /* Create Conditional Get Object */
    IConditionalGet conditionalGet = null;
View Full Code Here

  private void throwConnectionException(String msg, NNTPClient client) throws ConnectionException {
    StringBuilder str = new StringBuilder();
    str.append(msg);
    str.append(" (").append(client.getReplyString()).append(")");

    throw new ConnectionException(Activator.getDefault().createErrorStatus(str.toString(), null));
  }
View Full Code Here

      /* Try to pipe the resulting stream into a GZipInputStream */
      if (inS != null)
        inS = pipeStream(inS, method);
    } catch (IOException e) {
      throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
    }

    /* In case authentication required / failed */
    if (method.getStatusCode() == HTTP_ERROR_AUTH_REQUIRED) {
      AuthState hostAuthState = method.getHostAuthState();
      throw new AuthenticationRequiredException(hostAuthState != null ? hostAuthState.getRealm() : null, Activator.getDefault().createErrorStatus(Messages.DefaultProtocolHandler_ERROR_AUTHENTICATION_REQUIRED, null));
    }

    /* In case proxy-authentication required / failed */
    if (method.getStatusCode() == HTTP_ERROR_PROXY_AUTH_REQUIRED)
      throw new ProxyAuthenticationRequiredException(Activator.getDefault().createErrorStatus(Messages.DefaultProtocolHandler_ERROR_PROXY_AUTHENTICATION_REQUIRED, null));

    /* If status code is 4xx, throw an IOException with the status code included */
    if (method.getStatusCode() >= HTTP_ERRORS) {
      String error = getError(method.getStatusCode());
      if (error != null)
        throw new ConnectionException(Activator.getDefault().createErrorStatus(NLS.bind(Messages.DefaultProtocolHandler_ERROR_HTTP_STATUS_MSG, String.valueOf(method.getStatusCode()), error), null));

      throw new ConnectionException(Activator.getDefault().createErrorStatus(NLS.bind(Messages.DefaultProtocolHandler_ERROR_HTTP_STATUS, String.valueOf(method.getStatusCode())), null));
    }

    /* In case the Feed has not been modified since */
    if (method.getStatusCode() == HTTP_STATUS_NOT_MODIFIED)
      throw new NotModifiedException(Activator.getDefault().createInfoStatus(Messages.DefaultProtocolHandler_INFO_NOT_MODIFIED_SINCE, null));

    /* In case response body is not available */
    if (inS == null)
      throw new ConnectionException(Activator.getDefault().createErrorStatus(Messages.DefaultProtocolHandler_ERROR_STREAM_UNAVAILABLE, null));

    /* Check wether a Progress Monitor is provided to support early cancelation */
    IProgressMonitor monitor = null;
    if (properties != null && properties.containsKey(IConnectionPropertyConstants.PROGRESS_MONITOR))
      monitor = (IProgressMonitor) properties.get(IConnectionPropertyConstants.PROGRESS_MONITOR);
View Full Code Here

  private InputStream loadFileProtocol(URI link) throws ConnectionException {
    try {
      File file = new File(link);
      return new BufferedInputStream(new FileInputStream(file));
    } catch (FileNotFoundException e) {
      throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
    }
  }
View Full Code Here

      inS = openConnection(client, getMethod);

      /* Try to pipe the resulting stream into a GZipInputStream */
      inS = pipeStream(inS, getMethod);
    } catch (IOException e) {
      throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
    }

    /* In case authentication required / failed */
    if (getMethod.getStatusCode() == HTTP_ERROR_AUTH_REQUIRED)
      throw new AuthenticationRequiredException(Activator.getDefault().createErrorStatus("Authentication required!", null)); //$NON-NLS-1$

    /* In case proxy-authentication required / failed */
    if (getMethod.getStatusCode() == HTTP_ERROR_PROXY_AUTH_REQUIRED)
      throw new ProxyAuthenticationRequiredException(Activator.getDefault().createErrorStatus("Proxy-Authentication required!", null)); //$NON-NLS-1$

    /* If status code is 4xx, throw an IOException with the status code included */
    if (getMethod.getStatusCode() >= HTTP_ERRORS)
      throw new ConnectionException(Activator.getDefault().createErrorStatus("Server returned HTTP Status " + String.valueOf(getMethod.getStatusCode()), null)); //$NON-NLS-1$

    /* In case the Feed has not been modified since */
    if (getMethod.getStatusCode() == HTTP_STATUS_NOT_MODIFIED)
      throw new NotModifiedException(Activator.getDefault().createInfoStatus("Feed has not been modified since!", null)); //$NON-NLS-1$

    /* In case response body is not available */
    if (inS == null)
      throw new ConnectionException(Activator.getDefault().createErrorStatus("Response Stream is not available!", null)); //$NON-NLS-1$

    /* Check wether a Progress Monitor is provided to support early cancelation */
    IProgressMonitor monitor = null;
    if (properties != null && properties.containsKey(IConnectionPropertyConstants.PROGRESS_MONITOR))
      monitor = (IProgressMonitor) properties.get(IConnectionPropertyConstants.PROGRESS_MONITOR);
View Full Code Here

  private InputStream loadFileProtocol(URI link) throws ConnectionException {
    try {
      File file = new File(link);
      return new BufferedInputStream(new FileInputStream(file));
    } catch (FileNotFoundException e) {
      throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
    }
  }
View Full Code Here

  public InputStream load(URL url, Map<Object, Object> properties) throws ConnectionException {
    try {
      File file = new File(url.toURI());
      return new BufferedInputStream(new FileInputStream(file));
    } catch (URISyntaxException e) {
      throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
    } catch (FileNotFoundException e) {
      throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
    }
  }
View Full Code Here

      lastArticleId = groupInfo.getLastArticle();
    }

    /* Wrap Exceptions */
    catch (IOException e) {
      throw new ConnectionException(Activator.createErrorStatus(e.getMessage(), e));
    }

    /* Disconnect */
    finally {
      try {
        if (client.isConnected())
          client.disconnect();
      } catch (IOException e) {
        throw new ConnectionException(Activator.createErrorStatus(e.getMessage(), e));
      }
    }

    /* Create Conditional Get Object */
    IConditionalGet conditionalGet = null;
View Full Code Here

  private void throwConnectionException(String msg, NNTPClient client) throws ConnectionException {
    StringBuilder str = new StringBuilder();
    str.append(msg);
    str.append(" (").append(client.getReplyString()).append(")"); //$NON-NLS-1$//$NON-NLS-2$

    throw new ConnectionException(Activator.createErrorStatus(str.toString(), null));
  }
View Full Code Here

TOP

Related Classes of org.rssowl.core.connection.ConnectionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.