Created
December 29, 2014 09:24
-
-
Save nuzayats/fb47df1945e06739c1f2 to your computer and use it in GitHub Desktop.
Patch for ROL-2057
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java (revision ) | |
+++ app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java (revision ) | |
@@ -420,13 +420,19 @@ | |
if (StringUtils.isNotEmpty(page.getOutputContentType())) { | |
contentType = page.getOutputContentType() + "; charset=utf-8"; | |
} else { | |
+ final String defaultContentType = "text/html; charset=utf-8"; | |
+ // prevent NPE at ServletContext#getMimeType(null) on some implementations | |
+ if (page.getLink() == null) { | |
+ contentType = defaultContentType; | |
+ } else { | |
- String mimeType = RollerContext.getServletContext().getMimeType( | |
- page.getLink()); | |
- if (mimeType != null) { | |
- // we found a match ... set the content deviceType | |
- contentType = mimeType + "; charset=utf-8"; | |
- } else { | |
+ String mimeType = RollerContext.getServletContext().getMimeType( | |
+ page.getLink()); | |
+ if (mimeType != null) { | |
+ // we found a match ... set the content deviceType | |
+ contentType = mimeType + "; charset=utf-8"; | |
+ } else { | |
- contentType = "text/html; charset=utf-8"; | |
+ contentType = defaultContentType; | |
+ } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment