Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reported issues #24

Merged
merged 1 commit into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,11 @@ public Object evaluateScript( String script, List<String> classPath, Map<String,

if ( globalVariables != null )
{
for ( String variable : globalVariables.keySet() )
for ( Map.Entry<String, ?> entry : globalVariables.entrySet() )
{
Object value = globalVariables.get( variable );
try
{
engine.set( variable, value );
engine.set( entry.getKey(), entry.getValue() );
}
catch ( EvalError e )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,22 @@
import java.io.PrintStream;

/**
* <p>ExecutionLogger interface.</p>
*
* @author Olivier Lamy
*/
public interface ExecutionLogger
{
/**
* The stream which will catch the output of the {@link ScriptRunner}.
*
* The stream which will catch the output of the {@link org.apache.maven.shared.scriptinterpreter.ScriptRunner}.
*
* @return the output stream
*/
PrintStream getPrintStream();

/**
* Consume logging from this component.
*
*
* @param line the line to consume
*/
void consumeLine( String line );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public class ScriptEvaluationException
super( cause );
}

/**
* Creates a new exception with the specified message and cause.
*
* @param message The message, may be <code>null</code>.
* @param cause The cause, may be <code>null</code>.
*/
public ScriptEvaluationException( String message, Throwable cause )
{
super( message, cause );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public class ScriptException
{
private static final long serialVersionUID = 4553276474852776472L;

/**
* Creates a new exception with the specified message and cause.
*
* @param message The message, may be <code>null</code>.
* @param cause The cause, may be <code>null</code>.
*/
public ScriptException( String message, Throwable cause )
{
super( message, cause );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public class ScriptReturnException extends ScriptException

private final Object result;

/**
* Creates a new exception with the specified message and result.
*
* @param message The message, may be <code>null</code>.
* @param result The cause, may be <code>null</code>.
*/
ScriptReturnException( String message, Object result )
{
super( message );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class ScriptRunner
private String encoding;

/**
* Creates a new script runner.
* Creates a new script runner with BSH and Groovy interpreters.
*/
public ScriptRunner()
{
Expand All @@ -78,6 +78,12 @@ public ScriptRunner()
classPath = new ArrayList<>();
}

/**
* Add new script Interpreter
*
* @param id The Id of interpreter
* @param scriptInterpreter the Script Interpreter implementation
*/
public void addScriptInterpreter( String id, ScriptInterpreter scriptInterpreter )
{
scriptInterpreters.put( id, scriptInterpreter );
Expand Down