Context context = ContextFactory.getGlobal().enterContext();
context.setOptimizationLevel(0);
context.setLanguageVersion(Context.VERSION_1_6);
// -1 for lineno arg prevents Rhino from appending
// "(unnamed script#1)" to all error messages
context.compileReader(reader, null, -1, null);
} finally {
Context.exit();
}
} catch (IOException e) {
throw newDatatypeException(e.getMessage());