[sword-svn] r373 - trunk/webapp

scribe at crosswire.org scribe at crosswire.org
Thu Jul 15 21:13:05 MST 2010


Author: scribe
Date: 2010-07-15 21:13:05 -0700 (Thu, 15 Jul 2010)
New Revision: 373

Modified:
   trunk/webapp/bookdisplay.jsp
   trunk/webapp/dailydevotion.jsp
   trunk/webapp/fulllibrary.jsp
   trunk/webapp/init.jsp
   trunk/webapp/parallelstudy.jsp
   trunk/webapp/passagestudy.jsp
   trunk/webapp/powersearch.jsp
   trunk/webapp/wordsearchresults.jsp
Log:
Added safeguard {} around single line 'if' statements for future safety.  Thanks for bug report from M?\195?\161bio Coelho


Modified: trunk/webapp/bookdisplay.jsp
===================================================================
--- trunk/webapp/bookdisplay.jsp	2010-07-16 03:53:59 UTC (rev 372)
+++ trunk/webapp/bookdisplay.jsp	2010-07-16 04:13:05 UTC (rev 373)
@@ -38,8 +38,9 @@
 		forceOpen = true;
 	}
 	gbsEntry = (String)session.getAttribute("gbsEntry");
-	if (gbsEntry == null)
+	if (gbsEntry == null) {
 		gbsEntry = "/";
+	}
 
 	String action = (String)request.getParameter("action");
 	if ((action != null) && (action.equalsIgnoreCase("closeAll"))) {
@@ -78,8 +79,9 @@
 					}
 				}
 			}
-			if (nodes.length > 0)
+			if (nodes.length > 0) {
 				currentJumpNode = nodes[0];
+			}
 		}
 	}
 

Modified: trunk/webapp/dailydevotion.jsp
===================================================================
--- trunk/webapp/dailydevotion.jsp	2010-07-16 03:53:59 UTC (rev 372)
+++ trunk/webapp/dailydevotion.jsp	2010-07-16 04:13:05 UTC (rev 373)
@@ -4,8 +4,9 @@
 <%@ page import="java.util.Date" %>
 <%
 	String resetModule = request.getParameter("mod");
-	if (resetModule != null)
+	if (resetModule != null) {
 		session.setAttribute("ActiveDevo", resetModule);
+	}
 	String activeDevoName = (String) session.getAttribute("ActiveDevo");
 	SWModule activeDevo = mgr.getModuleByName((activeDevoName == null) ? "DBD" : activeDevoName);
 

Modified: trunk/webapp/fulllibrary.jsp
===================================================================
--- trunk/webapp/fulllibrary.jsp	2010-07-16 03:53:59 UTC (rev 372)
+++ trunk/webapp/fulllibrary.jsp	2010-07-16 04:13:05 UTC (rev 373)
@@ -8,8 +8,9 @@
 
 	String action = (String)request.getParameter("action");
 	String show = (String)request.getParameter("show");
