/** * 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; } }
/** * 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; } }
/** * 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; } }
/** * 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(); } }
/** * 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(); } }
/** * 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();
if (((BrowseFileTransferException) t).getErrorCode() == 401) throw new AuthenticationFailedException(); IStatus status = ((BrowseFileTransferException) t).getStatus();
if (((BrowseFileTransferException) t).getErrorCode() == 401) throw new AuthenticationFailedException(); IStatus status = ((BrowseFileTransferException) t).getStatus();
if (((BrowseFileTransferException) t).getErrorCode() == 401) throw new AuthenticationFailedException(); IStatus status = ((BrowseFileTransferException) t).getStatus();
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();