jon 00/12/17 19:52:34
Modified: src/java/org/apache/velocity Context.java
Log:
NPE checking
Revision Changes Path
1.11 +15 -1 jakarta-velocity/src/java/org/apache/velocity/Context.java
Index: Context.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/Context.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Context.java 2000/12/13 01:52:19 1.10
+++ Context.java 2000/12/18 03:52:33 1.11
@@ -69,7 +69,7 @@
* are stored in a Hashtable.
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: Context.java,v 1.10 2000/12/13 01:52:19 geirm Exp $
+ * @version $Id: Context.java,v 1.11 2000/12/18 03:52:33 jon Exp $
*/
public class Context extends InternalContext implements Cloneable
{
@@ -93,7 +93,12 @@
* @param value The corresponding value.
*/
public void put(String key, Object value)
+ throws Exception
{
+ if (key == null)
+ throw new Exception ("Context key was null! Value was: " + value);
+ else if (value == null)
+ throw new Exception ("Context value was null! Key was: " + key);
context.put(key, value);
}
@@ -104,7 +109,10 @@
* @return The value corresponding to the provided key.
*/
public Object get(String key)
+ throws Exception
{
+ if (key == null)
+ throw new Exception ("Context key was null!");
return context.get(key);
}
@@ -115,7 +123,10 @@
* @return Whether the key is in the context.
*/
public boolean containsKey(Object key)
+ throws Exception
{
+ if (key == null)
+ throw new Exception ("Context key was null!");
return context.containsKey(key);
}
@@ -135,7 +146,10 @@
* if unmapped.
*/
public Object remove(Object key)
+ throws Exception
{
+ if (key == null)
+ throw new Exception ("Context key was null!");
return context.remove(key);
}