List of usage examples for org.eclipse.jgit.util.io ThrowingPrintWriter ThrowingPrintWriter
public ThrowingPrintWriter(Writer out)
From source file:org.eclipse.emf.compare.git.pgm.internal.cmd.AbstractLogicalCommand.java
License:Open Source License
/** * Builds this command.//from www . j ava 2s .c o m * * @param args * The arguments for this command. * @param environmentSetupURI * URI to the environment setup file. * @throws Die * exception on error. * @throws IOException */ public void build(Collection<String> args, URI environmentSetupURI) throws Die, IOException { repo = parseArgumentsAndBuildRepo(args); try { final String outputEncoding; if (repo != null) { outputEncoding = repo.getConfig().getString("i18n", null, "logOutputEncoding"); //$NON-NLS-1$ //$NON-NLS-2$ } else { outputEncoding = null; } BufferedWriter outbufw; if (outputEncoding != null) { outbufw = new BufferedWriter(new OutputStreamWriter(System.out, outputEncoding)); } else { outbufw = new BufferedWriter(new OutputStreamWriter(System.out)); } out = new ThrowingPrintWriter(outbufw); } catch (IOException e) { throw new DiesOn(SOFTWARE_ERROR).displaying("Cannot create input stream").ready(); } if (!help) { try { // Loads eclipse environment setup model. performer = createSetupTaskPerformer(setupFile.getAbsolutePath(), environmentSetupURI); performer.perform(); if (!performer.hasSuccessfullyPerformed()) { throw new DiesOn(DeathType.FATAL).displaying("Error durring Oomph operation").ready(); } } catch (Die e) { throw e; } catch (Exception e) { throw new DiesOn(DeathType.FATAL).duedTo(e).ready(); } } }