@Override protected Object prepareInput(IProgressMonitor pm) { try { ResourceNode ancestor = new ResourceNode(file); String ancestorContent = getContent(ancestor); String leftContent, rightContent; leftContent = this.comparisonFailure.getExpected(); rightContent = this.comparisonFailure.getActual(); if (!leftContent.equals(ancestorContent)) getCompareConfiguration().setProperty(ICompareUIConstants.PROP_ANCESTOR_VISIBLE, Boolean.TRUE); CompareItem left = new EditableCompareItem("Left", leftContent, file); CompareItem right = new CompareItem("Right", rightContent); return new DiffNode(null, Differencer.CHANGE | Differencer.DIRECTION_MASK, ancestor, left, right); } catch (Throwable t) { LOG.error(t.getMessage(), t); Exceptions.throwUncheckedException(t); return null; } }
/** * Parses, validates and compiles the given source. Calls the given acceptor for each * resource which is generated from the source. * * @param resourceSet - the {@link ResourceSet} to use * @param acceptor gets called once for each file generated in {@link IGenerator} */ public void compile(final ResourceSet resourceSet, IAcceptor<Result> acceptor) { try { List<Resource> resourcesToCheck = newArrayList(resourceSet.getResources()); if (generatorConfigProvider instanceof GeneratorConfigProvider) { GeneratorConfigProvider configProvider = (GeneratorConfigProvider) generatorConfigProvider; GeneratorConfig config = generatorConfigProvider.get(null); config.setJavaSourceVersion(javaCompiler.getJavaVersion()); GeneratorConfig existent = configProvider.install(resourceSet, config); if (existent != null) { existent.setJavaSourceVersion(javaCompiler.getJavaVersion()); configProvider.install(resourceSet, existent); } } Result result = resultProvider.get(); result.setJavaCompiler(javaCompiler); result.setCheckMode(getCheckMode()); result.setResources(resourcesToCheck); result.setResourceSet(resourceSet); result.setOutputConfigurations(getOutputConfigurations()); result.doGenerate(); acceptor.accept(result); } catch (Exception e) { Exceptions.throwUncheckedException(e); } }
/** * Parses, validates and compiles the given source. Calls the given acceptor for each * resource which is generated from the source. * * @param resourceSet - the {@link ResourceSet} to use * @param acceptor gets called once for each file generated in {@link IGenerator} */ public void compile(final ResourceSet resourceSet, IAcceptor<Result> acceptor) { try { List<Resource> resourcesToCheck = newArrayList(resourceSet.getResources()); //this.javaCompiler = new OnTheFlyJavaCompiler2(new ClassLoader() {}, JavaVersion.JAVA8); Result result = resultProvider.get(); result.setJavaCompiler(javaCompiler); result.setCheckMode(getCheckMode()); result.setResources(resourcesToCheck); result.setResourceSet(resourceSet); result.setOutputConfigurations(getOutputConfigurations()); result.doGenerate(); acceptor.accept(result); } catch (Exception e) { Exceptions.throwUncheckedException(e); } }
protected void handleInvocationTargetException(Throwable targetException, State state) { // ignore GuardException, check is just not evaluated if guard is false // ignore NullPointerException, as not having to check for NPEs all the time is a convenience feature if (!(targetException instanceof GuardException) && !(targetException instanceof NullPointerException)) Exceptions.throwUncheckedException(targetException); }
public ConflictingRegionsException(String message, Throwable cause, Collection<RegionTrace> traces) { super(message, cause); this.traces = traces; for (RegionTrace trace : traces) Exceptions.addSuppressed(this, trace); }
protected Object handleTextError(Object[] params, Throwable e) { if(e instanceof NullPointerException) { return getDefaultText(); } return Exceptions.throwUncheckedException(e); }
protected Object handleImageError(Object[] params, Throwable e) { if(e instanceof NullPointerException) { return getDefaultImage(); } return Exceptions.throwUncheckedException(e); }
/** * Handles error exceptions from polymorphic text dispatcher. * * @param params * parameters passed by the dispatcher. * @param e * exception encountered by the dispatcher. * @return default text for a null value if exception was a NullPointerException, else wraps and throws exception */ protected String handleTextError(final Object[] params, final Throwable e) { if (e instanceof NullPointerException) { return text(null); } return Exceptions.throwUncheckedException(e); }