You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tiles.apache.org by "Antonio Petrelli (JIRA)" <ji...@apache.org> on 2008/03/02 20:49:07 UTC
[jira] Resolved: (TILES-255) forward not checking for null on
getRequestDispatcher(path)
[ https://issues.apache.org/struts/browse/TILES-255?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Antonio Petrelli resolved TILES-255.
------------------------------------
Resolution: Fixed
Applied a modified version of the patch submitted by Thom Hehl.
Thanks Thom!
> forward not checking for null on getRequestDispatcher(path)
> -----------------------------------------------------------
>
> Key: TILES-255
> URL: https://issues.apache.org/struts/browse/TILES-255
> Project: Tiles
> Issue Type: Bug
> Components: tiles-core
> Affects Versions: 2.0.5
> Reporter: Thom Hehl
> Assignee: Antonio Petrelli
> Fix For: 2.0.6
>
>
> getRequestDispatcher(path) may return null if it cannot create a request dispatcher. In ServletTilesRequestContext.forward getRequestDispatcher is called, but the variable rd is never checked for null and can cause a NullPointerException in error conditions. Please change code from:
> private void forward(String path) throws IOException {
> RequestDispatcher rd = request.getRequestDispatcher(path);
> try {
> rd.forward(request, response);
> } catch (ServletException ex) {
> LOG.error("Servlet Exception while including path", ex);
> throw new IOException("Error including path '" + path + "'. "
> + ex.getMessage());
> }
> }
> to:
> private void forward(String path) throws IOException {
> RequestDispatcher rd = request.getRequestDispatcher(path);
> if(rd==null){
> LOG.error("No request dispatcher returned for path", ex);
> throw new IOException("No request dispatcher returned for path '" + path + "'. "
> + ex.getMessage());
> }
> try {
> rd.forward(request, response);
> } catch (ServletException ex) {
> LOG.error("Servlet Exception while including path", ex);
> throw new IOException("Error including path '" + path + "'. "
> + ex.getMessage());
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.