From 88ff3c9a23c71a545ee80b3edfa86c495060b04f Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 18 Jan 2010 15:51:00 +0000 Subject: [PATCH] only try to restore attribute if the value differs (ignoring Portlet spec attributes; SPR-6712) --- .../web/servlet/DispatcherServlet.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/DispatcherServlet.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/DispatcherServlet.java index e870cd5525f..269969d4bd0 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/DispatcherServlet.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/DispatcherServlet.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1151,18 +1151,18 @@ public class DispatcherServlet extends FrameworkServlet { // or removing the attribute, respectively, if appropriate. for (String attrName : attrsToCheck) { Object attrValue = attributesSnapshot.get(attrName); - if (attrValue != null) { - if (logger.isDebugEnabled()) { - logger.debug("Restoring original value of attribute [" + attrName + "] after include"); - } - request.setAttribute(attrName, attrValue); - } - else { + if (attrValue == null){ if (logger.isDebugEnabled()) { logger.debug("Removing attribute [" + attrName + "] after include"); } request.removeAttribute(attrName); } + else if (attrValue != request.getAttribute(attrName)) { + if (logger.isDebugEnabled()) { + logger.debug("Restoring original value of attribute [" + attrName + "] after include"); + } + request.setAttribute(attrName, attrValue); + } } }