private SingleScenarioResult runScenario(String packageName,
Scenario scenario,
RuleCoverageListener coverage) throws SerializationException {
PackageItem item = this.getRulesRepository().loadPackage( packageName );
SingleScenarioResult result = null;
// nasty classloader needed to make sure we use the same tree the whole time.
ClassLoader originalCL = Thread.currentThread().getContextClassLoader();
try {
final RuleBase rb = loadCacheRuleBase( item );
ClassLoader cl = ((InternalRuleBase) RuleBaseCache.getInstance().get( item.getUUID() )).getRootClassLoader();
Thread.currentThread().setContextClassLoader( cl );
result = runScenario( scenario,
item,
cl,
rb,
coverage );
} catch (Exception e) {
if ( e instanceof DetailedSerializationException ) {
DetailedSerializationException err = (DetailedSerializationException) e;
result = new SingleScenarioResult();
if ( err.getErrs() != null ) {
//err.getErrs() returns a Collections$UnmodifiablerRandomAccessList that cannot be serialised
//by GWT. Hence we need to convert the errors into a List that can be serialised by GWT
List<BuilderResultLine> errors = new ArrayList<BuilderResultLine>();
for(BuilderResultLine line : err.getErrs()) {