List of usage examples for org.apache.commons.vfs2 FileSystemException getCause
public synchronized Throwable getCause()
From source file:hadoopInstaller.installation.Installer.java
private void loadConfiguration() throws InstallationFatalError { getLog().trace("HadoopInstaller.Configure.Start", //$NON-NLS-1$ InstallerConstants.CONFIGURATION_FILE); String localDirectoryName = System.getProperty("user.dir"); //$NON-NLS-1$ try {/* w w w .jav a2 s. co m*/ setLocalDirectory(VFS.getManager().resolveFile(localDirectoryName)); FileObject configurationFile = getLocalDirectory().resolveFile(InstallerConstants.CONFIGURATION_FILE); FileObject configurationSchema = getConfigurationSchema(); setConfig(InstallerConfigurationParser .generateConfigurationFrom(XMLDocumentReader.parse(configurationFile, configurationSchema))); try { configurationFile.close(); } catch (FileSystemException ex) { getLog().warn(ex, "HadoopInstaller.File.CouldNotClose", //$NON-NLS-1$ InstallerConstants.CONFIGURATION_FILE); } } catch (FileSystemException e) { throw new InstallationFatalError(e, "HadoopInstaller.Configure.CouldNotFindFile", //$NON-NLS-1$ InstallerConstants.CONFIGURATION_FILE, localDirectoryName); } catch (InstallerConfigurationParseError e) { throw new InstallationFatalError(e.getCause(), "HadoopInstaller.Configure.CouldNotReadFile", //$NON-NLS-1$ InstallerConstants.CONFIGURATION_FILE); } getLog().info("HadoopInstaller.Configure.Success"); //$NON-NLS-1$ }
From source file:org.pentaho.vfs.ui.VfsBrowser.java
public void promptForRenameFile() { boolean done = false; String defaultText = fileSystemTree.getSelection()[0].getText(); String text = defaultText;// www.j a v a 2 s.c om while (!done) { if (text == null) { text = defaultText; } TextInputDialog textDialog = new TextInputDialog(Messages.getString("VfsBrowser.enterNewFilename"), //$NON-NLS-1$ text, 500, 100); text = textDialog.open(); if (text != null && !"".equals(text)) { //$NON-NLS-1$ try { done = renameItem(fileSystemTree.getSelection()[0], text); if (!done) { MessageBox errorDialog = new MessageBox(fileSystemTree.getDisplay().getActiveShell(), SWT.OK); errorDialog.setText(Messages.getString("VfsBrowser.error")); //$NON-NLS-1$ errorDialog.setMessage( "Could not rename selection, target exists or operation not supported."); errorDialog.open(); } } catch (FileSystemException e) { MessageBox errorDialog = new MessageBox(fileSystemTree.getDisplay().getActiveShell(), SWT.OK); errorDialog.setText(Messages.getString("VfsBrowser.error")); //$NON-NLS-1$ if (e.getCause() != null) { errorDialog.setMessage(e.getCause().getMessage()); } else { errorDialog.setMessage(e.getMessage()); } errorDialog.open(); } } else { done = true; } } }
From source file:org.pentaho.vfs.ui.VfsFileChooserDialog.java
public void promptForNewFolder() { boolean done = false; String defaultText = "New Folder"; String text = defaultText;/*from w w w . jav a 2 s . c om*/ while (!done) { if (text == null) { text = defaultText; } TextInputDialog textDialog = new TextInputDialog(Messages.getString("VfsBrowser.enterNewFolderName"), //$NON-NLS-1$ text, 500, 160); text = textDialog.open(); if (text != null && !"".equals(text)) { //$NON-NLS-1$ try { vfsBrowser.createFolder(text); //$NON-NLS-1$ done = true; } catch (FileSystemException e) { MessageBox errorDialog = new MessageBox(newFolderButton.getShell(), SWT.OK); errorDialog.setText(Messages.getString("VfsBrowser.error")); //$NON-NLS-1$ if (e.getCause() != null) { errorDialog.setMessage(e.getCause().getMessage()); } else { errorDialog.setMessage(e.getMessage()); } errorDialog.open(); } } else { done = true; } } }