@Override public boolean error(final Message message, final Throwable throwable) { // The *real* Throwable is wrapped in an InvocationTargetException when ran as a Unit Test and invoked with Reflection. final Throwable _throwable = (throwable.getCause() == null ? throwable : throwable.getCause()); if (_throwable instanceof GAVAlreadyExistsException) { final GAVAlreadyExistsException gae = (GAVAlreadyExistsException) _throwable; conflictingRepositoriesPopup.setContent(gae.getGAV(), gae.getRepositories(), new Command() { @Override public void execute() { conflictingRepositoriesPopup.hide(); doRepositoryStructureInitialization(DeploymentMode.FORCED); } }); conflictingRepositoriesPopup.show(); return true; } else { return super.error(message, _throwable); } } }).initRepositoryStructure(view.getDataPresenterGav(),
final GAVAlreadyExistsException gae = (GAVAlreadyExistsException) _throwable; conflictingRepositoriesPopup.setContent(gae.getGAV(), gae.getRepositories(), new Command() { @Override
private void showConflictingRepositoriesPopup(final GAVAlreadyExistsException parameter, final Command command) { final Set<MavenRepositoryMetadata> repositories = parameter.getRepositories(); view.hideBusyIndicator(); conflictingRepositoriesPopup.setContent(projectGAV(), repositories, command); conflictingRepositoriesPopup.show(); }
Promise<Void> handlePomConcurrentUpdate(final String comment, final Supplier<Promise<Void>> saveChain, final GAVAlreadyExistsException exception) { view.hideBusyIndicator(); conflictingRepositoriesPopup.setContent( model.getPOM().getGav(), exception.getRepositories(), () -> forceSave(comment, saveChain)); conflictingRepositoriesPopup.show(); return promises.reject(sectionManager.getCurrentSection()); }
private Map<Class<? extends Throwable>, CommandWithThrowable> saveErrorCallbackConfig(final String commitMessage) { return new HashMap<Class<? extends Throwable>, CommandWithThrowable>() {{ put(GAVAlreadyExistsException.class, t -> { view.hideBusyIndicator(); final GAVAlreadyExistsException e = (GAVAlreadyExistsException) t; conflictingRepositoriesPopup.setContent(e.getGAV(), e.getRepositories(), () -> { conflictingRepositoriesPopup.hide(); doSave(commitMessage, FORCED); }); conflictingRepositoriesPopup.show(); }); put(InvalidPomException.class, t -> { view.hideBusyIndicator(); final InvalidPomException e = (InvalidPomException) t; final String message = translationService.format(LibraryConstants.InvalidPom, e.getLineNumber(), e.getColumnNumber()); notificationEvent.fire(new NotificationEvent(message, ERROR)); }); }}; } }
private ErrorCallback<?> getErrorCallback() { Map<Class<? extends Throwable>, CommandWithThrowableDrivenErrorCallback.CommandWithThrowable> errors = new HashMap<Class<? extends Throwable>, CommandWithThrowableDrivenErrorCallback.CommandWithThrowable>() {{ put(GAVAlreadyExistsException.class, parameter -> { GAVAlreadyExistsException exception = (GAVAlreadyExistsException) parameter; endProjectCreation(); conflictingRepositoriesPopup.setContent(exception.getGAV(), ((GAVAlreadyExistsException) parameter).getRepositories(), () -> { conflictingRepositoriesPopup.hide(); createProject(DeploymentMode.FORCED); }); conflictingRepositoriesPopup.show(); }); put(FileAlreadyExistsException.class, parameter -> { endProjectCreation(); view.showError(view.getDuplicatedProjectMessage()); }); }}; return createErrorCallback(errors); }
/** * Test the case when a VALIDATED deployment is about to be performed, the module is deployed, and the module * version is a non snapshot. */ @Test public void testVerifyAlreadyDeployedValidatedNonSNAPSHOT() { prepareProjectIsDeployed(true); when(gav.isSnapshot()).thenReturn(false); try { deploymentVerifier.verifyWithException(module, DeploymentMode.VALIDATED); } catch (Exception e) { exception = e; } assertNotNull(exception); assertTrue(exception instanceof GAVAlreadyExistsException); assertEquals(gav, ((GAVAlreadyExistsException) exception).getGAV()); assertEquals(repositories, ((GAVAlreadyExistsException) exception).getRepositories()); }
GAVAlreadyExistsException gae = gaeOpt.get(); result.setStatus(JobStatus.DUPLICATE_RESOURCE); result.setResult("Project's GAV [" + gae.getGAV() + "] already exists at [" + toString(gae.getRepositories()) + "]"); } else { List<String> errorResult = new ArrayList<>();
} catch (GAVAlreadyExistsException gae) { result.setStatus(JobStatus.DUPLICATE_RESOURCE); result.setResult("Project's GAV [" + gae.getGAV().toString() + "] already exists at [" + toString(gae.getRepositories()) + "]"); return result; } catch (org.uberfire.java.nio.file.FileAlreadyExistsException e) {
GAVAlreadyExistsException.class).orElseThrow(() -> ex); result.setStatus(JobStatus.DUPLICATE_RESOURCE); result.setResult("Project's GAV [" + gae.getGAV() + "] already exists at [" + toString(gae.getRepositories()) + "]"); return result;