From 6fe3ffa07e6e0118e24a2547e632114f2abb8a82 Mon Sep 17 00:00:00 2001 From: David Gillingham Date: Fri, 31 May 2013 10:42:30 -0500 Subject: [PATCH] Issue #1759: Prevent site-specific paths from getting stuck in IscScript's include path. Change-Id: I8ce909536174192217f5ba228af24cca08796c7b Former-commit-id: cab1c849bf5c32f5452933acd2fc6331d047fc2e [formerly 3ccf091c442e5fd8a0f811745b9861ff03d548a1 [formerly 6ebf8b354145cac21458617b9bb4cdcbedeff7e7]] Former-commit-id: 3ccf091c442e5fd8a0f811745b9861ff03d548a1 Former-commit-id: 88eed9bc17eb8f08fa3ead629adbe427893e0fd9 --- .../edex/plugin/gfe/isc/IscScript.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscScript.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscScript.java index d16e4827b1..3bcac33e7d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscScript.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscScript.java @@ -48,6 +48,8 @@ import com.raytheon.uf.common.util.FileUtil; * Mar 11, 2013 dgilling Initial creation * May 22, 2013 #1759 dgilling Ensure addSitePath() also adds base * path. + * May 31, 2013 #1759 dgilling Ensure any site-specific paths are + * always removed post-execution. * * * @@ -85,11 +87,17 @@ public class IscScript extends PythonScript { public Object execute(String methodName, Map args, String siteId) throws JepException { - addSiteSpecificInclude(siteId); - Object retVal = super.execute(methodName, args); - jep.eval("rollbackImporter.rollback()"); - removeSiteSpecificInclude(siteId); - return retVal; + try { + addSiteSpecificInclude(siteId); + Object retVal = super.execute(methodName, args); + 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() {