Omaha #3561 Yet another attempt to fix combinations file updating
Change-Id: I4131ed6043e4bbfa2955024b5e3ce4508734585f Former-commit-id: b1c067fe33d1fe09f89e981b03ef178bcc3a5f93
This commit is contained in:
parent
2b88ade974
commit
9f37d7914a
1 changed files with 26 additions and 15 deletions
|
@ -72,6 +72,7 @@ import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil.ComboData.Entry;
|
||||||
* Sep 30, 2013 2361 njensen Use JAXBManager for XML
|
* Sep 30, 2013 2361 njensen Use JAXBManager for XML
|
||||||
* Feb 05, 2014 #2591 randerso Forced retrieval of combinations file
|
* Feb 05, 2014 #2591 randerso Forced retrieval of combinations file
|
||||||
* Implemented retry on error
|
* Implemented retry on error
|
||||||
|
* Aug 27, 2014 #3561 randerso Yet another attempt to fix combinations file updating
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -227,6 +228,16 @@ public class CombinationsFileUtil {
|
||||||
File pyFile = null;
|
File pyFile = null;
|
||||||
if (lf != null) {
|
if (lf != null) {
|
||||||
try {
|
try {
|
||||||
|
// get the local .py file
|
||||||
|
pyFile = lf.getFile(false);
|
||||||
|
|
||||||
|
// delete both the local .py and .pyo files to force retrieval
|
||||||
|
// and regeneration
|
||||||
|
pyFile.delete();
|
||||||
|
File pyoFile = new File(pyFile.getPath() + "o");
|
||||||
|
pyoFile.delete();
|
||||||
|
|
||||||
|
// retrieve the .py file
|
||||||
pyFile = lf.getFile(true);
|
pyFile = lf.getFile(true);
|
||||||
} catch (LocalizationException e) {
|
} catch (LocalizationException e) {
|
||||||
throw new GfeException("Error retrieving combinations file: "
|
throw new GfeException("Error retrieving combinations file: "
|
||||||
|
@ -234,7 +245,7 @@ public class CombinationsFileUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pyFile == null || !pyFile.exists()) {
|
if ((pyFile == null) || !pyFile.exists()) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,24 +261,24 @@ public class CombinationsFileUtil {
|
||||||
map.put("comboName", comboName);
|
map.put("comboName", comboName);
|
||||||
PythonScript python = null;
|
PythonScript python = null;
|
||||||
for (int retryCount = 0; retryCount < MAX_TRIES; retryCount++) {
|
for (int retryCount = 0; retryCount < MAX_TRIES; retryCount++) {
|
||||||
try {
|
try {
|
||||||
python = new PythonScript(scriptPath,
|
python = new PythonScript(scriptPath,
|
||||||
PyUtil.buildJepIncludePath(
|
PyUtil.buildJepIncludePath(
|
||||||
GfePyIncludeUtil.getCombinationsIncludePath(),
|
GfePyIncludeUtil.getCombinationsIncludePath(),
|
||||||
GfePyIncludeUtil.getCommonPythonIncludePath()),
|
GfePyIncludeUtil.getCommonPythonIncludePath()),
|
||||||
CombinationsFileUtil.class.getClassLoader());
|
CombinationsFileUtil.class.getClassLoader());
|
||||||
|
|
||||||
Object com = python.execute("getCombinations", map);
|
Object com = python.execute("getCombinations", map);
|
||||||
combos = (List<List<String>>) com;
|
combos = (List<List<String>>) com;
|
||||||
|
|
||||||
// if successfully retrieved break out of the loop
|
// if successfully retrieved break out of the loop
|
||||||
break;
|
break;
|
||||||
} catch (JepException e) {
|
} catch (JepException e) {
|
||||||
// remove the .pyo file
|
// remove the .pyo file
|
||||||
new File(pyFile.getAbsolutePath() + "o").delete();
|
new File(pyFile.getAbsolutePath() + "o").delete();
|
||||||
|
|
||||||
// if not last try, log and try again
|
// if not last try, log and try again
|
||||||
if (retryCount < MAX_TRIES - 1) {
|
if (retryCount < (MAX_TRIES - 1)) {
|
||||||
// log but don't pop up
|
// log but don't pop up
|
||||||
statusHandler.handle(Priority.EVENTB,
|
statusHandler.handle(Priority.EVENTB,
|
||||||
"Error loading combinations file: " + comboName
|
"Error loading combinations file: " + comboName
|
||||||
|
@ -275,15 +286,15 @@ public class CombinationsFileUtil {
|
||||||
}
|
}
|
||||||
// else throw exception
|
// else throw exception
|
||||||
else {
|
else {
|
||||||
throw new GfeException("Error loading combinations file: "
|
throw new GfeException("Error loading combinations file: "
|
||||||
+ comboName, e);
|
+ comboName, e);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (python != null) {
|
||||||
|
python.dispose();
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
if (python != null) {
|
|
||||||
python.dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return combos;
|
return combos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue