myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r894803 - in /myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html: HtmlLinkRendererBase.java HtmlRendererUtils.java
Date Thu, 31 Dec 2009 10:26:52 GMT
Author: matzew
Date: Thu Dec 31 10:26:52 2009
New Revision: 894803

URL: http://svn.apache.org/viewvc?rev=894803&view=rev
Log:
MYFACES-2469 - Invalid outcome gives NPE

Modified:
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java?rev=894803&r1=894802&r2=894803&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
Thu Dec 31 10:26:52 2009
@@ -712,7 +712,12 @@
     {
         ResponseWriter writer = facesContext.getResponseWriter();
         Map<String, List<ClientBehavior>> behaviors = null;
-        if (HtmlRendererUtils.isDisabled(output))
+        
+        //calculate href
+        String targetHref = HtmlRendererUtils.getOutcomeTargetLinkHref (facesContext, output);
+
+        
+        if (HtmlRendererUtils.isDisabled(output) || targetHref == null)
         {
             writer.startElement(HTML.SPAN_ELEM, output);
             if (output instanceof ClientBehaviorHolder && JavascriptUtils.isJavascriptAllowed(facesContext.getExternalContext()))
@@ -738,10 +743,7 @@
         }
         else
         {
-            //calculate href
-            String href = facesContext.getExternalContext().encodeResourceURL(
-                    HtmlRendererUtils.getOutcomeTargetLinkHref (facesContext, output));
-
+            String href = facesContext.getExternalContext().encodeResourceURL(targetHref);
             //write anchor
             writer.startElement(HTML.ANCHOR_ELEM, output);
             writer.writeURIAttribute(HTML.HREF_ATTR, href, null);

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?rev=894803&r1=894802&r2=894803&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
Thu Dec 31 10:26:52 2009
@@ -1811,6 +1811,12 @@
         
         //fromAction is null because there
         NavigationCase navigationCase = navigationHandler.getNavigationCase(facesContext,
null, href);
+
+        // when navigation case is null, force the "link" to be rendered as text
+        if (navigationCase == null)
+        {
+            return null;
+        }
         
         href = navigationCase.getToViewId(facesContext);
                 



Mime
View raw message