/** * Initializes the output directory * * @param baseDirectory * @param directoryName * @return */ private File validateOutputDirectory(File outputDirectory) { // Create output directory if (!outputDirectory.mkdir() && !outputDirectory.exists()) { throw new ArchiveExportException("Unable to create archive output directory - " + outputDirectory); } if (outputDirectory.isFile()) { throw new IllegalArgumentException("Unable to export exploded directory to " + outputDirectory.getAbsolutePath() + ", it points to a existing file"); } return outputDirectory; }
/** * Initializes the output directory * * @param baseDirectory * @param directoryName * @return */ private File validateOutputDirectory(File outputDirectory) { // Create output directory if (!outputDirectory.mkdir() && !outputDirectory.exists()) { throw new ArchiveExportException("Unable to create archive output directory - " + outputDirectory); } if (outputDirectory.isFile()) { throw new IllegalArgumentException("Unable to export exploded directory to " + outputDirectory.getAbsolutePath() + ", it points to a existing file"); } return outputDirectory; }
out = new FileOutputStream(target); } catch (final FileNotFoundException e) { throw new ArchiveExportException("File could not be created: " + target);
out = new FileOutputStream(target); } catch (final FileNotFoundException e) { throw new ArchiveExportException("File could not be created: " + target);
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.exporter.StreamExporter#exportTo(java.io.OutputStream) */ @Override public void exportTo(final OutputStream target) throws ArchiveExportException, IllegalArgumentException { // Precondition checks if (target == null) { throw new IllegalArgumentException("Target must be specified"); } // Get Stream final InputStream in = this.exportAsInputStream(); try { // Write out try { IOUtil.copy(in, target); } catch (final IOException e) { throw new ArchiveExportException("Error encountered in exporting archive to " + target, e); } } finally { // Close try { in.close(); } catch (final IOException ioe) { // Just log log.warning("Could not close " + in + ": " + ioe); } } }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.exporter.StreamExporter#exportTo(java.io.OutputStream) */ @Override public void exportTo(final OutputStream target) throws ArchiveExportException, IllegalArgumentException { // Precondition checks if (target == null) { throw new IllegalArgumentException("Target must be specified"); } // Get Stream final InputStream in = this.exportAsInputStream(); try { // Write out try { IOUtil.copy(in, target); } catch (final IOException e) { throw new ArchiveExportException("Error encountered in exporting archive to " + target, e); } } finally { // Close try { in.close(); } catch (final IOException ioe) { // Just log log.warning("Could not close " + in + ": " + ioe); } } }
if (!assetParent.exists()) { if (!assetParent.mkdirs()) { throw new ArchiveExportException("Failed to write asset. Unable to create parent directory."); throw new ArchiveExportException("Failed to write directory: " + assetFile.getAbsolutePath()); } catch (final Exception e) { throw new ArchiveExportException("Failed to write asset " + path + " to " + assetFile, e); throw new ArchiveExportException("Unexpected error encountered in export of " + node, e);
if (!assetParent.exists()) { if (!assetParent.mkdirs()) { throw new ArchiveExportException("Failed to write asset. Unable to create parent directory."); throw new ArchiveExportException("Failed to write directory: " + assetFile.getAbsolutePath()); } catch (final Exception e) { throw new ArchiveExportException("Failed to write asset " + path + " to " + assetFile, e); throw new ArchiveExportException("Unexpected error encountered in export of " + node, e);
return this.read(); } catch (final Throwable t) { throw new ArchiveExportException("Failed to write asset to output: " + currentPath.get(), t); doCopy(); } catch (final Throwable t) { throw new ArchiveExportException("Failed to write asset to output: " + currentPath.get(), t);
return this.read(); } catch (final Throwable t) { throw new ArchiveExportException("Failed to write asset to output: " + currentPath.get(), t); doCopy(); } catch (final Throwable t) { throw new ArchiveExportException("Failed to write asset to output: " + currentPath.get(), t);