-	if (show != null)
+	if (show != null) {
 		session.setAttribute("catShow", show);
+	}
 	show = (String)session.getAttribute("catShow");
 	if ((action != null) && (action.equalsIgnoreCase("closeAll"))) {
 		catTreeOpen = null;
@@ -26,8 +27,9 @@
 			for (int j = 0; j < nodes.length; j++) {
 				String node = nodes[j];
 				if (node != null) {
-					if (i>0)
+					if (i>0) {
 						catTreeOpen.remove(node);
+					}
 					else {
 						if (!catTreeOpen.contains(node)) {
 							catTreeOpen.add(node);
@@ -125,8 +127,9 @@
 				}
 
 				String promoLine = module.getConfigEntry("ShortPromo");
-				if (promoLine.equalsIgnoreCase("<swnull>"))
+				if (promoLine.equalsIgnoreCase("<swnull>")) {
 					promoLine = "";
+				}
 %>
 	<h2><a href="<%= targetURL %>"><%= module.getDescription() %></a></h2>
 	<p><%= about %></p>

Modified: trunk/webapp/init.jsp
===================================================================
--- trunk/webapp/init.jsp	2010-07-16 03:53:59 UTC (rev 372)
+++ trunk/webapp/init.jsp	2010-07-16 04:13:05 UTC (rev 373)
@@ -221,8 +221,9 @@
 	Vector parDispModules = (Vector)session.getAttribute("ParDispModules");
 
 	String prefStyle = (String)request.getParameter("setStyle");
-	if (prefStyle == null)
+	if (prefStyle == null) {
 		prefStyle = (String)session.getAttribute("PrefStyle");
+	}
 	else {	// set style cookie
 		Cookie c = new Cookie("PrefStyle", prefStyle);
 		c.setMaxAge(java.lang.Integer.MAX_VALUE);
@@ -231,8 +232,9 @@
 	}
 
 	String footnotes = (String)request.getParameter("Footnotes");
-	if (footnotes == null)
+	if (footnotes == null) {
 		footnotes = (String)session.getAttribute("Footnotes");
+	}
 	else {	// set style cookie
 		Cookie c = new Cookie("Footnotes", footnotes);
 		c.setMaxAge(java.lang.Integer.MAX_VALUE);
@@ -241,8 +243,9 @@
 	}
 
 	String xrefs = (String)request.getParameter("Cross-references");
-	if (xrefs == null)
+	if (xrefs == null) {
 		xrefs = (String)session.getAttribute("Cross-references");
+	}
 	else {	// set style cookie
 		Cookie c = new Cookie("Cross-references", xrefs);
 		c.setMaxAge(java.lang.Integer.MAX_VALUE);
@@ -251,8 +254,9 @@
 	}
 
 	String headings = (String)request.getParameter("Headings");
-	if (headings == null)
+	if (headings == null) {
 		headings = (String)session.getAttribute("Headings");
+	}
 	else {	// set style cookie
 		Cookie c = new Cookie("Headings", headings);
 		c.setMaxAge(java.lang.Integer.MAX_VALUE);
@@ -261,8 +265,9 @@
 	}
 
 	String javascript = (String)request.getParameter("Javascript");
-	if (javascript == null)
+	if (javascript == null) {
 		javascript = (String)session.getAttribute("Javascript");
+	}
 	else {	// set style cookie
 		Cookie c = new Cookie("Javascript", javascript);
 		c.setMaxAge(java.lang.Integer.MAX_VALUE);
@@ -344,8 +349,9 @@
 				while (end > 0) {
 					end = line.indexOf("+",start);
 					field = (end > 0) ? line.substring(start, end) : line.substring(start);
-					if (start > 3) 		// skip the first one cuz it's not a real module
+					if (start > 3) {		// skip the first one cuz it's not a real module
 						prefBibles.add(field);
+					}
 					start = end + 1;
 				}
 			}
@@ -357,8 +363,9 @@
 				while (end > 0) {
 					end = line.indexOf("+",start);
 					field = (end > 0) ? line.substring(start, end) : line.substring(start);
-					if (start > 3)  		// skip the first one cuz it's not a real module
+					if (start > 3) {		// skip the first one cuz it's not a real module
 						prefCommentaries.add(field);
+					}
 					start = end + 1;
 				}
 			}
@@ -370,23 +377,28 @@
 				while (end > 0) {
 					end = line.indexOf("+",start);
 					field = (end > 0) ? line.substring(start, end) : line.substring(start);
-					if (start > 3)  		// skip the first one cuz it's not a real module
+					if (start > 3) {		// skip the first one cuz it's not a real module
 						parDispModules.add(field);
+					}
 					start = end + 1;
 				}
 			}
 		}
 	}
 
-	if (prefBibles == null)
+	if (prefBibles == null) {
 		prefBibles = new Vector();
-	if (prefCommentaries == null)
+	}
+	if (prefCommentaries == null) {
 		prefCommentaries = new Vector();
-	if (parDispModules == null)
+	}
+	if (parDispModules == null) {
 		parDispModules = new Vector();
+	}
 
