ebourg 2004/10/21 11:36:14
Modified: configuration/xdocs changes.xml
configuration/src/java/org/apache/commons/configuration
JNDIConfiguration.java
Log:
JNDIConfiguration.getKeys() now returns an empty iterator instead of throwing a ConfigurationRuntimeException
when a NamingException occurs.
The NamingExceptions are now all logged.
Added a more explicit javadoc on the methods throwing an UnsupportedOperationException.
Revision Changes Path
1.68 +5 -0 jakarta-commons/configuration/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- changes.xml 21 Oct 2004 18:02:09 -0000 1.67
+++ changes.xml 21 Oct 2004 18:36:14 -0000 1.68
@@ -9,6 +9,11 @@
<release version="1.1-dev" date="in CVS">
<action dev="ebourg" type="fix">
+ JNDIConfiguration.getKeys() now returns an empty iterator instead of
+ throwing a ConfigurationRuntimeException when a NamingException occurs.
+ The NamingExceptions are now logged.
+ </action>
+ <action dev="ebourg" type="fix">
DatabaseConfiguration.isEmpty() now returns true if an SQLException occurs.
</action>
<action dev="ebourg" type="add">
1.20 +22 -23 jakarta-commons/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java
Index: JNDIConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- JNDIConfiguration.java 4 Oct 2004 20:06:09 -0000 1.19
+++ JNDIConfiguration.java 21 Oct 2004 18:36:14 -0000 1.20
@@ -26,10 +26,8 @@
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.NotContextException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -110,10 +108,10 @@
}
/**
- * JNDIConfigurations can not be added to.
+ * <p><strong>This operation is not supported and will throw an
+ * UnsupportedOperationException.</strong></p>
*
- * @param key The Key to add the property to.
- * @param token The Value to add.
+ * @throws UnsupportedOperationException
*/
public void addProperty(String key, Object token)
{
@@ -221,7 +219,8 @@
}
catch (NamingException e)
{
- throw new ConfigurationRuntimeException(e.getMessage(), e);
+ log.error(e.getMessage(), e);
+ return new ArrayList().iterator();
}
}
@@ -278,9 +277,10 @@
}
/**
- * {@inheritDoc}
+ * <p><strong>This operation is not supported and will throw an
+ * UnsupportedOperationException.</strong></p>
*
- * <b>This operation is not supported</b>
+ * @throws UnsupportedOperationException
*/
public Properties getProperties(String key)
{
@@ -310,9 +310,9 @@
}
}
}
- catch (NamingException ne)
+ catch (NamingException e)
{
- log.warn(ne);
+ log.error(e.getMessage(), e);
return true;
}
}
@@ -326,7 +326,10 @@
}
/**
- * {@inheritDoc}
+ * <p><strong>This operation is not supported and will throw an
+ * UnsupportedOperationException.</strong></p>
+ *
+ * @throws UnsupportedOperationException
*/
public void setProperty(String key, Object value)
{
@@ -357,8 +360,9 @@
getBaseContext().lookup(key);
return true;
}
- catch (NamingException ne)
+ catch (NamingException e)
{
+ log.error(e.getMessage(), e);
return false;
}
}
@@ -399,23 +403,18 @@
key = StringUtils.replace(key, ".", "/");
return getBaseContext().lookup(key);
}
- catch (NameNotFoundException e)
- {
- return null;
- }
- catch (NotContextException e)
- {
- return null;
- }
catch (NamingException e)
{
- e.printStackTrace();
+ log.error(e.getMessage(), e);
return null;
}
}
/**
- * {@inheritDoc}
+ * <p><strong>This operation is not supported and will throw an
+ * UnsupportedOperationException.</strong></p>
+ *
+ * @throws UnsupportedOperationException
*/
protected void addPropertyDirect(String key, Object obj)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
|