}
protected String compileUnits(JRCompilationUnit[] units, String classpath,
File tempDirFile) throws JRException
{
Context context = ContextFactory.getGlobal().enterContext();
try
{
StringBuffer errors = new StringBuffer();
int errorCount = 0;
for (int i = 0; i < units.length; i++)
{
JRCompilationUnit unit = units[i];
JavaScriptCompileData compileData = new JavaScriptCompileData();
for (Iterator it = unit.getExpressions().iterator(); it.hasNext();)
{
JRExpression expr = (JRExpression) it.next();
int id = unit.getCompileTask().getExpressionId(expr).intValue();
JavaScriptCompileData.Expression jsExpr =
JavaScriptEvaluator.createJSExpression(expr);
//compile the default expression to catch syntax errors
try
{
context.compileString(jsExpr.getDefaultExpression(),
"expression", 0, null);
}
catch (EvaluatorException e)
{
++errorCount;