myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1568897 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
Date Mon, 17 Feb 2014 08:09:15 GMT
Author: lofwyr
Date: Mon Feb 17 08:09:15 2014
New Revision: 1568897

URL: http://svn.apache.org/r1568897
Log:
TOBAGO-1365: NPE in PageRenderer, when applicationIcon wasn't found

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java?rev=1568897&r1=1568896&r2=1568897&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
Mon Feb 17 08:09:15 2014
@@ -232,26 +232,30 @@ public class PageRenderer extends PageRe
         checkDuplicates(theme.getStyleResources(productionMode), FacesContextUtils.getStyleFiles(facesContext));
       }
 
-      String icon = page.getApplicationIcon();
+      final String icon = page.getApplicationIcon();
       if (icon != null) {
-        // XXX unify with image renderer
+        final String href;
         if (ResourceManagerUtils.isAbsoluteResource(icon)) {
-          // absolute Path to image : nothing to do
+          href = icon;
         } else {
-          icon = ResourceManagerUtils.getImageWithPath(facesContext, icon);
+          href = ResourceManagerUtils.getImageWithPath(facesContext, icon);
         }
 
-        writer.startElement(HtmlElements.LINK, null);
-        if (icon.endsWith(".ico")) {
-          writer.writeAttribute(HtmlAttributes.REL, "shortcut icon", false);
-          writer.writeAttribute(HtmlAttributes.HREF, icon, false);
+        if (href != null) {
+          writer.startElement(HtmlElements.LINK, null);
+          if (href.endsWith(".ico")) {
+            writer.writeAttribute(HtmlAttributes.REL, "shortcut icon", false);
+            writer.writeAttribute(HtmlAttributes.HREF, href, false);
+          } else {
+            // XXX IE only supports ICO files for favicons
+            writer.writeAttribute(HtmlAttributes.REL, "icon", false);
+            writer.writeAttribute(HtmlAttributes.TYPE, MimeTypeUtils.getMimeTypeForFile(href),
false);
+            writer.writeAttribute(HtmlAttributes.HREF, href, false);
+          }
+          writer.endElement(HtmlElements.LINK);
         } else {
-          // XXX IE only supports ICO files for favicons
-          writer.writeAttribute(HtmlAttributes.REL, "icon", false);
-          writer.writeAttribute(HtmlAttributes.TYPE, MimeTypeUtils.getMimeTypeForFile(icon),
false);
-          writer.writeAttribute(HtmlAttributes.HREF, icon, false);
+          LOG.warn("Application icon '" + icon + "' not found!");
         }
-        writer.endElement(HtmlElements.LINK);
       }
 
       // style sniplets



Mime
View raw message