List of usage examples for java.io File getCanonicalPath
public String getCanonicalPath() throws IOException
From source file:jviewmda.JViewMda.java
private void update_title() { File FF = new File(m_file_path); try {/*ww w. jav a2 s. co m*/ String str = FF.getName() + ": " + FF.getCanonicalPath(); m_stage.setTitle(str); } catch (IOException ee) { } }
From source file:net.nicholaswilliams.java.teamcity.plugin.linux.TestAbstractLinuxPropertiesLocator.java
@Test public void testLocateProperties01() throws IOException { File pluginRoot = new File("."); File versionFile = new File(pluginRoot, "version.properties"); assertFalse("The file [" + versionFile.getCanonicalPath() + "] should not exist.", versionFile.exists()); final Capture<Map<String, String>> capture = new Capture<Map<String, String>>(); this.locator.locateLinuxProperties(capture(capture)); expectLastCall().andAnswer(new IAnswer<Void>() { @Override/*from w w w . j a v a 2 s . com*/ public Void answer() throws Throwable { assertTrue("The properties map should be empty.", capture.getValue().isEmpty()); capture.getValue().put("myLinuxProperty01", "1.0.4"); return null; } }); replay(this.locator); Map<String, String> properties = this.locator.locateProperties(pluginRoot); assertNotNull("The properties should not be null.", properties); assertEquals("The linux property is not correct.", "1.0.4", properties.get("myLinuxProperty01")); assertFalse("The version property should not be present.", properties.containsKey(LinuxPropertiesLocator.PLUGIN_VERSION_KEY)); }
From source file:ddf.security.pdp.realm.xacml.processor.PollingPolicyFinderModule.java
public void onFileCreate(File createdFile) { try {/* w w w. j a v a 2s . co m*/ SecurityLogger.audit("File {} was created with content:\n{}", createdFile.getCanonicalPath(), new String(Files.readAllBytes(Paths.get(createdFile.getCanonicalPath())), StandardCharsets.UTF_8)); } catch (IOException e) { LOGGER.error(e.getMessage(), e); } reloadPolicies(); }
From source file:ddf.security.pdp.xacml.processor.PollingPolicyFinderModule.java
public void onFileChange(File changedFile) { try {// ww w . j a v a 2 s .c o m LOGGER.debug("File " + changedFile.getCanonicalPath() + " changed."); } catch (IOException e) { LOGGER.error(e.getMessage(), e); } reloadPolicies(); }
From source file:ddf.security.pdp.xacml.processor.PollingPolicyFinderModule.java
public void onFileCreate(File createdFile) { try {//w ww. j a v a2s. c o m LOGGER.debug("File " + createdFile.getCanonicalPath() + " was created."); } catch (IOException e) { LOGGER.error(e.getMessage(), e); } reloadPolicies(); }
From source file:org.italiangrid.storm.webdav.fs.DefaultFSStrategy.java
@Override public void mv(File source, File dest) { LOG.debug("mv: source={}, dest={}", source.getAbsolutePath(), dest.getAbsolutePath()); try {// w w w. ja va2s . c o m if (source.getCanonicalPath().equals(dest.getCanonicalPath())) { throw new SameFileError("Source and destination files are the same"); } // Overwrites the destination, if it exists Files.move(source, dest); } catch (IOException e) { throw new StoRMWebDAVError(e.getMessage(), e); } }
From source file:ddf.security.pdp.xacml.processor.PollingPolicyFinderModule.java
public void onDirectoryCreate(File createdDir) { try {//from w ww.ja v a 2 s . co m LOGGER.debug("Directory " + createdDir.getCanonicalPath() + " was created."); } catch (IOException e) { LOGGER.error(e.getMessage(), e); } }
From source file:ddf.security.pdp.xacml.processor.PollingPolicyFinderModule.java
public void onDirectoryDelete(File deletedDir) { try {/*w w w . j a va2 s .c o m*/ LOGGER.debug("Directory " + deletedDir.getCanonicalPath() + " was deleted."); } catch (IOException e) { LOGGER.error(e.getMessage(), e); } }
From source file:com.adaptris.core.fs.MarshallingCacheCase.java
public void testPersistenceWithBadPersistentStore() throws Exception { String oldName = Thread.currentThread().getName(); MarshallingItemCache cache = createCache(); File badStore = File.createTempFile(this.getClass().getSimpleName(), ""); badStore.delete();//from w w w . j a va 2s .com badStore.mkdirs(); cache.setPersistentStore(badStore.getCanonicalPath()); try { Thread.currentThread().setName("testPersistenceWithBadPersistentStore"); cache.init(); cache.close(); fail(); } catch (CoreException expected) { log.debug(expected.getMessage(), expected); } finally { Thread.currentThread().setName(oldName); FileUtils.deleteQuietly(badStore); } }
From source file:ch.sdi.core.impl.mail.MailTextResolver.java
/** * Initializes the mail content configuration and provides the resolved body in the environment with * the key dyn.mail.body.bytemplatefile/* w w w. jav a2s. c o m*/ * <p> * A configured body template file (sdi.mail.body.template) takes precedence over the key * sdi.mail.body * <p> * @throws SdiException on any problem */ public void init() throws SdiException { myBodyKey = MailProperties.KEY_BODY; if (myEnv.containsProperty(MailProperties.KEY_BODY_TEMPLATE)) { String charsetName; try { charsetName = myEnv.getRequiredProperty(MailProperties.KEY_BODY_TEMPLATE_CHARSET); } catch (Throwable t) { throw new SdiException("Property " + MailProperties.KEY_BODY_TEMPLATE + " is defined but " + "not " + MailProperties.KEY_BODY_TEMPLATE_CHARSET, t, SdiException.EXIT_CODE_CONFIG_ERROR); } Charset charset; try { charset = Charset.forName(charsetName); } catch (Throwable t) { throw new SdiException("Property " + MailProperties.KEY_BODY_TEMPLATE_CHARSET + " (" + charsetName + ") is invalid", t, SdiException.EXIT_CODE_CONFIG_ERROR); } String fileName = myEnv.getProperty(MailProperties.KEY_BODY_TEMPLATE); File file = new File(fileName); try { myLog.debug("Loading mail body from template file " + file.getCanonicalPath()); InputStream is = new FileInputStream(file); String body; try { body = StreamUtils.copyToString(is, charset); } finally { is.close(); } myLog.debug("Loaded mail body from template file " + body); myBodyKey = KEY_BODY_BY_TEMPLATE_FILE; ConfigUtils.addToEnvironment(myEnv, myBodyKey, body); } catch (Throwable t) { throw new SdiException("Cannot load mail template " + fileName, t, SdiException.EXIT_CODE_CONFIG_ERROR); } } // if myEnv.containsProperty( MailProperties.BODY_TEMPLATE ) }