|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
|
* Copyright 2002-2016 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -158,10 +158,9 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
@@ -158,10 +158,9 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
|
|
|
|
|
public Object getScriptedObject(ScriptSource scriptSource, Class<?>... actualInterfaces) |
|
|
|
|
throws IOException, ScriptCompilationException { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
Class<?> scriptClassToExecute; |
|
|
|
|
|
|
|
|
|
synchronized (this.scriptClassMonitor) { |
|
|
|
|
synchronized (this.scriptClassMonitor) { |
|
|
|
|
try { |
|
|
|
|
Class<?> scriptClassToExecute; |
|
|
|
|
this.wasModifiedForTypeCheck = false; |
|
|
|
|
|
|
|
|
|
if (this.cachedResult != null) { |
|
|
|
@ -186,13 +185,15 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
@@ -186,13 +185,15 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
scriptClassToExecute = this.scriptClass; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Process re-execution outside of the synchronized block.
|
|
|
|
|
return executeScript(scriptSource, scriptClassToExecute); |
|
|
|
|
} |
|
|
|
|
catch (CompilationFailedException ex) { |
|
|
|
|
throw new ScriptCompilationException(scriptSource, ex); |
|
|
|
|
// Process re-execution outside of the synchronized block.
|
|
|
|
|
return executeScript(scriptSource, scriptClassToExecute); |
|
|
|
|
} |
|
|
|
|
catch (CompilationFailedException ex) { |
|
|
|
|
this.scriptClass = null; |
|
|
|
|
this.scriptResultClass = null; |
|
|
|
|
throw new ScriptCompilationException(scriptSource, ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -200,8 +201,8 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
@@ -200,8 +201,8 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
|
|
|
|
|
public Class<?> getScriptedObjectType(ScriptSource scriptSource) |
|
|
|
|
throws IOException, ScriptCompilationException { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
synchronized (this.scriptClassMonitor) { |
|
|
|
|
synchronized (this.scriptClassMonitor) { |
|
|
|
|
try { |
|
|
|
|
if (this.scriptClass == null || scriptSource.isModified()) { |
|
|
|
|
// New script content...
|
|
|
|
|
this.wasModifiedForTypeCheck = true; |
|
|
|
@ -220,9 +221,12 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
@@ -220,9 +221,12 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
|
|
|
|
|
} |
|
|
|
|
return this.scriptResultClass; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (CompilationFailedException ex) { |
|
|
|
|
throw new ScriptCompilationException(scriptSource, ex); |
|
|
|
|
catch (CompilationFailedException ex) { |
|
|
|
|
this.scriptClass = null; |
|
|
|
|
this.scriptResultClass = null; |
|
|
|
|
this.cachedResult = null; |
|
|
|
|
throw new ScriptCompilationException(scriptSource, ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|