[
http://opensource.atlassian.com/projects/hibernate/browse/HV-525?page=com...
]
Hardy Ferentschik commented on HV-525:
--------------------------------------
{quote}
no javascript support?
{quote}
First I thought so, but there actually is via Rhino. It looks like that the Java instance
we are passing to the script engine to call a method on does not get bound properly into
the Javscript environment.
I would think this is a bug in openjdk, but I haven't found anything definitive yet.
All I found is [
this|https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/255149]
which might indicate a problem, but is not directly related.
Our code is quite simple and afaics using the API correctly:
{code}
ublic class ScriptEvaluator {
private final ScriptEngine engine;
/**
* Creates a new script executor.
*
* @param engine The engine to be wrapped.
*/
public ScriptEvaluator(ScriptEngine engine) {
this.engine = engine;
}
/**
* Makes the given object available in then engine-scoped script context and executes the
given script.
* The execution of the script happens either synchronized or unsynchronized, depending
on the engine's
* threading abilities.
*
* @param script The script to be executed.
* @param obj The object to be put into the context.
* @param objectAlias The name under which the given object shall be put into the
context.
*
* @return The script's result.
*
* @throws ScriptException In case of any errors during script execution.
*/
public Object evaluate(String script, Object obj, String objectAlias) throws
ScriptException {
if ( engineAllowsParallelAccessFromMultipleThreads() ) {
return doEvaluate( script, obj, objectAlias );
}
else {
synchronized ( engine ) {
return doEvaluate( script, obj, objectAlias );
}
}
}
private Object doEvaluate(String script, Object obj, String objectAlias) throws
ScriptException {
engine.put( objectAlias, obj );
return engine.eval( script );
}
/**
* Checks, whether the given engine is thread-safe or not.
*
* @return True, if the given engine is thread-safe, false otherwise.
*/
private boolean engineAllowsParallelAccessFromMultipleThreads() {
String threadingType = (String) engine.getFactory().getParameter( "THREADING"
);
return "THREAD-ISOLATED".equals( threadingType ) ||
"STATELESS".equals( threadingType );
}
}
{code}
tests fail on openjdk
---------------------
Key: HV-525
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-525
Project: Hibernate Validator
Issue Type: Bug
Components: tests
Environment: java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.8) (rhel-1.39.1.9.8.el6_1-x86_64)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
Linux stliu-rhel 2.6.32-131.17.1.el6.x86_64
Reporter: Strong Liu
Assignee: Hardy Ferentschik
{noformat}
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Tests run: 429, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 4.698 sec <<<
FAILURE!
Results :
Failed tests:
scriptExpressionReferencingAnnotatedObject(org.hibernate.validator.test.constraints.impl.ScriptAssertValidatorTest):
Error during execution of script "_this.startDate.before(_this.endDate)"
occurred.
scriptExpressionUsingCustomizedAlias(org.hibernate.validator.test.constraints.impl.ScriptAssertValidatorTest):
Error during execution of script "_.startDate.before(_.endDate)" occurred.
Tests run: 429, Failures: 2, Errors: 0, Skipped: 0
{noformat}
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira