aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2007-06-27 14:46:58 +0000
committerDamian Minkov <damencho@jitsi.org>2007-06-27 14:46:58 +0000
commit32d9b44a88d4c8ef2c38798005c669df94420b84 (patch)
tree57e2a1cd76103333e4fd9d822562b53025aa4d95 /src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java
parent04e9dff83c6d5b42fa76b571f842c669ab3e86ec (diff)
downloadjitsi-32d9b44a88d4c8ef2c38798005c669df94420b84.zip
jitsi-32d9b44a88d4c8ef2c38798005c669df94420b84.tar.gz
jitsi-32d9b44a88d4c8ef2c38798005c669df94420b84.tar.bz2
Fix erasing of config file on MacOS.
Diffstat (limited to 'src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java')
-rw-r--r--src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java b/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java
index 7cd836c..a39592f 100644
--- a/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java
@@ -83,6 +83,11 @@ public class ConfigurationServiceImpl
* corresponding node in the XMLDocument object.
*/
private Map fileExtractedProperties = new Hashtable();
+
+ /**
+ * Indicates whether the service is started or stopped.
+ */
+ private boolean started = false;
/**
* Sets the property with the specified name to the specified value. Calling
@@ -352,6 +357,14 @@ public class ConfigurationServiceImpl
changeEventDispatcher.removeVetoableChangeListener(propertyName,
listener);
}
+
+ /**
+ * Called on service stop.
+ */
+ void stop()
+ {
+ this.started = false;
+ }
/**
* Initializes the configuration service impl and makes it load an initial
@@ -359,6 +372,8 @@ public class ConfigurationServiceImpl
*/
void start()
{
+ this.started = true;
+
try
{
debugPrintSystemProperties();
@@ -445,11 +460,10 @@ public class ConfigurationServiceImpl
}
}
- public void storeConfiguration()
+ public synchronized void storeConfiguration()
throws IOException
{
storeConfiguration(getConfigurationFile());
-
}
private Document createPropertiesDocument()
@@ -483,6 +497,9 @@ public class ConfigurationServiceImpl
private void storeConfiguration(File file)
throws IOException
{
+ if(!started)
+ throw new IllegalStateException("Service is stopped or has not been started");
+
//resolve the properties that were initially in the file - back to
//the document.