Issue #2729 Fixed error handling in loadPreferences method of loadConfig.py

Change-Id: I75d37583d15decaeb50db0d70fc0ba1f3a8a7b7c

Former-commit-id: bd7e411653 [formerly 11c8529862] [formerly 2abfe6de77 [formerly 552c3e9485ee03c552851c98455e57f12a8f033f]]
Former-commit-id: 2abfe6de77
Former-commit-id: bd502fbe07
This commit is contained in:
Ron Anderson 2014-04-03 12:42:42 -05:00
parent b16405ecb3
commit 8dcbe3a815

View file

@ -58,6 +58,7 @@ import com.raytheon.uf.common.util.FileUtil;
* Sep 05, 2013 #2307 dgilling Use better PythonScript constructor. * Sep 05, 2013 #2307 dgilling Use better PythonScript constructor.
* Sep 11, 2013 #2033 dgilling Don't load loadConfig.py from * Sep 11, 2013 #2033 dgilling Don't load loadConfig.py from
* localization store. * localization store.
* Apr 02, 2014 #2729 randerso Added commonPython to path for LogStream
* *
* </pre> * </pre>
* *
@ -89,6 +90,7 @@ public class PythonPreferenceStore implements IPreferenceStore,
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void loadConfiguration(String configName) { public void loadConfiguration(String configName) {
String commonPythonPath = GfePyIncludeUtil.getCommonPythonIncludePath();
String configPath = GfePyIncludeUtil.getConfigIncludePath(); String configPath = GfePyIncludeUtil.getConfigIncludePath();
String vtecPath = GfePyIncludeUtil.getVtecIncludePath(); String vtecPath = GfePyIncludeUtil.getVtecIncludePath();
@ -100,8 +102,8 @@ public class PythonPreferenceStore implements IPreferenceStore,
new Path(FileUtil.join("python", "utility", new Path(FileUtil.join("python", "utility",
"loadConfig.py")), null)).getPath()); "loadConfig.py")), null)).getPath());
py = new PythonScript(scriptFile.getPath(), py = new PythonScript(scriptFile.getPath(),
PyUtil.buildJepIncludePath(configPath, vtecPath), this PyUtil.buildJepIncludePath(commonPythonPath, configPath,
.getClass().getClassLoader()); vtecPath), this.getClass().getClassLoader());
} catch (JepException e) { } catch (JepException e) {
statusHandler.handle(Priority.CRITICAL, statusHandler.handle(Priority.CRITICAL,
"Unable to load GFE config", e); "Unable to load GFE config", e);
@ -188,7 +190,7 @@ public class PythonPreferenceStore implements IPreferenceStore,
public void firePropertyChangeEvent(String name, Object oldValue, public void firePropertyChangeEvent(String name, Object oldValue,
Object newValue) { Object newValue) {
// The following criteria meets the Eclipse contract // The following criteria meets the Eclipse contract
if (oldValue == null || oldValue.equals(newValue)) { if ((oldValue == null) || oldValue.equals(newValue)) {
return; return;
} }
@ -675,32 +677,32 @@ public class PythonPreferenceStore implements IPreferenceStore,
public boolean isBoolean(String name) { public boolean isBoolean(String name) {
Object obj = selectedConfiguration.get(name); Object obj = selectedConfiguration.get(name);
return (obj != null && obj instanceof Boolean); return ((obj != null) && (obj instanceof Boolean));
} }
public boolean isInt(String name) { public boolean isInt(String name) {
Object obj = selectedConfiguration.get(name); Object obj = selectedConfiguration.get(name);
return (obj != null && obj instanceof Integer); return ((obj != null) && (obj instanceof Integer));
} }
public boolean isFloat(String name) { public boolean isFloat(String name) {
Object obj = selectedConfiguration.get(name); Object obj = selectedConfiguration.get(name);
return (obj != null && obj instanceof Float); return ((obj != null) && (obj instanceof Float));
} }
public boolean isDouble(String name) { public boolean isDouble(String name) {
Object obj = selectedConfiguration.get(name); Object obj = selectedConfiguration.get(name);
return (obj != null && obj instanceof Double); return ((obj != null) && (obj instanceof Double));
} }
public boolean isLong(String name) { public boolean isLong(String name) {
Object obj = selectedConfiguration.get(name); Object obj = selectedConfiguration.get(name);
return (obj != null && obj instanceof Long); return ((obj != null) && (obj instanceof Long));
} }
public boolean isString(String name) { public boolean isString(String name) {
Object obj = selectedConfiguration.get(name); Object obj = selectedConfiguration.get(name);
return (obj != null && obj instanceof String); return ((obj != null) && (obj instanceof String));
} }
public boolean isStringArray(String name) { public boolean isStringArray(String name) {
@ -711,7 +713,7 @@ public class PythonPreferenceStore implements IPreferenceStore,
result = true; result = true;
} else if (obj instanceof List) { } else if (obj instanceof List) {
List<?> list = (List<?>) obj; List<?> list = (List<?>) obj;
if (list.size() == 0 || list.get(0) instanceof String) { if ((list.size() == 0) || (list.get(0) instanceof String)) {
result = true; result = true;
} }
} }
@ -728,7 +730,7 @@ public class PythonPreferenceStore implements IPreferenceStore,
result = true; result = true;
} else if (obj instanceof List) { } else if (obj instanceof List) {
List<?> list = (List<?>) obj; List<?> list = (List<?>) obj;
if (list.size() == 0 || list.get(0) instanceof Float) { if ((list.size() == 0) || (list.get(0) instanceof Float)) {
result = true; result = true;
} }
} }
@ -745,7 +747,7 @@ public class PythonPreferenceStore implements IPreferenceStore,
result = true; result = true;
} else if (obj instanceof List) { } else if (obj instanceof List) {
List<?> list = (List<?>) obj; List<?> list = (List<?>) obj;
if (list.size() == 0 || list.get(0) instanceof Integer) { if ((list.size() == 0) || (list.get(0) instanceof Integer)) {
result = true; result = true;
} }
} }