Avoid unnecessary cast
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 13 Oct 2010 15:16:35 +0000 (15:16 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 13 Oct 2010 15:16:35 +0000 (15:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1022134 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/StandardContext.java

index e810ebf..e46e761 100644 (file)
@@ -5562,11 +5562,11 @@ public class StandardContext extends ContainerBase
         dir.mkdirs();
 
         // Set the appropriate servlet context attribute
-        getServletContext().setAttribute(ServletContext.TEMPDIR, dir);
-        if (getServletContext() instanceof ApplicationContext)
-            ((ApplicationContext) getServletContext()).setAttributeReadOnly
-                (ServletContext.TEMPDIR);
-
+        if (context == null) {
+            getServletContext();
+        }
+        context.setAttribute(ServletContext.TEMPDIR, dir);
+        context.setAttributeReadOnly(ServletContext.TEMPDIR);
     }