You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2003/08/29 23:21:29 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardServer.java
remm 2003/08/29 14:21:29
Modified: catalina/src/share/org/apache/catalina/core
StandardServer.java
Log:
- Implement my simple trick: don't save the value of properties which have their
default values. A number of fields are saved while they really shouldn't, but
it's significantly better.
- Revert if it causes problems.
Revision Changes Path
1.19 +13 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardServer.java
Index: StandardServer.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- StandardServer.java 19 Jul 2003 14:30:07 -0000 1.18
+++ StandardServer.java 29 Aug 2003 21:21:29 -0000 1.19
@@ -1064,6 +1064,8 @@
// Render the relevant properties of this bean
String className = bean.getClass().getName();
+ // Create blank instance
+ Object bean2 = bean.getClass().newInstance();
for (int i = 0; i < descriptors.length; i++) {
if (descriptors[i] instanceof IndexedPropertyDescriptor) {
continue; // Indexed properties are not persisted
@@ -1076,11 +1078,18 @@
Object value =
PropertyUtils.getSimpleProperty(bean,
descriptors[i].getName());
+ Object value2 =
+ PropertyUtils.getSimpleProperty(bean2,
+ descriptors[i].getName());
if (value == null) {
continue; // Null values are not persisted
}
if (isException(className, descriptors[i].getName())) {
continue; // Skip the specified exceptions
+ }
+ if (value.equals(value2)) {
+ // The property has its default value
+ continue;
}
if (!(value instanceof String)) {
value = value.toString();