@Override public void createDirectory(final Path dir, final FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull("dir", dir); final Path realDir = dir.toAbsolutePath(); if (realDir.toFile().exists()) { throw new FileAlreadyExistsException(dir.toString()); } realDir.toFile().mkdirs(); }
private String buildOnCreateErrorMessage(Throwable t) { if (t instanceof FileAlreadyExistsException) { return translationService.format( DataSourceManagementConstants.NewDataSourceDefWizard_FileExistsErrorMessage, ((FileAlreadyExistsException) t).getFile()); } else { return t.getMessage(); } }
private void copyRootFiles(final Path targetRoot, final org.uberfire.java.nio.file.Path originRepositoryRoot) { for (org.uberfire.java.nio.file.Path path : Files.newDirectoryStream(originRepositoryRoot)) { if (!Files.isDirectory(path)) { try { org.uberfire.java.nio.file.Path fileName = path.getFileName(); org.uberfire.java.nio.file.Path resolve = Paths.convert(targetRoot).resolve(fileName); Files.copy(path, resolve, StandardCopyOption.REPLACE_EXISTING); } catch (FileAlreadyExistsException x) { //Swallow x.printStackTrace(); } } } }
@Override public void createDirectory(final Path dir, final FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull("dir", dir); final Path realDir = dir.toAbsolutePath(); if (realDir.toFile().exists()) { throw new FileAlreadyExistsException(dir.toString()); } realDir.toFile().mkdirs(); }
private String buildOnCreateErrorMessage(Throwable t) { if (t instanceof FileAlreadyExistsException) { return translationService.format( DataSourceManagementConstants.NewDataSourceDefWizard_FileExistsErrorMessage, ((FileAlreadyExistsException) t).getFile()); } else { return t.getMessage(); } }
@Override public void createDirectory(final Path dir, final FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull("dir", dir); final Path realDir = dir.toAbsolutePath(); if (realDir.toFile().exists()) { throw new FileAlreadyExistsException(dir.toString()); } realDir.toFile().mkdirs(); }
ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage())); } catch (org.uberfire.java.nio.file.FileAlreadyExistsException e) { ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionFileAlreadyExists0(e.getFile())); } catch (org.uberfire.java.nio.file.FileSystemAlreadyExistsException e) { ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));
private void checkIfExists() { final org.uberfire.java.nio.file.Path pathToModulePom = Paths.convert(moduleRoot).resolve("pom.xml"); if (ioService.exists(pathToModulePom)) { throw new FileAlreadyExistsException(pathToModulePom.toString()); } }
ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage())); } catch (org.uberfire.java.nio.file.FileAlreadyExistsException e) { ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionFileAlreadyExists0(e.getFile())); } catch (org.uberfire.java.nio.file.FileSystemAlreadyExistsException e) { ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));
@Override public void createSymbolicLink(final Path link, final Path target, final FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull("link", link); checkNotNull("target", target); checkCondition("link and target can't be same", !link.equals(target)); checkCondition("target must already exists", target.toFile().exists()); if (link.toFile().exists()) { throw new FileAlreadyExistsException(link.toString()); } throw new UnsupportedOperationException(); }
@Override public void createLink(final Path link, final Path existing) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull("link", link); checkNotNull("existing", existing); checkCondition("existing must already exists", existing.toFile().exists()); checkCondition("link and target can't be same", !link.equals(existing)); if (link.toFile().exists()) { throw new FileAlreadyExistsException(link.toString()); } throw new UnsupportedOperationException(); }
public void createModuleWhiteList(final Path packageNamesWhiteListPath) { if (ioService.exists(Paths.convert(packageNamesWhiteListPath))) { throw new FileAlreadyExistsException(packageNamesWhiteListPath.toString()); } else { ioService.write(Paths.convert(packageNamesWhiteListPath), ""); } }
@Override public void createLink(final Path link, final Path existing) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull("link", link); checkNotNull("existing", existing); checkCondition("existing must already exists", existing.toFile().exists()); checkCondition("link and target can't be same", !link.equals(existing)); if (link.toFile().exists()) { throw new FileAlreadyExistsException(link.toString()); } throw new UnsupportedOperationException(); }
@Override public void createSymbolicLink(final Path link, final Path target, final FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull("link", link); checkNotNull("target", target); checkCondition("link and target can't be same", !link.equals(target)); checkCondition("target must already exists", target.toFile().exists()); if (link.toFile().exists()) { throw new FileAlreadyExistsException(link.toString()); } throw new UnsupportedOperationException(); }
@Override public void createLink(final Path link, final Path existing) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull("link", link); checkNotNull("existing", existing); checkCondition("existing must already exists", existing.toFile().exists()); checkCondition("link and target can't be same", !link.equals(existing)); if (link.toFile().exists()) { throw new FileAlreadyExistsException(link.toString()); } throw new UnsupportedOperationException(); }
@Override public void createSymbolicLink(final Path link, final Path target, final FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull("link", link); checkNotNull("target", target); checkCondition("link and target can't be same", !link.equals(target)); checkCondition("target must already exists", target.toFile().exists()); if (link.toFile().exists()) { throw new FileAlreadyExistsException(link.toString()); } throw new UnsupportedOperationException(); }
final File file = checkNotNull("path", path).toFile(); if (file.exists()) { throw new FileAlreadyExistsException("");
@Override public SeekableByteChannel newByteChannel(final Path path, final Set<? extends OpenOption> options, final FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { final File file = checkNotNull("path", path).toFile(); if (file.exists()) { if (!shouldCreateOrOpenAByteChannel(options)) { throw new FileAlreadyExistsException(path.toString()); } } try { if (options != null && options.contains(READ)) { return openAByteChannel(path); } else { return createANewByteChannel(file); } } catch (java.io.IOException e) { throw new IOException("Failed to open or create a byte channel.", e); } }
public void saveProjectImports(final Path path) { if (ioService.exists(Paths.convert(path))) { throw new FileAlreadyExistsException(path.toString()); } else { ioService.write(Paths.convert(path), projectConfigurationContentHandler.toString(createProjectImports())); } }
@Override public SeekableByteChannel newByteChannel(final Path path, final Set<? extends OpenOption> options, final FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { final File file = checkNotNull("path", path).toFile(); if (file.exists()) { if (!shouldCreateOrOpenAByteChannel(options)) { throw new FileAlreadyExistsException(path.toString()); } } try { if (options != null && options.contains(READ)) { return openAByteChannel(path); } else { return createANewByteChannel(file); } } catch (java.io.IOException e) { throw new IOException("Failed to open or create a byte channel.", e); } }