throw new BrowseFileTransferException(NLS.bind("File not found: {0}", directoryOrFile.toString()), code); //$NON-NLS-1$ } else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) { throw new BrowseFileTransferException("Unauthorized", code); //$NON-NLS-1$ } else if (code == HttpURLConnection.HTTP_FORBIDDEN) { throw new BrowseFileTransferException("Forbidden", code); //$NON-NLS-1$ } else if (code == HttpURLConnection.HTTP_PROXY_AUTH) { throw new BrowseFileTransferException("Proxy auth required", code); //$NON-NLS-1$ } else { throw new BrowseFileTransferException(NLS.bind("General connection error with response code={0}", new Integer(code)), code); //$NON-NLS-1$ throw new IncomingFileTransferException(NLS.bind("File not found: {0}", directoryOrFile.toString()), 404); //$NON-NLS-1$ } catch (Exception e) { Exception except = (e instanceof BrowseFileTransferException) ? e : new BrowseFileTransferException(NLS.bind("Could not connect to {0}", directoryOrFile), e, code); //$NON-NLS-1$ throw except;
/** * Translates exceptions representing "FileNotFound" into FileNotFoundException. * @param t the throwable to check * @param toDownload the URI the exception was thrown for * @throws FileNotFoundException if 't' represents a file not found */ public static void checkFileNotFound(Throwable t, URI toDownload) throws FileNotFoundException { if (t instanceof IncomingFileTransferException) { IncomingFileTransferException e = (IncomingFileTransferException) t; if (e.getErrorCode() == 404 || e.getErrorCode() == 403 || e.getErrorCode() == 300) throw new FileNotFoundException(toDownload.toString()); } if (t instanceof BrowseFileTransferException) { BrowseFileTransferException e = (BrowseFileTransferException) t; if (e.getErrorCode() == 404 || e.getErrorCode() == 403 || e.getErrorCode() == 300) throw new FileNotFoundException(toDownload.toString()); } if (t instanceof FileNotFoundException) throw (FileNotFoundException) t; if (t instanceof CoreException) { IStatus status = ((CoreException) t).getStatus(); Throwable e = status == null ? null : status.getException(); if (e instanceof FileNotFoundException) throw (FileNotFoundException) e; } }
if (((BrowseFileTransferException) t).getErrorCode() == 401) throw new AuthenticationFailedException(); IStatus status = ((BrowseFileTransferException) t).getStatus(); t = status == null ? t : status.getException();
/** * Translates exceptions representing "FileNotFound" into FileNotFoundException. * @param t the throwable to check * @param toDownload the URI the exception was thrown for * @throws FileNotFoundException if 't' represents a file not found */ public static void checkFileNotFound(Throwable t, URI toDownload) throws FileNotFoundException { if (t instanceof IncomingFileTransferException) { IncomingFileTransferException e = (IncomingFileTransferException) t; if (e.getErrorCode() == 404 || e.getErrorCode() == 403 || e.getErrorCode() == 300) throw new FileNotFoundException(toDownload.toString()); } if (t instanceof BrowseFileTransferException) { BrowseFileTransferException e = (BrowseFileTransferException) t; if (e.getErrorCode() == 404 || e.getErrorCode() == 403 || e.getErrorCode() == 300) throw new FileNotFoundException(toDownload.toString()); } if (t instanceof FileNotFoundException) throw (FileNotFoundException) t; if (t instanceof CoreException) { IStatus status = ((CoreException) t).getStatus(); Throwable e = status == null ? null : status.getException(); if (e instanceof FileNotFoundException) throw (FileNotFoundException) e; } }
if (((BrowseFileTransferException) t).getErrorCode() == 401) throw new AuthenticationFailedException(); IStatus status = ((BrowseFileTransferException) t).getStatus(); t = status == null ? t : status.getException();
throw new BrowseFileTransferException("HttpClient Provider is not configured to support NTLM proxy authentication.", HttpClientOptions.NTLM_PROXY_RESPONSE_CODE); //$NON-NLS-1$ throw new BrowseFileTransferException("HttpClient Provider does not support the use of SPNEGO proxy authentication."); //$NON-NLS-1$ throw new BrowseFileTransferException(NLS.bind("File not found: {0}", urlString), code); //$NON-NLS-1$ } else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) { throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Unauthorized, code); } else if (code == HttpURLConnection.HTTP_FORBIDDEN) { throw new BrowseFileTransferException("Forbidden", code); //$NON-NLS-1$ } else if (code == HttpURLConnection.HTTP_PROXY_AUTH) { throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required, code); } else { throw new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE, new Integer(code)), code); } catch (Exception e) { Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, this.getClass(), "runRequest", e); //$NON-NLS-1$ BrowseFileTransferException ex = (BrowseFileTransferException) ((e instanceof BrowseFileTransferException) ? e : new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT, urlString), e, code)); throw ex;
/** * Translates exceptions representing "FileNotFound" into FileNotFoundException. * @param t the throwable to check * @param toDownload the URI the exception was thrown for * @throws FileNotFoundException if 't' represents a file not found */ public static void checkFileNotFound(Throwable t, URI toDownload) throws FileNotFoundException { if (t instanceof IncomingFileTransferException) { IncomingFileTransferException e = (IncomingFileTransferException) t; if (e.getErrorCode() == 404 || e.getErrorCode() == 403 || e.getErrorCode() == 300) throw new FileNotFoundException(toDownload.toString()); } if (t instanceof BrowseFileTransferException) { BrowseFileTransferException e = (BrowseFileTransferException) t; if (e.getErrorCode() == 404 || e.getErrorCode() == 403 || e.getErrorCode() == 300) throw new FileNotFoundException(toDownload.toString()); } if (t instanceof FileNotFoundException) throw (FileNotFoundException) t; if (t instanceof CoreException) { IStatus status = ((CoreException) t).getStatus(); Throwable e = status == null ? null : status.getException(); if (e instanceof FileNotFoundException) throw (FileNotFoundException) e; } }
if (((BrowseFileTransferException) t).getErrorCode() == 401) throw new AuthenticationFailedException(); IStatus status = ((BrowseFileTransferException) t).getStatus(); t = status == null ? t : status.getException();
throw new BrowseFileTransferException("HttpClient Provider is not configured to support NTLM proxy authentication.", HttpClientOptions.NTLM_PROXY_RESPONSE_CODE); //$NON-NLS-1$ throw new BrowseFileTransferException("HttpClient Provider does not support the use of SPNEGO proxy authentication."); //$NON-NLS-1$ throw new BrowseFileTransferException(NLS.bind("File not found: {0}", urlString), code); //$NON-NLS-1$ } else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) { throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Unauthorized, code); } else if (code == HttpURLConnection.HTTP_FORBIDDEN) { throw new BrowseFileTransferException("Forbidden", code); //$NON-NLS-1$ } else if (code == HttpURLConnection.HTTP_PROXY_AUTH) { throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required, code); } else { throw new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE, new Integer(code)), code); } catch (Exception e) { Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, this.getClass(), "runRequest", e); //$NON-NLS-1$ BrowseFileTransferException ex = (BrowseFileTransferException) ((e instanceof BrowseFileTransferException) ? e : new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT, urlString), e, code)); throw ex;
/** * Check if the given exception represents that a switch to the JRE HTTP Client * is required. ECF sets the HTTP status code 477 to indicate this. * If the JRE HTTP client is required a JREHttpClientRequiredException is thrown. */ public static void checkJREHttpClientRequired(Throwable t) throws JREHttpClientRequiredException { if (t instanceof IncomingFileTransferException) { if (((IncomingFileTransferException) t).getErrorCode() == 477) throw new JREHttpClientRequiredException(); } else if (t instanceof BrowseFileTransferException) { if (((BrowseFileTransferException) t).getErrorCode() == 477) throw new JREHttpClientRequiredException(); } }
throw new BrowseFileTransferException("HttpClient Provider does not support the use of SPNEGO proxy authentication."); //$NON-NLS-1$
/** * Check if the given exception represents that a switch to the JRE HTTP Client * is required. ECF sets the HTTP status code 477 to indicate this. * If the JRE HTTP client is required a JREHttpClientRequiredException is thrown. */ public static void checkJREHttpClientRequired(Throwable t) throws JREHttpClientRequiredException { if (t instanceof IncomingFileTransferException) { if (((IncomingFileTransferException) t).getErrorCode() == 477) throw new JREHttpClientRequiredException(); } else if (t instanceof BrowseFileTransferException) { if (((BrowseFileTransferException) t).getErrorCode() == 477) throw new JREHttpClientRequiredException(); } }
throw new BrowseFileTransferException("HttpClient Provider does not support the use of SPNEGO proxy authentication."); //$NON-NLS-1$
/** * Check if the given exception represents that a switch to the JRE HTTP Client * is required. ECF sets the HTTP status code 477 to indicate this. * If the JRE HTTP client is required a JREHttpClientRequiredException is thrown. */ public static void checkJREHttpClientRequired(Throwable t) throws JREHttpClientRequiredException { if (t instanceof IncomingFileTransferException) { if (((IncomingFileTransferException) t).getErrorCode() == 477) throw new JREHttpClientRequiredException(); } else if (t instanceof BrowseFileTransferException) { if (((BrowseFileTransferException) t).getErrorCode() == 477) throw new JREHttpClientRequiredException(); } }
code = ((IncomingFileTransferException) t).getErrorCode(); else if (t instanceof BrowseFileTransferException) code = ((BrowseFileTransferException) t).getErrorCode();
code = ((IncomingFileTransferException) t).getErrorCode(); else if (t instanceof BrowseFileTransferException) code = ((BrowseFileTransferException) t).getErrorCode();
code = ((IncomingFileTransferException) t).getErrorCode(); else if (t instanceof BrowseFileTransferException) code = ((BrowseFileTransferException) t).getErrorCode();
code = ((IncomingFileTransferException) t).getErrorCode(); else if (t instanceof BrowseFileTransferException) code = ((BrowseFileTransferException) t).getErrorCode();
code = ((IncomingFileTransferException) t).getErrorCode(); else if (t instanceof BrowseFileTransferException) code = ((BrowseFileTransferException) t).getErrorCode();
code = ((IncomingFileTransferException) t).getErrorCode(); else if (t instanceof BrowseFileTransferException) code = ((BrowseFileTransferException) t).getErrorCode();