Merge "Issue #1759: Prevent site-specific paths from getting stuck in IscScript's include path." into omaha_13.4.1

Former-commit-id: c3f8ab24ea [formerly 7e1d2d273f [formerly 08de853f51cf46cb8b8a7b9f26b355ec59c164ab]]
Former-commit-id: 7e1d2d273f
Former-commit-id: 1b9e0c2047
This commit is contained in:
Ron Anderson 2013-05-31 12:09:49 -05:00 committed by Gerrit Code Review
commit 7f15e7e7ab

View file

@ -48,6 +48,8 @@ import com.raytheon.uf.common.util.FileUtil;
* Mar 11, 2013 dgilling Initial creation * Mar 11, 2013 dgilling Initial creation
* May 22, 2013 #1759 dgilling Ensure addSitePath() also adds base * May 22, 2013 #1759 dgilling Ensure addSitePath() also adds base
* path. * path.
* May 31, 2013 #1759 dgilling Ensure any site-specific paths are
* always removed post-execution.
* *
* </pre> * </pre>
* *
@ -85,11 +87,17 @@ public class IscScript extends PythonScript {
public Object execute(String methodName, Map<String, Object> args, public Object execute(String methodName, Map<String, Object> args,
String siteId) throws JepException { String siteId) throws JepException {
addSiteSpecificInclude(siteId); try {
Object retVal = super.execute(methodName, args); addSiteSpecificInclude(siteId);
jep.eval("rollbackImporter.rollback()"); Object retVal = super.execute(methodName, args);
removeSiteSpecificInclude(siteId); return retVal;
return retVal; } finally {
// if we don't ensure these two modifications to the python include
// path happen after every execution, site-specific paths can get
// stuck if a JepException is thrown by the execute() method.
jep.eval("rollbackImporter.rollback()");
removeSiteSpecificInclude(siteId);
}
} }
public String getScriptName() { public String getScriptName() {