You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2007/02/19 13:10:56 UTC
svn commit: r509175 - in /myfaces/tobago/trunk:
sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
Author: lofwyr
Date: Mon Feb 19 04:10:55 2007
New Revision: 509175
URL: http://svn.apache.org/viewvc?view=rev&rev=509175
Log:
Using StringUtils.contains instead of String.indexOf > -1 to prevent NullPointerException
Modified:
myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java
Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java?view=diff&rev=509175&r1=509174&r2=509175
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java Mon Feb 19 04:10:55 2007
@@ -23,6 +23,7 @@
*/
import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_LINK;
@@ -74,7 +75,7 @@
// expand state
String expandState = (String) requestParameterMap.get(treeId);
String searchString = ";" + nodeStateId + ";";
- if (expandState.indexOf(searchString) > -1) {
+ if (StringUtils.contains(expandState, searchString)) {
state.addExpandState((DefaultMutableTreeNode) node.getValue());
}
@@ -82,7 +83,7 @@
if (TreeRenderer.isSelectable(tree)) { // selection
String selected = (String) requestParameterMap.get(treeId + UITree.SELECT_STATE);
searchString = ";" + nodeStateId + ";";
- if (selected.indexOf(searchString) > -1) {
+ if (StringUtils.contains(selected, searchString)) {
state.addSelection((DefaultMutableTreeNode) node.getValue());
}
}
@@ -169,9 +170,9 @@
// tip
String tip = (String) treeNode.getAttributes().get(ATTR_TIP);
if (tip != null) {
- tip = StringEscapeUtils.escapeJavaScript(tip.toString());
+ tip = StringEscapeUtils.escapeJavaScript(tip);
writer.writeText("'", null);
- writer.writeText((String) tip, null);
+ writer.writeText(tip, null);
writer.writeText("','", null);
} else {
writer.writeText("null,'", null);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java?view=diff&rev=509175&r1=509174&r2=509175
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java Mon Feb 19 04:10:55 2007
@@ -28,6 +28,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.StringUtils;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -62,7 +63,7 @@
// expand state
String expandState = (String) requestParameterMap.get(treeId);
String searchString = ";" + nodeId + ";";
- if (expandState.indexOf(searchString) > -1) {
+ if (StringUtils.contains(expandState, searchString)) {
state.addExpandState((DefaultMutableTreeNode) node.getValue());
}
@@ -70,7 +71,7 @@
if (TreeOldRenderer.isSelectable(tree)) { // selection
String selected = (String) requestParameterMap.get(treeId + UITreeOld.SELECT_STATE);
searchString = ";" + nodeId + ";";
- if (selected.indexOf(searchString) > -1) {
+ if (StringUtils.contains(selected, searchString)) {
state.addSelection((DefaultMutableTreeNode) node.getValue());
}
}