Bug 328221 Several error messages are confusing/useless
Build Identifier: BIRT 2.5.2 I've fixed a couple of error messages in BIRT 2.5.2 which are confusing/useless. See the attached patches. I'm aware that this patch is for an old version of BIRT but maybe they are still useful for someone stuck with BIRT 2.5.2. I didn't check whether the errors are still there in 2.6; feel free to have a look. Bugs fixed: 1. When a pre-compiled method is run and an error happens, the source of the method is included (so you get more than "There was an error in __bm_OPEN"). 2. Instead of "data.engine.BadFetchScriptReturnType", you get a real error message with the method name and the value returned. 3. If logging is enabled for jdbc.Statement, the log would fill with thousands of stack traces warning that "setSpecification is not supported." Feel free to use the patches in any legal way. Reproducible: Always
data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/script/JSMethodRunner.java
* name within the scope (such as "afterOpen", "onFetch" etc.). This class 
	 * assumes that the content of a named method script is immutable, therefore
	 * it defines each named script only once.
	 * @param methodName Identification of the script
	 * @param script Script text
	 * @return Return value from the script
	 */
	public Object runScript( String methodName, String script ) throws BirtException
	{
		
		methodName = METHOD_NAME_PREFIX + methodName;
		
		
		if ( ! scope.has( methodName, scope ) )
		{
			
			String scriptText = "function " + methodName + "() {\n"
					+ script + "\n} ";
			ScriptEvalUtil.evaluateJSAsExpr( cx, scope, scriptText, ScriptExpression.defaultID, 1 );
		}
			
		
		String callScriptText = methodName + "()";
		Object result = ScriptEvalUtil.evaluateJSAsExpr( cx, scope, 
				callScriptText, ScriptExpression.defaultID, 1 );
		return result;
	}
	
}