~tritone-team/tritone/eucalyptus

« back to all changes in this revision

Viewing changes to clc/modules/msgs/src/main/java/com/eucalyptus/util/GroovyUtil.java

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2009-12-01 21:09:28 UTC
  • mto: This revision was merged to the branch mainline in revision 75.
  • Revision ID: james.westby@ubuntu.com-20091201210928-o2dvg0ubljhb0ft6
Tags: upstream-1.6.1~bzr1083
ImportĀ upstreamĀ versionĀ 1.6.1~bzr1083

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import java.io.File;
7
7
import java.io.FileNotFoundException;
8
8
import java.io.FileReader;
 
9
import java.io.IOException;
9
10
 
10
11
import javax.script.ScriptEngine;
11
12
import javax.script.ScriptEngineManager;
41
42
  }
42
43
 
43
44
  public static void evaluateScript( String fileName ) throws FailScriptFailException {
 
45
    FileReader fileReader = null;
44
46
    try {
45
 
      getGroovyEngine().eval( new FileReader( SubDirectory.SCRIPTS + File.separator + fileName ) );
 
47
      fileReader = new FileReader( SubDirectory.SCRIPTS + File.separator + fileName );
 
48
          getGroovyEngine().eval( fileReader );
46
49
    } catch ( Throwable e ) {
47
50
      LOG.debug( e, e );
48
51
      throw new FailScriptFailException( "Executing the requested script failed: " + fileName, e );
 
52
    } finally {
 
53
        if(fileReader != null)
 
54
                        try {
 
55
                                fileReader.close();
 
56
                        } catch (IOException e) {
 
57
                                LOG.error(e);
 
58
                        }
49
59
    }
50
60
  }
51
61