protected long getWaitInterval(Throwable exception, SubMonitor monitor) throws CoreException { if (exception instanceof CoreException) { exception = ((CoreException) exception).getCause(); } if (exception instanceof CloudFoundryException && CloudErrorUtil.isAppStoppedStateError((CloudFoundryException) exception)) { return CloudOperationsConstants.ONE_SECOND_INTERVAL; } return -1; }
protected long getWaitInterval(Throwable exception, SubMonitor monitor) throws CoreException { if (exception instanceof CoreException) { exception = ((CoreException) exception).getCause(); } if (exception instanceof NotFinishedStagingException) { return CloudOperationsConstants.ONE_SECOND_INTERVAL * 2; } else if (exception instanceof CloudFoundryException && CloudErrorUtil.isAppStoppedStateError((CloudFoundryException) exception)) { return CloudOperationsConstants.ONE_SECOND_INTERVAL; } return -1; }
private void ensureOpened() throws IOException { if (actual != null) return; if (target == null) throw new FileNotFoundException(); try { actual = target.openInputStream(EFS.NONE, null); } catch (CoreException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e.getMessage()); } }
private void ensureOpened() throws IOException { if (actual != null) return; if (target == null) throw new FileNotFoundException(); try { actual = target.openInputStream(EFS.NONE, null); } catch (CoreException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e.getMessage()); } }
private void ensureOpened() throws IOException { if (actual != null) return; if (target == null) throw new FileNotFoundException(); try { actual = target.openInputStream(EFS.NONE, null); } catch (CoreException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e.getMessage()); } }
protected static void handleServiceUnavailable(CoreException e) throws ServiceUnavailableException { if (e.getStatus().getCode() == 1002) { Throwable cause = e.getCause(); if (cause != null && cause.getMessage() != null && cause.getMessage().indexOf("503") != -1) { //$NON-NLS-1$ throw new ServiceUnavailableException(new Status(IStatus.ERROR, MarketplaceClientCore.BUNDLE_ID, 503, Messages.DefaultMarketplaceService_serviceUnavailable503, e)); } } }
public News news(IProgressMonitor monitor) throws CoreException { try { Marketplace marketplace = processRequest(API_NEWS_URI + '/' + API_URI_SUFFIX, false, monitor); return marketplace.getNews(); } catch (CoreException ex) { final Throwable cause = ex.getCause(); if (cause instanceof FileNotFoundException) { // optional news API not supported return null; } throw ex; } }
public static boolean isWrongCredentialsException(CoreException e) { Throwable cause = e.getCause(); if (cause instanceof HttpClientErrorException) { HttpClientErrorException httpException = (HttpClientErrorException) cause; HttpStatus statusCode = httpException.getStatusCode(); if (statusCode.equals(HttpStatus.FORBIDDEN) && httpException instanceof CloudFoundryException) { return ((CloudFoundryException) httpException).getDescription().equals("Operation not permitted"); //$NON-NLS-1$ } } return false; }
/** * Handles the exception thrown from JDT Core when the attached Javadoc * cannot be retrieved due to accessibility issues or location URL issue. This exception is not * logged but the exceptions occurred due to other reasons are logged. * * @param e the exception thrown when retrieving the Javadoc fails * @return the String message for why the Javadoc could not be retrieved * @since 3.9 */ public static String handleFailedJavadocFetch(CoreException e) { IStatus status= e.getStatus(); if (JavaCore.PLUGIN_ID.equals(status.getPlugin())) { Throwable cause= e.getCause(); int code= status.getCode(); // See bug 120559, bug 400060 and bug 400062 if (code == IJavaModelStatusConstants.CANNOT_RETRIEVE_ATTACHED_JAVADOC_TIMEOUT || (code == IJavaModelStatusConstants.CANNOT_RETRIEVE_ATTACHED_JAVADOC && (cause instanceof FileNotFoundException || cause instanceof SocketException || cause instanceof UnknownHostException || cause instanceof ProtocolException))) return CorextMessages.JavaDocLocations_error_gettingAttachedJavadoc; } JavaPlugin.log(e); return CorextMessages.JavaDocLocations_error_gettingJavadoc; }
/** * Handles the exception thrown from JDT Core when the attached Javadoc * cannot be retrieved due to accessibility issues or location URL issue. This exception is not * logged but the exceptions occurred due to other reasons are logged. * * @param e the exception thrown when retrieving the Javadoc fails * @return the String message for why the Javadoc could not be retrieved * @since 3.9 */ public static String handleFailedJavadocFetch(CoreException e) { IStatus status= e.getStatus(); if (JavaCore.PLUGIN_ID.equals(status.getPlugin())) { Throwable cause= e.getCause(); int code= status.getCode(); // See bug 120559, bug 400060 and bug 400062 if (code == IJavaModelStatusConstants.CANNOT_RETRIEVE_ATTACHED_JAVADOC_TIMEOUT || (code == IJavaModelStatusConstants.CANNOT_RETRIEVE_ATTACHED_JAVADOC && (cause instanceof FileNotFoundException || cause instanceof SocketException || cause instanceof UnknownHostException || cause instanceof ProtocolException))) return CorextMessages.JavaDocLocations_error_gettingAttachedJavadoc; } JavaPlugin.log(e); return CorextMessages.JavaDocLocations_error_gettingJavadoc; }
return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getCause() != null ? e.getCause() : e); } catch (CoreException e) { return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getCause() != null ? e.getCause() : e); } catch (IOException e) { return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e);
public IStatus validateInJob(final IValidationContext helper, final IReporter reporter) throws ValidationException { Job currentJob = Platform.getJobManager().currentJob(); ISchedulingRule rule = null; if (currentJob != null) { rule = currentJob.getRule(); } IWorkspaceRunnable validationRunnable = new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { try { doValidate(helper, reporter); } catch (ValidationException e) { throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID_JSP_CORE, 0, PLUGIN_ID_JSP_CORE, e)); } } }; try { JavaCore.run(validationRunnable, rule, new NullProgressMonitor()); } catch (CoreException e) { if (e.getCause() instanceof ValidationException) { throw (ValidationException) e.getCause(); } throw new ValidationException(new LocalizedMessage(IMessage.ERROR_AND_WARNING, e.getMessage()), e); } return Status.OK_STATUS; } }
if (e.getCause() instanceof ZipException) {
if (e.getCause() instanceof ZipException) {
public SearchResult search(Market market, Category category, String queryText, IProgressMonitor monitor) throws CoreException { SearchResult result = new SearchResult(); String relativeUrl = computeRelativeSearchUrl(market, category, queryText, true); if (relativeUrl == null) { // empty search result.setMatchCount(0); result.setNodes(new ArrayList<Node>()); } else { Marketplace marketplace; try { marketplace = processRequest(relativeUrl, monitor); } catch (CoreException ex) { Throwable cause = ex.getCause(); if (cause instanceof FileNotFoundException) { throw new CoreException(createErrorStatus( Messages.DefaultMarketplaceService_UnsupportedSearchString + queryText, cause)); } throw ex; } Search search = marketplace.getSearch(); if (search == null) { throw new CoreException(createErrorStatus(Messages.DefaultMarketplaceService_unexpectedResponse, null)); } result.setMatchCount(search.getCount()); result.setNodes(search.getNode()); } return result; }
@Override protected IStatus run(IProgressMonitor monitor) { RevCommit commit = null; try { commitOperation.execute(monitor); commit = commitOperation.getCommit(); CommitMessageComponentStateManager.deleteState(repository); RepositoryMapping mapping = RepositoryMapping .findRepositoryMapping(repository); if (mapping != null) mapping.fireRepositoryChanged(); } catch (CoreException e) { if (e.getCause() instanceof JGitInternalException) return Activator.createErrorStatus(e.getLocalizedMessage(), e.getCause()); return Activator.createErrorStatus( UIText.CommitAction_CommittingFailed, e); } finally { GitLightweightDecorator.refresh(); } if (commit != null) { if (openCommitEditor) openCommitEditor(commit); if (pushUpstream) pushUpstream(); } return Status.OK_STATUS; }
if (e.getCause() instanceof ZipException) {
if (e.getCause() instanceof ZipException) {
if (e.getCause() instanceof ZipException) {