summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-05-16 13:14:53 +0000
committerDwayne Boone <dwayne@zeroc.com>2007-05-16 13:14:53 +0000
commit97471800e2eea67243ef838a74634b83a51f9cb9 (patch)
treedc4427a9b5baf9c332570f53fd89c1458bef9051
parentFixed mono compile errors (diff)
downloadice-97471800e2eea67243ef838a74634b83a51f9cb9.tar.bz2
ice-97471800e2eea67243ef838a74634b83a51f9cb9.tar.xz
ice-97471800e2eea67243ef838a74634b83a51f9cb9.zip
Bug 1625 - unused property warning
-rw-r--r--cpp/CHANGES4
-rw-r--r--cpp/config/PropertyNames.def1
-rw-r--r--cpp/src/Ice/Instance.cpp17
-rw-r--r--cpp/src/Ice/PropertiesI.cpp65
-rw-r--r--cpp/src/Ice/PropertiesI.h12
-rw-r--r--cpp/src/Ice/PropertyNames.cpp3
-rw-r--r--cpp/src/Ice/PropertyNames.h2
-rw-r--r--cs/CHANGES4
-rw-r--r--cs/src/Ice/Base64.cs1
-rwxr-xr-xcs/src/Ice/EndpointFactoryManager.cs2
-rwxr-xr-xcs/src/Ice/Instance.cs15
-rwxr-xr-xcs/src/Ice/PropertiesI.cs102
-rw-r--r--cs/src/Ice/PropertyNames.cs3
-rw-r--r--java/CHANGES4
-rw-r--r--java/src/Ice/PropertiesI.java83
-rw-r--r--java/src/IceInternal/Instance.java15
-rw-r--r--java/src/IceInternal/PropertyNames.java3
17 files changed, 273 insertions, 63 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index a3a84b23fb5..0aaf25ced36 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -1,6 +1,10 @@
Changes since version 3.2.X (binary incompabible)
-------------------------------------------------
+- Added a new property, Ice.Warn.UnusedProperties. If set to 1, when
+ the communicator is destroyed a warning will be printed listing all
+ properties that were set, but never read. Default is 0.
+
- Added what() member to IceUtil::Exception, so a single catch handler
can be used for Ice exceptions:
diff --git a/cpp/config/PropertyNames.def b/cpp/config/PropertyNames.def
index 1556885be3e..901f54d3d64 100644
--- a/cpp/config/PropertyNames.def
+++ b/cpp/config/PropertyNames.def
@@ -193,6 +193,7 @@ Ice:
Warn.Dispatch
Warn.Endpoints
Warn.UnknownProperties
+ Warn.UnusedProperties
CacheMessageBuffers
IceBox:
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 81dfa2fc9bc..7fd7ef6c555 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -24,7 +24,7 @@
#include <Ice/LocalException.h>
#include <Ice/ObjectAdapterFactory.h>
#include <Ice/Exception.h>
-#include <Ice/Properties.h>
+#include <Ice/PropertiesI.h>
#include <Ice/LoggerI.h>
#include <Ice/Network.h>
#include <Ice/EndpointFactoryManager.h>
@@ -33,6 +33,7 @@
#include <Ice/DynamicLibrary.h>
#include <Ice/PluginManagerI.h>
#include <Ice/Initialize.h>
+#include <Ice/LoggerUtil.h>
#include <IceUtil/StringUtil.h>
#include <stdio.h>
@@ -936,6 +937,20 @@ IceInternal::Instance::destroy()
{
serverThreadPool->joinWithAllThreads();
}
+
+ if(_initData.properties->getPropertyAsInt("Ice.Warn.UnusedProperties") > 0)
+ {
+ set<string> unusedProperties = static_cast<PropertiesI*>(_initData.properties.get())->getUnusedProperties();
+ if(unusedProperties.size() != 0)
+ {
+ Warning out(_initData.logger);
+ out << "The following properties were set but never read:";
+ for(set<string>::const_iterator p = unusedProperties.begin(); p != unusedProperties.end(); ++p)
+ {
+ out << "\n " << *p;
+ }
+ }
+ }
return true;
}
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp
index 86ddccf7cae..7b868d451e8 100644
--- a/cpp/src/Ice/PropertiesI.cpp
+++ b/cpp/src/Ice/PropertiesI.cpp
@@ -25,10 +25,11 @@ Ice::PropertiesI::getProperty(const string& key)
{
IceUtil::Mutex::Lock sync(*this);
- map<string, string>::const_iterator p = _properties.find(key);
+ map<string, PropertyValue>::iterator p = _properties.find(key);
if(p != _properties.end())
{
- return p->second;
+ p->second.used = true;
+ return p->second.value;
}
else
{
@@ -41,10 +42,11 @@ Ice::PropertiesI::getPropertyWithDefault(const string& key, const string& value)
{
IceUtil::Mutex::Lock sync(*this);
- map<string, string>::const_iterator p = _properties.find(key);
+ map<string, PropertyValue>::iterator p = _properties.find(key);
if(p != _properties.end())
{
- return p->second;
+ p->second.used = true;
+ return p->second.value;
}
else
{
@@ -63,10 +65,11 @@ Ice::PropertiesI::getPropertyAsIntWithDefault(const string& key, Int value)
{
IceUtil::Mutex::Lock sync(*this);
- map<string, string>::const_iterator p = _properties.find(key);
+ map<string, PropertyValue>::iterator p = _properties.find(key);
if(p != _properties.end())
{
- istringstream v(p->second);
+ p->second.used = true;
+ istringstream v(p->second.value);
if(!(v >> value) || !v.eof())
{
return 0;
@@ -82,12 +85,13 @@ Ice::PropertiesI::getPropertiesForPrefix(const string& prefix)
IceUtil::Mutex::Lock sync(*this);
PropertyDict result;
- map<string, string>::const_iterator p;
+ map<string, PropertyValue>::iterator p;
for(p = _properties.begin(); p != _properties.end(); ++p)
{
if(prefix.empty() || p->first.compare(0, prefix.size(), prefix) == 0)
{
- result.insert(*p);
+ p->second.used = true;
+ result[p->first] = p->second.value;
}
}
@@ -140,7 +144,13 @@ Ice::PropertiesI::setProperty(const string& key, const string& value)
//
if(!value.empty())
{
- _properties[key] = value;
+ PropertyValue pv = { value, false };
+ map<string, PropertyValue>::const_iterator p = _properties.find(key);
+ if(p != _properties.end())
+ {
+ pv.used = p->second.used;
+ }
+ _properties[key] = pv;
}
else
{
@@ -155,10 +165,10 @@ Ice::PropertiesI::getCommandLineOptions()
StringSeq result;
result.reserve(_properties.size());
- map<string, string>::const_iterator p;
+ map<string, PropertyValue>::const_iterator p;
for(p = _properties.begin(); p != _properties.end(); ++p)
{
- result.push_back("--" + p->first + "=" + p->second);
+ result.push_back("--" + p->first + "=" + p->second.value);
}
return result;
}
@@ -234,6 +244,21 @@ Ice::PropertiesI::clone()
return new PropertiesI(this);
}
+set<string>
+Ice::PropertiesI::getUnusedProperties()
+{
+ IceUtil::Mutex::Lock sync(*this);
+ set<string> unusedProperties;
+ for(map<string, PropertyValue>::const_iterator p = _properties.begin(); p != _properties.end(); ++p)
+ {
+ if(!p->second.used)
+ {
+ unusedProperties.insert(p->first);
+ }
+ }
+ return unusedProperties;
+}
+
Ice::PropertiesI::PropertiesI(const PropertiesI* p) :
_properties(p->_properties),
_converter(p->_converter)
@@ -250,12 +275,14 @@ Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, co
{
if(defaults != 0)
{
- _properties = defaults->getPropertiesForPrefix("");
+ _properties = static_cast<PropertiesI*>(defaults.get())->_properties;
}
StringSeq::iterator q = args.begin();
- if(_properties.find("Ice.ProgramName") == _properties.end())
+
+ map<string, PropertyValue>::iterator p = _properties.find("Ice.ProgramName");
+ if(p == _properties.end())
{
if(q != args.end())
{
@@ -266,9 +293,15 @@ Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, co
//
string name = *q;
replace(name.begin(), name.end(), '\\', '/');
- setProperty("Ice.ProgramName", name);
+
+ PropertyValue pv = { name, true };
+ _properties["Ice.ProgramName"] = pv;
}
}
+ else
+ {
+ p->second.used = true;
+ }
StringSeq tmp;
@@ -309,7 +342,6 @@ Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, co
args = parseIceCommandLineOptions(args);
}
-
void
Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& converter)
{
@@ -408,5 +440,6 @@ Ice::PropertiesI::loadConfig()
}
}
- setProperty("Ice.Config", value);
+ PropertyValue pv = { value, true };
+ _properties["Ice.Config"] = pv;
}
diff --git a/cpp/src/Ice/PropertiesI.h b/cpp/src/Ice/PropertiesI.h
index a5d78edb9d1..369460addd7 100644
--- a/cpp/src/Ice/PropertiesI.h
+++ b/cpp/src/Ice/PropertiesI.h
@@ -14,6 +14,8 @@
#include <Ice/Properties.h>
#include <Ice/StringConverter.h>
+#include <set>
+
namespace Ice
{
@@ -33,6 +35,8 @@ public:
virtual void load(const std::string&);
virtual PropertiesPtr clone();
+ std::set<std::string> getUnusedProperties();
+
private:
PropertiesI(const StringConverterPtr&);
PropertiesI(StringSeq&, const PropertiesPtr&, const StringConverterPtr&);
@@ -42,12 +46,16 @@ private:
friend ICE_API PropertiesPtr createProperties(StringSeq&, const PropertiesPtr&, const StringConverterPtr&);
friend ICE_API PropertiesPtr createProperties(int&, char*[], const PropertiesPtr&, const StringConverterPtr&);
-
void parseLine(const std::string&, const StringConverterPtr&);
void loadConfig();
- std::map<std::string, std::string> _properties;
+ struct PropertyValue
+ {
+ std::string value;
+ bool used;
+ };
+ std::map<std::string, PropertyValue> _properties;
const StringConverterPtr _converter;
};
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp
index dce071b8cde..0744d7d004e 100644
--- a/cpp/src/Ice/PropertyNames.cpp
+++ b/cpp/src/Ice/PropertyNames.cpp
@@ -7,7 +7,7 @@
//
// **********************************************************************
-// Generated by makeprops.py from file `../config/PropertyNames.def', Tue Feb 20 11:10:03 2007
+// Generated by makeprops.py from file `../config/PropertyNames.def', Tue May 15 12:31:29 2007
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -95,6 +95,7 @@ const char* IceInternal::PropertyNames::IceProps[] =
"Ice.Warn.Dispatch",
"Ice.Warn.Endpoints",
"Ice.Warn.UnknownProperties",
+ "Ice.Warn.UnusedProperties",
"Ice.CacheMessageBuffers",
0
};
diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h
index 7b680bb595a..30edd10e84e 100644
--- a/cpp/src/Ice/PropertyNames.h
+++ b/cpp/src/Ice/PropertyNames.h
@@ -7,7 +7,7 @@
//
// **********************************************************************
-// Generated by makeprops.py from file `../config/PropertyNames.def', Tue Feb 20 11:10:03 2007
+// Generated by makeprops.py from file `../config/PropertyNames.def', Tue May 15 12:31:29 2007
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
diff --git a/cs/CHANGES b/cs/CHANGES
index e89b2a93141..1298ded0991 100644
--- a/cs/CHANGES
+++ b/cs/CHANGES
@@ -1,6 +1,10 @@
Changes since version 3.2.X (binary incompabible)
-------------------------------------------------
+- Added a new property, Ice.Warn.UnusedProperties. If set to 1, when
+ the communicator is destroyed a warning will be printed listing all
+ properties that were set, but never read. Default is 0.
+
- Ice.LocalException and Ice.UserException now implement
System.ICloneable
diff --git a/cs/src/Ice/Base64.cs b/cs/src/Ice/Base64.cs
index 70f1ec0a386..17caee4c789 100644
--- a/cs/src/Ice/Base64.cs
+++ b/cs/src/Ice/Base64.cs
@@ -179,7 +179,6 @@ decode(string str)
}
}
- byte[] temp = retval.toArray(0, pos);
return retval.toArray(0, pos);
}
diff --git a/cs/src/Ice/EndpointFactoryManager.cs b/cs/src/Ice/EndpointFactoryManager.cs
index fbe2e9bf92a..3454d64f90a 100755
--- a/cs/src/Ice/EndpointFactoryManager.cs
+++ b/cs/src/Ice/EndpointFactoryManager.cs
@@ -122,7 +122,7 @@ namespace IceInternal
ue.streamWrite(bs);
IceInternal.ByteBuffer buf = bs.prepareRead();
buf.position(0);
- short type = bs.readShort();
+ bs.readShort(); // type
return f.read(bs);
}
}
diff --git a/cs/src/Ice/Instance.cs b/cs/src/Ice/Instance.cs
index c066024d5bd..08b5ad0165c 100755
--- a/cs/src/Ice/Instance.cs
+++ b/cs/src/Ice/Instance.cs
@@ -10,6 +10,7 @@
namespace IceInternal
{
+ using System.Collections;
using System.Diagnostics;
public sealed class Instance
@@ -650,6 +651,20 @@ namespace IceInternal
serverThreadPool.joinWithAllThreads();
}
+ if(_initData.properties.getPropertyAsInt("Ice.Warn.UnusedProperties") > 0)
+ {
+ ArrayList unusedProperties = ((Ice.PropertiesI)_initData.properties).getUnusedProperties();
+ if(unusedProperties.Count != 0)
+ {
+ string message = "The following properties were set but never read:";
+ foreach(string s in unusedProperties)
+ {
+ message += "\n " + s;
+ }
+ _initData.logger.warning(message);
+ }
+ }
+
return true;
}
diff --git a/cs/src/Ice/PropertiesI.cs b/cs/src/Ice/PropertiesI.cs
index 8a4f9403f2c..3eed8c404a3 100755
--- a/cs/src/Ice/PropertiesI.cs
+++ b/cs/src/Ice/PropertiesI.cs
@@ -15,14 +15,28 @@ namespace Ice
{
sealed class PropertiesI : LocalObjectImpl, Properties
{
+ class PropertyValue
+ {
+ public PropertyValue(string v, bool u)
+ {
+ val = v;
+ used = u;
+ }
+
+ public string val;
+ public bool used;
+ }
+
public string getProperty(string key)
{
lock(this)
{
- string result = _properties[key];
- if(result == null)
+ string result = "";
+ PropertyValue pv = (PropertyValue)_properties[key];
+ if(pv != null)
{
- result = "";
+ pv.used = true;
+ result = pv.val;
}
return result;
}
@@ -32,10 +46,12 @@ namespace Ice
{
lock(this)
{
- string result = _properties[key];
- if(result == null)
+ string result = val;
+ PropertyValue pv = (PropertyValue)_properties[key];
+ if(pv != null)
{
- result = val;
+ pv.used = true;
+ result = pv.val;
}
return result;
}
@@ -50,18 +66,22 @@ namespace Ice
{
lock(this)
{
- string result = _properties[key];
- if(result == null)
+ PropertyValue pv = (PropertyValue)_properties[key];
+ if(pv == null)
{
return val;
}
- try
- {
- return System.Int32.Parse(result);
- }
- catch(System.FormatException)
+ else
{
- return val;
+ pv.used = true;
+ try
+ {
+ return System.Int32.Parse(pv.val);
+ }
+ catch(System.FormatException)
+ {
+ return val;
+ }
}
}
}
@@ -76,7 +96,9 @@ namespace Ice
{
if(prefix.Length == 0 || s.StartsWith(prefix))
{
- result[s] = _properties[s];
+ PropertyValue pv = (PropertyValue)_properties[s];
+ pv.used = true;
+ result[s] = pv.val;
}
}
return result;
@@ -131,7 +153,16 @@ namespace Ice
//
if(val != null && val.Length > 0)
{
- _properties[key] = val;
+ PropertyValue pv = (PropertyValue)_properties[key];
+ if(pv != null)
+ {
+ pv.val = val;
+ }
+ else
+ {
+ pv = new PropertyValue(val, false);
+ }
+ _properties[key] = pv;
}
else
{
@@ -148,7 +179,7 @@ namespace Ice
int i = 0;
foreach(DictionaryEntry entry in _properties)
{
- result[i++] = "--" + entry.Key + "=" + entry.Value;
+ result[i++] = "--" + entry.Key + "=" + ((PropertyValue)entry.Value).val;
}
return result;
}
@@ -222,31 +253,52 @@ namespace Ice
return new PropertiesI(this);
}
}
+
+ public ArrayList getUnusedProperties()
+ {
+ lock(this)
+ {
+ ArrayList unused = new ArrayList();
+ foreach(DictionaryEntry entry in _properties)
+ {
+ if(!((PropertyValue)entry.Value).used)
+ {
+ unused.Add(entry.Key);
+ }
+ }
+ return unused;
+ }
+ }
internal PropertiesI(PropertiesI p)
{
- _properties = (PropertyDict)p._properties.Clone();
+ _properties = (Hashtable)p._properties.Clone();
}
internal PropertiesI()
{
- _properties = new PropertyDict();
+ _properties = new Hashtable();
}
internal PropertiesI(ref string[] args, Properties defaults)
{
if(defaults == null)
{
- _properties = new PropertyDict();
+ _properties = new Hashtable();
}
else
{
- _properties = defaults.getPropertiesForPrefix("");
+ _properties = ((PropertiesI)defaults)._properties;
}
- if(_properties["Ice.ProgramName"] == null)
+ PropertyValue pv = (PropertyValue)_properties["Ice.ProgramName"];
+ if(pv == null)
+ {
+ _properties["Ice.ProgramName"] = new PropertyValue(System.AppDomain.CurrentDomain.FriendlyName, true);
+ }
+ else
{
- setProperty("Ice.ProgramName", System.AppDomain.CurrentDomain.FriendlyName);
+ pv.used = true;
}
bool loadConfigFiles = false;
@@ -378,9 +430,9 @@ namespace Ice
}
}
- setProperty("Ice.Config", val);
+ _properties["Ice.Config"] = new PropertyValue(val, true);
}
- private Ice.PropertyDict _properties;
+ private Hashtable _properties;
}
}
diff --git a/cs/src/Ice/PropertyNames.cs b/cs/src/Ice/PropertyNames.cs
index 1154c625dce..c5a59212ce6 100644
--- a/cs/src/Ice/PropertyNames.cs
+++ b/cs/src/Ice/PropertyNames.cs
@@ -7,7 +7,7 @@
//
// **********************************************************************
-// Generated by makeprops.py from file `../config/PropertyNames.def', Tue Feb 20 11:10:03 2007
+// Generated by makeprops.py from file `../config/PropertyNames.def', Tue May 15 12:31:29 2007
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -97,6 +97,7 @@ namespace IceInternal
@"^Ice\.Warn\.Dispatch$",
@"^Ice\.Warn\.Endpoints$",
@"^Ice\.Warn\.UnknownProperties$",
+ @"^Ice\.Warn\.UnusedProperties$",
@"^Ice\.CacheMessageBuffers$",
null
};
diff --git a/java/CHANGES b/java/CHANGES
index f7b2183cdac..4f51fadb3ff 100644
--- a/java/CHANGES
+++ b/java/CHANGES
@@ -1,6 +1,10 @@
Changes since version 3.2.X (binary incompabible)
-------------------------------------------------
+- Added a new property, Ice.Warn.UnusedProperties. If set to 1, when
+ the communicator is destroyed a warning will be printed listing all
+ properties that were set, but never read. Default is 0.
+
- Ice.LocalException and Ice.UserException now implement
java.lang.Cloneable.
diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java
index c87df8295c2..fb189b04610 100644
--- a/java/src/Ice/PropertiesI.java
+++ b/java/src/Ice/PropertiesI.java
@@ -11,14 +11,32 @@ package Ice;
public final class PropertiesI extends LocalObjectImpl implements Properties
{
+ class PropertyValue
+ {
+ public PropertyValue(String v, boolean u)
+ {
+ value = v;
+ used = u;
+ }
+
+ public String value;
+ public boolean used;
+ }
+
public synchronized String
getProperty(String key)
{
- String result = (String)_properties.get(key);
- if(result == null)
+ String result = null;
+ PropertyValue pv = (PropertyValue)_properties.get(key);
+ if(pv == null)
{
result = System.getProperty(key);
}
+ else
+ {
+ pv.used = true;
+ result = pv.value;
+ }
if(result == null)
{
result = "";
@@ -29,11 +47,17 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
public synchronized String
getPropertyWithDefault(String key, String value)
{
- String result = (String)_properties.get(key);
- if(result == null)
+ String result = null;
+ PropertyValue pv = (PropertyValue)_properties.get(key);
+ if(pv == null)
{
result = System.getProperty(key);
}
+ else
+ {
+ pv.used = true;
+ result = pv.value;
+ }
if(result == null)
{
result = value;
@@ -50,11 +74,17 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
public synchronized int
getPropertyAsIntWithDefault(String key, int value)
{
- String result = (String)_properties.get(key);
- if(result == null)
+ String result = null;
+ PropertyValue pv = (PropertyValue)_properties.get(key);
+ if(pv == null)
{
result = System.getProperty(key);
}
+ else
+ {
+ pv.used = true;
+ result = pv.value;
+ }
if(result == null)
{
return value;
@@ -79,10 +109,11 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
{
java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
String key = (String)entry.getKey();
- String value = (String)entry.getValue();
if(prefix.length() == 0 || key.startsWith(prefix))
{
- result.put(key, value);
+ PropertyValue pv = (PropertyValue)entry.getValue();
+ pv.used = true;
+ result.put(key, pv.value);
}
}
return result;
@@ -137,7 +168,16 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
//
if(value != null && value.length() > 0)
{
- _properties.put(key, value);
+ PropertyValue pv = (PropertyValue)_properties.get(key);
+ if(pv != null)
+ {
+ pv.value = value;
+ }
+ else
+ {
+ pv = new PropertyValue(value, false);
+ }
+ _properties.put(key, pv);
}
else
{
@@ -155,7 +195,7 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
while(p.hasNext())
{
java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- result[i++] = "--" + entry.getKey() + "=" + entry.getValue();
+ result[i++] = "--" + entry.getKey() + "=" + ((PropertyValue)entry.getValue()).value;
}
assert(i == result.length);
return result;
@@ -229,9 +269,26 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
return new PropertiesI(this);
}
+ public synchronized java.util.List
+ getUnusedProperties()
+ {
+ java.util.List unused = new java.util.ArrayList();
+ java.util.Iterator p = _properties.entrySet().iterator();
+ while(p.hasNext())
+ {
+ java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
+ PropertyValue pv = (PropertyValue)entry.getValue();
+ if(!pv.used)
+ {
+ unused.add((String)entry.getKey());
+ }
+ }
+ return unused;
+ }
+
PropertiesI(PropertiesI p)
{
- _properties.putAll(p._properties);
+ _properties = new java.util.HashMap(p._properties);
}
PropertiesI()
@@ -242,7 +299,7 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
{
if(defaults != null)
{
- _properties.putAll(defaults.getPropertiesForPrefix(""));
+ _properties = new java.util.HashMap(((PropertiesI)defaults)._properties);
}
boolean loadConfigFiles = false;
@@ -365,7 +422,7 @@ public final class PropertiesI extends LocalObjectImpl implements Properties
}
}
- setProperty("Ice.Config", value);
+ _properties.put("Ice.Config", new PropertyValue(value, true));
}
private java.util.HashMap _properties = new java.util.HashMap();
diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java
index da3c96dfc0f..ebf3438ba64 100644
--- a/java/src/IceInternal/Instance.java
+++ b/java/src/IceInternal/Instance.java
@@ -658,6 +658,21 @@ public final class Instance
{
serverThreadPool.joinWithAllThreads();
}
+
+ if(_initData.properties.getPropertyAsInt("Ice.Warn.UnusedProperties") > 0)
+ {
+ java.util.List unusedProperties = ((Ice.PropertiesI)_initData.properties).getUnusedProperties();
+ if(unusedProperties.size() != 0)
+ {
+ String message = "The following properties were set but never read:";
+ java.util.Iterator p = unusedProperties.iterator();
+ while(p.hasNext())
+ {
+ message += "\n " + (String)p.next();
+ }
+ _initData.logger.warning(message);
+ }
+ }
}
private void
diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java
index 571ab12303e..85ea56e73b7 100644
--- a/java/src/IceInternal/PropertyNames.java
+++ b/java/src/IceInternal/PropertyNames.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-// Generated by makeprops.py from file `../config/PropertyNames.def', Tue Feb 20 11:10:03 2007
+// Generated by makeprops.py from file `../config/PropertyNames.def', Tue May 15 12:31:29 2007
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -97,6 +97,7 @@ public final class PropertyNames
"^Ice\\.Warn\\.Dispatch$",
"^Ice\\.Warn\\.Endpoints$",
"^Ice\\.Warn\\.UnknownProperties$",
+ "^Ice\\.Warn\\.UnusedProperties$",
"^Ice\\.CacheMessageBuffers$",
null
};