@Test(expectedExceptions = ConditionParsingException.class) public void testValidateScriptWithReflection() throws ConditionParsingException { String script = "((System)(Class.forName(\"java.lang.System\")).newInstance()).exit(0);"; this.shell.parse(script); }
@Override public ConditionScript parse(final String script) throws ConditionParsingException { if (StringUtils.isEmpty(script)) { throw new IllegalArgumentException("Script is null or empty."); } try { Script groovyScript = this.shell.parse(script); return new GroovyConditionScript(groovyScript); } catch (CompilationFailedException e) { throw new ConditionParsingException("Failed to validate the condition script.", script, e); } }
GroovyConditionShell implements ConditionShell { @Override public ConditionScript parse(final String script) throws ConditionParsingException { if (StringUtils.isEmpty(script)) { throw new IllegalArgumentException("Script is null or empty."); } try { Script groovyScript = this.shell.parse(script); return new GroovyConditionScript(groovyScript); } catch (CompilationFailedException e) { throw new ConditionParsingException("Failed to validate the condition script.", script, e); } } }
GroovyConditionShell implements ConditionShell { @Override public ConditionScript parse(final String script) throws ConditionParsingException { if (StringUtils.isEmpty(script)) { throw new IllegalArgumentException("Script is null or empty."); } try { Script groovyScript = this.shell.parse(script); return new GroovyConditionScript(groovyScript); } catch (CompilationFailedException e) { throw new ConditionParsingException("Failed to validate the condition script.", script, e); } } GroovyConditionShell(); }
GroovyConditionShell implements ConditionShell { @Override public ConditionScript parse(final String script) throws ConditionParsingException { if (StringUtils.isEmpty(script)) { throw new IllegalArgumentException("Script is null or empty."); } try { Script groovyScript = this.shell.parse(script); return new GroovyConditionScript(groovyScript); } catch (CompilationFailedException e) { throw new ConditionParsingException("Failed to validate the condition script.", script, e); } } GroovyConditionShell(); @Override ConditionScript parse(final String script); }
GroovyConditionShell implements ConditionShell { @Override public ConditionScript parse(final String script) throws ConditionParsingException { if (StringUtils.isEmpty(script)) { throw new IllegalArgumentException("Script is null or empty."); } try { Script groovyScript = this.shell.parse(script); return new GroovyConditionScript(groovyScript); } catch (CompilationFailedException e) { throw new ConditionParsingException("Failed to validate the condition script.", script, e); } } GroovyConditionShell(); @Override ConditionScript parse(final String script);  }