From 1e31f3baac0df6efb685fb849575f5156dc0a85f Mon Sep 17 00:00:00 2001 From: Uwe Stieber Date: Wed, 25 Apr 2012 17:42:40 +0200 Subject: Target Explorer: Fixed FindBugs warnings --- .../te/core/adapters/ModelNodePersistableURIProvider.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'target_explorer/plugins/org.eclipse.tcf.te.core') diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/adapters/ModelNodePersistableURIProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/adapters/ModelNodePersistableURIProvider.java index 07fbb5e46..b9b9963d7 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/adapters/ModelNodePersistableURIProvider.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/adapters/ModelNodePersistableURIProvider.java @@ -129,20 +129,18 @@ public class ModelNodePersistableURIProvider implements IPersistableURIProvider // Try the bundles state location first (not available if launched with -data @none). try { IPath path = Platform.getStateLocation(CoreBundleActivator.getContext().getBundle()).append(".store"); //$NON-NLS-1$ - if (!path.toFile().exists()) { - path.toFile().mkdirs(); - } - if (path.toFile().canRead() && path.toFile().isDirectory()) { + boolean exists = path.toFile().exists(); + if (!exists) exists = path.toFile().mkdirs(); + if (exists && path.toFile().canRead() && path.toFile().isDirectory()) { location = path; } } catch (IllegalStateException e) { // Workspace less environments (-data @none) // The users local target definition persistence directory is $HOME/.tcf/.store. IPath path = new Path(System.getProperty("user.home")).append(".tcf/.store"); //$NON-NLS-1$ //$NON-NLS-2$ - if (!path.toFile().exists()) { - path.toFile().mkdirs(); - } - if (path.toFile().canRead() && path.toFile().isDirectory()) { + boolean exists = path.toFile().exists(); + if (!exists) exists = path.toFile().mkdirs(); + if (exists && path.toFile().canRead() && path.toFile().isDirectory()) { location = path; } } -- cgit v1.2.3