package org.webdsl.lang;

import java.util.HashMap;
import java.util.Map;

import org.webdsl.logging.Logger;

/**
 *  lookup of session variables
 */
public class EnvironmentSessionVariableLookup {

	protected Map<String,Object> variables = new HashMap<String,Object>();

	public EnvironmentSessionVariableLookup(){}

	public Object getVariable(String key) {
		Object o = variables.get(key);
		if(o == null){
			Logger.error(new RuntimeException("session variable lookup failed for name: "+key));
		}
		return o;
	}

	public void putVariable(String key, Object value) {
		variables.put(key, value);
	}

}

package org.webdsl.lang;

import java.util.HashMap;
import java.util.Map;

/**
 *  lookup of session variables
 */
public class EnvironmentSessionVariableLookup {

	protected Map<String,Object> variables = new HashMap<String,Object>();

	public EnvironmentSessionVariableLookup(){}

	public Object getVariable(String key) {
		Object o = variables.get(key);
		if(o != null){
			return o;
		}
		else{
			throw new RuntimeException("session variable lookup failed for name: "+key);   
		}
	}

	public void putVariable(String key, Object value) {
		variables.put(key, value);
	}

}

--- 
+++ 
@@ -2,6 +2,8 @@
 
 import java.util.HashMap;
 import java.util.Map;
+
+import org.webdsl.logging.Logger;
 
 /**
  *  lookup of session variables
@@ -14,12 +16,10 @@
 
 	public Object getVariable(String key) {
 		Object o = variables.get(key);
-		if(o != null){
-			return o;
+		if(o == null){
+			Logger.error(new RuntimeException("session variable lookup failed for name: "+key));
 		}
-		else{
-			throw new RuntimeException("session variable lookup failed for name: "+key);   
-		}
+		return o;
 	}
 
 	public void putVariable(String key, Object value) {
Change handling session variables. When lookup fails, return null instead of throwing exception. It still logs an exception.

svn path=/webdsls/trunk/; revision=6029
