Merge "Omaha #5411 Fix NullPointeException when Warngen template is missing productId tag" into omaha_16.2.2
Former-commit-id: 6c2faaf9ac4f0aa75122ff199476ed567186f434
This commit is contained in:
commit
f56ed58cba
2 changed files with 25 additions and 5 deletions
|
@ -190,6 +190,8 @@ public class TemplateRunner {
|
|||
/**
|
||||
* Read cwa and timezone info from officeCityTimezone.txt, and put them into
|
||||
* map officeCityTimezone.
|
||||
*
|
||||
* @return officeCityTimezone map
|
||||
*/
|
||||
public static Map<String, String> createOfficeTimezoneMap() {
|
||||
Map<String, String> officeCityTimezone = new HashMap<String, String>();
|
||||
|
@ -225,6 +227,8 @@ public class TemplateRunner {
|
|||
* @param startTime
|
||||
* @param endTime
|
||||
* @param selectedBullets
|
||||
* @param followupData
|
||||
* @param backupData
|
||||
* @param selectedUpdate
|
||||
* @param backupSite
|
||||
* @return the generated product
|
||||
|
@ -280,14 +284,21 @@ public class TemplateRunner {
|
|||
.getWarngenOfficeShort());
|
||||
}
|
||||
|
||||
String productId = config.getProductId();
|
||||
if (productId == null) {
|
||||
statusHandler.warn("Warngen configuration file: "
|
||||
+ warngenLayer.getTemplateName() + ".xml"
|
||||
+ " does not contain a <productId> tag.");
|
||||
}
|
||||
|
||||
String stormType = stormTrackState.displayType == DisplayType.POLY ? "line"
|
||||
: "single";
|
||||
context.put("stormType", stormType);
|
||||
context.put("mathUtil", new WarnGenMathTool());
|
||||
context.put("dateUtil", new DateUtil());
|
||||
context.put("productId", config.getProductId());
|
||||
context.put("productId", productId);
|
||||
context.put("mixedCaseEnabled",
|
||||
MixedCaseProductSupport.isMixedCase(config.getProductId()));
|
||||
MixedCaseProductSupport.isMixedCase(productId));
|
||||
context.put("pointComparator", new ClosestPointComparator());
|
||||
|
||||
String action = followupData != null ? followupData.getAct()
|
||||
|
|
|
@ -48,7 +48,8 @@ import com.raytheon.uf.common.util.FileUtil;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 1, 2014 #3685 randerso Initial creation
|
||||
* Oct 01, 2014 #3685 randerso Initial creation
|
||||
* Mar 16, 2016 #5411 randerso Added null checks, code cleanup
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -73,6 +74,9 @@ public class MixedCaseProductSupport {
|
|||
|
||||
private static LocalizationFile baseDir;
|
||||
|
||||
/**
|
||||
* @return list of Product IDs enabled for mixed case transmission
|
||||
*/
|
||||
public static Set<String> getMixedCasePids() {
|
||||
// setup up the file updated observer
|
||||
synchronized (MixedCaseProductSupport.class) {
|
||||
|
@ -101,7 +105,7 @@ public class MixedCaseProductSupport {
|
|||
|
||||
Set<String> newPids = new HashSet<String>();
|
||||
for (LocalizationFile lf : fileHierarchy.values()) {
|
||||
String filePath = lf.getFile().getAbsolutePath();
|
||||
String filePath = lf.getPath();
|
||||
try (BufferedReader in = new BufferedReader(
|
||||
new InputStreamReader(lf.openInputStream()))) {
|
||||
|
||||
|
@ -141,12 +145,17 @@ public class MixedCaseProductSupport {
|
|||
}
|
||||
|
||||
public static boolean isMixedCase(String pid) {
|
||||
if (pid == null) {
|
||||
return false;
|
||||
}
|
||||
return getMixedCasePids().contains(pid.toUpperCase());
|
||||
}
|
||||
|
||||
public static String conditionalToUpper(String pid, String text) {
|
||||
if (!isMixedCase(pid)) {
|
||||
text = text.toUpperCase();
|
||||
if (text != null) {
|
||||
text = text.toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
|
|
Loading…
Add table
Reference in a new issue