tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r894457 - /tomcat/trunk/java/org/apache/catalina/startup/WebXml.java
Date Tue, 29 Dec 2009 17:47:36 GMT
Author: markt
Date: Tue Dec 29 17:47:36 2009
New Revision: 894457

URL: http://svn.apache.org/viewvc?rev=894457&view=rev
Log:
XML output tweaks
Fix some NPEs in the merge of session-config elements
Fix a copy and paste error in the merge of session-config elements

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/WebXml.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/WebXml.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/WebXml.java?rev=894457&r1=894456&r2=894457&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/WebXml.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/WebXml.java Tue Dec 29 17:47:36 2009
@@ -590,9 +590,11 @@
             appendElement(sb, INDENT4, "enabled", servletDef.getEnabled());
             appendElement(sb, INDENT4, "async-supported",
                     servletDef.getAsyncSupported());
-            sb.append("    <run-as>\n");
-            appendElement(sb, INDENT6, "role-name", servletDef.getRunAs());
-            sb.append("    </run-as>\n");
+            if (servletDef.getRunAs() != null) {
+                sb.append("    <run-as>\n");
+                appendElement(sb, INDENT6, "role-name", servletDef.getRunAs());
+                sb.append("    </run-as>\n");
+            }
             for (SecurityRoleRef roleRef : servletDef.getSecurityRoleRefs()) {
                 sb.append("    <security-role-ref>\n");
                 appendElement(sb, INDENT6, "role-name", roleRef.getName());
@@ -1491,8 +1493,10 @@
                     }
                 }
             }
-            sessionConfig.setSessionTimeout(
-                    temp.getSessionConfig().getSessionTimeout().toString());
+            if (temp.getSessionConfig().getSessionTimeout() != null) {
+                sessionConfig.setSessionTimeout(
+                        temp.getSessionConfig().getSessionTimeout().toString());
+            }
         }
         
         if (sessionConfig.getCookieName() == null) {
@@ -1597,8 +1601,10 @@
                     }
                 }
             }
-            sessionConfig.setCookieHttpOnly(
-                    temp.getSessionConfig().getCookieHttpOnly().toString());
+            if (temp.getSessionConfig().getCookieHttpOnly() != null) {
+                sessionConfig.setCookieHttpOnly(
+                        temp.getSessionConfig().getCookieHttpOnly().toString());
+            }
         }
         if (sessionConfig.getCookieSecure() == null) {
             for (WebXml fragment : fragments) {
@@ -1618,8 +1624,10 @@
                     }
                 }
             }
-            sessionConfig.setCookieSecure(
-                    temp.getSessionConfig().getCookieSecure().toString());
+            if (temp.getSessionConfig().getCookieSecure() != null) {
+                sessionConfig.setCookieSecure(
+                        temp.getSessionConfig().getCookieSecure().toString());
+            }
         }
         if (sessionConfig.getCookieMaxAge() == null) {
             for (WebXml fragment : fragments) {
@@ -1639,8 +1647,10 @@
                     }
                 }
             }
-            sessionConfig.setCookieMaxAge(
-                    temp.getSessionConfig().getCookieMaxAge().toString());
+            if (temp.getSessionConfig().getCookieMaxAge() != null) {
+                sessionConfig.setCookieMaxAge(
+                        temp.getSessionConfig().getCookieMaxAge().toString());
+            }
         }
 
         if (sessionConfig.getSessionTrackingModes().size() == 0) {
@@ -1662,8 +1672,8 @@
                     }
                 }
             }
-            sessionConfig.setSessionTimeout(
-                    temp.getSessionConfig().getSessionTimeout().toString());
+            sessionConfig.getSessionTrackingModes().addAll(
+                    temp.getSessionConfig().getSessionTrackingModes());
         }
         
         for (WebXml fragment : fragments) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message