-	if ((prefStyle == null) || (styleNames.indexOf(prefStyle) < 0))
+	if ((prefStyle == null) || (styleNames.indexOf(prefStyle) < 0)) {
 		prefStyle = defaultStyle;
+	}
 
 	String appLang = request.getParameter("lang");
 	if (appLang == null) {

Modified: trunk/webapp/parallelstudy.jsp
===================================================================
--- trunk/webapp/parallelstudy.jsp	2010-07-16 03:53:59 UTC (rev 372)
+++ trunk/webapp/parallelstudy.jsp	2010-07-16 04:13:05 UTC (rev 373)
@@ -38,13 +38,15 @@
 	SWModule activeModule = mgr.getModuleByName((String)parDispModules.get(0));
 
 	String resetKey = request.getParameter("key");
-	if (resetKey != null)
+	if (resetKey != null) {
 		resetKey = new String(resetKey.getBytes("iso8859-1"), "UTF-8");
 		session.setAttribute("ActiveKey", resetKey);
+	}
 
 	String activeKey = (String) session.getAttribute("ActiveKey");
-	if (activeKey == null)
+	if (activeKey == null) {
 		activeKey = "jas 1:19"; // our fallback key
+	}
 
  	// be sure it's formatted nicely
 	if (activeModule != null) {
@@ -293,8 +295,9 @@
 			for (activeModule.setKeyText(chapterPrefix + ":1"); (activeModule.error() == (char)0); activeModule.next()) {
 
 				String keyText = activeModule.getKeyText();
-				if (!chapterPrefix.equals(keyText.substring(0, keyText.indexOf(":"))))
+				if (!chapterPrefix.equals(keyText.substring(0, keyText.indexOf(":")))) {
 					break;
+				}
 
 				int curVerse = Integer.parseInt(keyText.substring(keyText.indexOf(":")+1));
 				mgr.setGlobalOption("Strong's Numbers",
@@ -359,10 +362,12 @@
 					SWModule mod = mgr.getModuleByName((String)parDispModules.get(i));
 					String copyLine = mod.getConfigEntry("ShortCopyright");
 					String promoLine = mod.getConfigEntry("ShortPromo");
-					if (copyLine.equalsIgnoreCase("<swnull>"))
+					if (copyLine.equalsIgnoreCase("<swnull>")) {
 						copyLine = "";
-					if (promoLine.equalsIgnoreCase("<swnull>"))
+					}
+					if (promoLine.equalsIgnoreCase("<swnull>")) {
 						promoLine = "";
+					}
 					if (mod.getCategory().equals("Cults / Unorthodox / Questionable Material")) {
 						copyLine = "<t:t>WARNING: This text is considered unorthodox by most of Christendom.</t:t> " + copyLine;
 					}

Modified: trunk/webapp/passagestudy.jsp
===================================================================
--- trunk/webapp/passagestudy.jsp	2010-07-16 03:53:59 UTC (rev 372)
+++ trunk/webapp/passagestudy.jsp	2010-07-16 04:13:05 UTC (rev 373)
@@ -4,21 +4,25 @@
 	session.setAttribute("lastModType", "Bible");
 	Vector toolsTreeOpen = (Vector)session.getAttribute("toolsTreeOpen");
 	String resetModule = request.getParameter("mod");
-	if (resetModule != null)
+	if (resetModule != null) {
 		session.setAttribute("ActiveModule", resetModule);
+	}
 	String activeModuleName = (String) session.getAttribute("ActiveModule");
 	SWModule activeModule = mgr.getModuleByName((activeModuleName == null) ? defaultBible : activeModuleName);
 	String promoLine = activeModule.getConfigEntry("ShortPromo");
-	if (promoLine.equalsIgnoreCase("<swnull>"))
+	if (promoLine.equalsIgnoreCase("<swnull>")) {
 		promoLine = "";
+	}
 
 	String resetKey = request.getParameter("key");
-	if (resetKey != null)
+	if (resetKey != null) {
 		resetKey = new String(resetKey.getBytes("iso8859-1"), "UTF-8");
 		session.setAttribute("ActiveKey", resetKey);
+	}
 	String activeKey = (String) session.getAttribute("ActiveKey");
-	if (activeKey == null)
+	if (activeKey == null) {
 		activeKey = "jas 1:19";
+	}
 
 	if (toolsTreeOpen == null) {
 		toolsTreeOpen = new Vector();
@@ -45,8 +49,9 @@
 			for (int j = 0; j < nodes.length; j++) {
 				String node = nodes[j];
 				if (node != null) {
-					if (i>0)
+					if (i > 0) {
 						toolsTreeOpen.remove(node);
+					}
 					else {
 						if (!toolsTreeOpen.contains(node)) {
 							toolsTreeOpen.add(node);
@@ -245,8 +250,9 @@
 						first = false;
 					}
 					int curVerse = Integer.parseInt(keyText.substring(keyText.indexOf(":")+1));
-					if (!chapterPrefix.equals(keyText.substring(0, keyText.indexOf(":"))))
+					if (!chapterPrefix.equals(keyText.substring(0, keyText.indexOf(":")))) {
 						break;
+					}
 					mgr.setGlobalOption("Strong's Numbers",
 							((strongs) && (curVerse >= activeVerse -1) && (curVerse <= activeVerse + 1)) ? "on" : "off");
 					mgr.setGlobalOption("Morphological Tags",
@@ -358,8 +364,9 @@
 			<%
 			}
 			String copyLine = activeModule.getConfigEntry("ShortCopyright");
-			if (copyLine.equalsIgnoreCase("<swnull>"))
+			if (copyLine.equalsIgnoreCase("<swnull>")) {
 				copyLine = "";
+			}
 			if (activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material")) {
 				copyLine = "<t:t>WARNING: This text is considered unorthodox by most of Christendom.</t:t> " + copyLine;
 			}

Modified: trunk/webapp/powersearch.jsp
===================================================================
--- trunk/webapp/powersearch.jsp	2010-07-16 03:53:59 UTC (rev 372)
+++ trunk/webapp/powersearch.jsp	2010-07-16 04:13:05 UTC (rev 373)
@@ -2,8 +2,9 @@
 
 <%
 	String resetModule = request.getParameter("mod");
-	if (resetModule != null)
+	if (resetModule != null) {
 		session.setAttribute("ActiveModule", resetModule);
+	}
 	String activeModuleName = (String) session.getAttribute("ActiveModule");
 	SWModule activeModule = mgr.getModuleByName((activeModuleName == null) ? defaultBible : activeModuleName);
 %>

Modified: trunk/webapp/wordsearchresults.jsp
===================================================================
--- trunk/webapp/wordsearchresults.jsp	2010-07-16 03:53:59 UTC (rev 372)
+++ trunk/webapp/wordsearchresults.jsp	2010-07-16 04:13:05 UTC (rev 373)
@@ -30,22 +30,26 @@
 
 	String range = "";
 	String tmp = request.getParameter("range");
-	if (tmp != null)
+	if (tmp != null) {
 		range = tmp;
+	}
 
 	SearchType stype = (activeModule.hasSearchFramework()) ? SearchType.LUCENE : SearchType.MULTIWORD;
 	tmp = request.getParameter("stype");
 	if (tmp != null) {
-		if (tmp.equalsIgnoreCase("P"))
+		if (tmp.equalsIgnoreCase("P")) {
 			stype = SearchType.PHRASE;
-		if (tmp.equalsIgnoreCase("R"))
+		}
+		if (tmp.equalsIgnoreCase("R")) {
 			stype = SearchType.REGEX;
+		}
 	}
 
 	int soptions = 0;	// default to NOT ignore case
 	tmp = request.getParameter("icase");
-	if ((tmp != null) && (tmp.equals("1")))
+	if ((tmp != null) && (tmp.equals("1"))) {
 		soptions = 2;
+	}
 %>
 <tiles:insert beanName="basic" flush="true" >
 	<tiles:put name="title" type="string">
@@ -125,8 +129,9 @@
 				results = (SearchHit[]) session.getAttribute("SearchResults");
 			}
 
-			if ( results == null )
+			if ( results == null ) {
 				results = new SearchHit[0];
+			}
 		%>
 
 		<p class="textname">&raquo; <%= results.length %> result<%= (results.length == 1)?"s":""%> <t:t>in the text of </t:t><%= activeModule.getDescription() %></p>
@@ -159,8 +164,9 @@
 		<ul class="searchresultsnav">
 			<%
 				int navStart = (resultStart.intValue() / resultLimit.intValue()) - 5;
-				if (navStart < 0)
+				if (navStart < 0) {
 					navStart = 0;
+				}
 
 				int navEnd = navStart + 10;
 				if ( navEnd*resultLimit.intValue() > results.length ) {




More information about the sword-cvs mailing list