svn commit: r585761 - in /ofbiz/trunk/framework: entity/src/org/ofbiz/entity/model/ service/src/org/ofbiz/service/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r585761 - in /ofbiz/trunk/framework: entity/src/org/ofbiz/entity/model/ service/src/org/ofbiz/service/

doogie-3
Author: doogie
Date: Wed Oct 17 17:02:59 2007
New Revision: 585761

URL: http://svn.apache.org/viewvc?rev=585761&view=rev
Log:
While tracking down memory usage(using java 1.6 and jhat), I noticed
a significant amount being referenced from the xml definition files.
Interning the strings that are found reduced this usage noticably.
Each string found in an xml file ends up sharing the original array
from the incoming buffer, so more than is nescessary is held in
memory.
Additionally, several strings(for example, partyId) are referenced
several times.  Interning them reduces the memory even further.

Closes https://issues.apache.org/jira/browse/OFBIZ-1291

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelInfo.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelKeyMap.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Wed Oct 17 17:02:59 2007
@@ -189,7 +189,7 @@
         Iterator pkElementIter = pkElementList.iterator();
         while (pkElementIter.hasNext()) {
             Element pkElement = (Element) pkElementIter.next();
-            ModelField field = reader.findModelField(this, pkElement.getAttribute("field"));
+            ModelField field = reader.findModelField(this, pkElement.getAttribute("field").intern());
             if (field != null) {
                 this.pks.add(field);
                 field.isPk = true;
@@ -231,11 +231,11 @@
     }
 
     protected void populateBasicInfo(Element entityElement) {
-        this.entityName = UtilXml.checkEmpty(entityElement.getAttribute("entity-name"));
-        this.tableName = UtilXml.checkEmpty(entityElement.getAttribute("table-name"), ModelUtil.javaNameToDbName(this.entityName));
-        this.packageName = UtilXml.checkEmpty(entityElement.getAttribute("package-name"));
-        this.defaultResourceName = UtilXml.checkEmpty(entityElement.getAttribute("default-resource-name"));
-        this.dependentOn = UtilXml.checkEmpty(entityElement.getAttribute("dependent-on"));
+        this.entityName = UtilXml.checkEmpty(entityElement.getAttribute("entity-name")).intern();
+        this.tableName = UtilXml.checkEmpty(entityElement.getAttribute("table-name"), ModelUtil.javaNameToDbName(this.entityName)).intern();
+        this.packageName = UtilXml.checkEmpty(entityElement.getAttribute("package-name")).intern();
+        this.defaultResourceName = UtilXml.checkEmpty(entityElement.getAttribute("default-resource-name")).intern();
+        this.dependentOn = UtilXml.checkEmpty(entityElement.getAttribute("dependent-on")).intern();
         this.doLock = UtilXml.checkBoolean(entityElement.getAttribute("enable-lock"), false);
         this.noAutoStamp = UtilXml.checkBoolean(entityElement.getAttribute("no-auto-stamp"), false);
         this.neverCache = UtilXml.checkBoolean(entityElement.getAttribute("never-cache"), false);

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java Wed Oct 17 17:02:59 2007
@@ -68,9 +68,9 @@
 
     /** XML Constructor */
     public ModelField(Element fieldElement) {
-        this.type = UtilXml.checkEmpty(fieldElement.getAttribute("type"));
-        this.name = UtilXml.checkEmpty(fieldElement.getAttribute("name"));
-        this.setColName(UtilXml.checkEmpty(fieldElement.getAttribute("col-name")));
+        this.type = UtilXml.checkEmpty(fieldElement.getAttribute("type")).intern();
+        this.name = UtilXml.checkEmpty(fieldElement.getAttribute("name")).intern();
+        this.setColName(UtilXml.checkEmpty(fieldElement.getAttribute("col-name")).intern());
         this.isPk = false; // is set elsewhere
         this.encrypt = UtilXml.checkBoolean(fieldElement.getAttribute("encrypt"), false);
         this.description = UtilXml.childElementValue(fieldElement, "description");
@@ -80,7 +80,7 @@
         for (int i = 0; i < validateList.getLength(); i++) {
             Element element = (Element) validateList.item(i);
 
-            this.validators.add(UtilXml.checkEmpty(element.getAttribute("name")));
+            this.validators.add(UtilXml.checkEmpty(element.getAttribute("name")).intern());
         }
     }
 

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java Wed Oct 17 17:02:59 2007
@@ -50,10 +50,10 @@
 
     /** XML Constructor */
     public ModelFieldType(Element fieldTypeElement) {
-        this.type = UtilXml.checkEmpty(fieldTypeElement.getAttribute("type"));
-        this.javaType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("java-type"));
-        this.sqlType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type"));
-        this.sqlTypeAlias = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type-alias"));
+        this.type = UtilXml.checkEmpty(fieldTypeElement.getAttribute("type")).intern();
+        this.javaType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("java-type")).intern();
+        this.sqlType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type")).intern();
+        this.sqlTypeAlias = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type-alias")).intern();
 
         NodeList validateList = fieldTypeElement.getElementsByTagName("validate");
         for (int i = 0; i < validateList.getLength(); i++) {
@@ -61,7 +61,7 @@
             String methodName = element.getAttribute("method");
             String className = element.getAttribute("class");
             if (methodName != null) {
-                this.validators.add(new ModelFieldValidator(className, methodName));
+                this.validators.add(new ModelFieldValidator(className.intern(), methodName.intern()));
             }            
         }
     }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java Wed Oct 17 17:02:59 2007
@@ -136,7 +136,7 @@
                                 i++;
                                 // utilTimer.timerString("Start loop -- " + i + " --");
                                 Element curFieldType = (Element) curChild;
-                                String fieldTypeName = UtilXml.checkEmpty(curFieldType.getAttribute("type"), "[No type name]");
+                                String fieldTypeName = UtilXml.checkEmpty(curFieldType.getAttribute("type"), "[No type name]").intern();
                                 // utilTimer.timerString("  After fieldTypeName -- " + i + " --");
                                 ModelFieldType fieldType = createModelFieldType(curFieldType, docElement, null);
 

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java Wed Oct 17 17:02:59 2007
@@ -152,8 +152,8 @@
                             do {
                                 if (curChild.getNodeType() == Node.ELEMENT_NODE && "entity-group".equals(curChild.getNodeName())) {
                                     Element curEntity = (Element) curChild;
-                                    String entityName = UtilXml.checkEmpty(curEntity.getAttribute("entity"));
-                                    String groupName = UtilXml.checkEmpty(curEntity.getAttribute("group"));
+                                    String entityName = UtilXml.checkEmpty(curEntity.getAttribute("entity")).intern();
+                                    String groupName = UtilXml.checkEmpty(curEntity.getAttribute("group")).intern();
 
                                     if (groupName == null || entityName == null) continue;
                                     this.groupNames.add(groupName);

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelIndex.java Wed Oct 17 17:02:59 2007
@@ -55,7 +55,7 @@
     public ModelIndex(ModelEntity mainEntity, Element indexElement) {
         super(mainEntity);
 
-        this.name = UtilXml.checkEmpty(indexElement.getAttribute("name"));
+        this.name = UtilXml.checkEmpty(indexElement.getAttribute("name")).intern();
         this.unique = "true".equals(UtilXml.checkEmpty(indexElement.getAttribute("unique")));
 
         NodeList indexFieldList = indexElement.getElementsByTagName("index-field");
@@ -63,7 +63,7 @@
             Element indexFieldElement = (Element) indexFieldList.item(i);
 
             if (indexFieldElement.getParentNode() == indexElement) {
-                String fieldName = indexFieldElement.getAttribute("name");
+                String fieldName = indexFieldElement.getAttribute("name").intern();
                 this.fieldNames.add(fieldName);            }
         }
     }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelInfo.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelInfo.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelInfo.java Wed Oct 17 17:02:59 2007
@@ -18,6 +18,7 @@
  *******************************************************************************/
 package org.ofbiz.entity.model;
 
+import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilXml;
 import org.w3c.dom.Element;
 
@@ -64,19 +65,19 @@
     };
 
     public void populateFromAttributes(Element element) {
-        author = element.getAttribute("author");
-        copyright = element.getAttribute("copyright");
+        author = element.getAttribute("author").intern();
+        copyright = element.getAttribute("copyright").intern();
         description = UtilXml.childElementValue(element, "description");
-        title = element.getAttribute("title");
-        version = element.getAttribute("version");
+        title = element.getAttribute("title").intern();
+        version = element.getAttribute("version").intern();
     }
 
     public void populateFromElements(Element element) {
-        author = UtilXml.childElementValue(element, "author");
-        copyright = UtilXml.childElementValue(element, "copyright");
+        author = StringUtil.internString(UtilXml.childElementValue(element, "author"));
+        copyright = StringUtil.internString(UtilXml.childElementValue(element, "copyright"));
         description = UtilXml.childElementValue(element, "description");
-        title = UtilXml.childElementValue(element, "title");
-        version = UtilXml.childElementValue(element, "version");
+        title = StringUtil.internString(UtilXml.childElementValue(element, "title"));
+        version = StringUtil.internString(UtilXml.childElementValue(element, "version"));
     }
 
     // Strings to go in the comment header.

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelKeyMap.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelKeyMap.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelKeyMap.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelKeyMap.java Wed Oct 17 17:02:59 2007
@@ -50,9 +50,9 @@
 
     /** XML Constructor */
     public ModelKeyMap(Element keyMapElement) {
-        this.fieldName = UtilXml.checkEmpty(keyMapElement.getAttribute("field-name"));
+        this.fieldName = UtilXml.checkEmpty(keyMapElement.getAttribute("field-name")).intern();
         // if no relFieldName is specified, use the fieldName; this is convenient for when they are named the same, which is often the case
-        this.relFieldName = UtilXml.checkEmpty(keyMapElement.getAttribute("rel-field-name"), this.fieldName);
+        this.relFieldName = UtilXml.checkEmpty(keyMapElement.getAttribute("rel-field-name"), this.fieldName).intern();
     }
 
     /** name of the field in this entity */

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java Wed Oct 17 17:02:59 2007
@@ -190,7 +190,7 @@
                                 if ((isEntity || isViewEntity) && curChild.getNodeType() == Node.ELEMENT_NODE) {
                                     i++;
                                     Element curEntityElement = (Element) curChild;
-                                    String entityName = UtilXml.checkEmpty(curEntityElement.getAttribute("entity-name"));
+                                    String entityName = UtilXml.checkEmpty(curEntityElement.getAttribute("entity-name")).intern();
 
                                     // add entityName to appropriate resourceHandlerEntities collection
                                     Collection resourceHandlerEntityNames = (Collection) resourceHandlerEntities.get(entityResourceHandler);

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java Wed Oct 17 17:02:59 2007
@@ -71,10 +71,10 @@
     public ModelRelation(ModelEntity mainEntity, Element relationElement) {
         this.mainEntity = mainEntity;
 
-        this.type = UtilXml.checkEmpty(relationElement.getAttribute("type"));
-        this.title = UtilXml.checkEmpty(relationElement.getAttribute("title"));
-        this.relEntityName = UtilXml.checkEmpty(relationElement.getAttribute("rel-entity-name"));
-        this.fkName = UtilXml.checkEmpty(relationElement.getAttribute("fk-name"));
+        this.type = UtilXml.checkEmpty(relationElement.getAttribute("type")).intern();
+        this.title = UtilXml.checkEmpty(relationElement.getAttribute("title")).intern();
+        this.relEntityName = UtilXml.checkEmpty(relationElement.getAttribute("rel-entity-name")).intern();
+        this.fkName = UtilXml.checkEmpty(relationElement.getAttribute("fk-name")).intern();
 
         NodeList keyMapList = relationElement.getElementsByTagName("key-map");
         for (int i = 0; i < keyMapList.getLength(); i++) {

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Wed Oct 17 17:02:59 2007
@@ -90,8 +90,8 @@
         Iterator memberEntityIter = memberEntityList.iterator();
         while (memberEntityIter.hasNext()) {
             Element memberEntityElement = (Element) memberEntityIter.next();
-            String alias = UtilXml.checkEmpty(memberEntityElement.getAttribute("entity-alias"));
-            String name = UtilXml.checkEmpty(memberEntityElement.getAttribute("entity-name"));
+            String alias = UtilXml.checkEmpty(memberEntityElement.getAttribute("entity-alias")).intern();
+            String name = UtilXml.checkEmpty(memberEntityElement.getAttribute("entity-name")).intern();
             if (name.length() <= 0 || alias.length() <= 0) {
                 Debug.logError("[new ModelViewEntity] entity-alias or entity-name missing on member-entity element of the view-entity " + this.entityName, module);
             } else {
@@ -695,8 +695,8 @@
         }
 
         public ModelAliasAll(Element aliasAllElement) {
-            this.entityAlias = UtilXml.checkEmpty(aliasAllElement.getAttribute("entity-alias"));
-            this.prefix = UtilXml.checkEmpty(aliasAllElement.getAttribute("prefix"));
+            this.entityAlias = UtilXml.checkEmpty(aliasAllElement.getAttribute("entity-alias")).intern();
+            this.prefix = UtilXml.checkEmpty(aliasAllElement.getAttribute("prefix")).intern();
             this.groupBy = "true".equals(UtilXml.checkEmpty(aliasAllElement.getAttribute("group-by")));
             this.function = UtilXml.checkEmpty(aliasAllElement.getAttribute("function"));
             
@@ -706,7 +706,7 @@
                 Iterator excludeIter = excludes.iterator();
                 while (excludeIter.hasNext()) {
                     Element excludeElement = (Element) excludeIter.next();
-                    this.fieldsToExclude.add(excludeElement.getAttribute("field"));
+                    this.fieldsToExclude.add(excludeElement.getAttribute("field").intern());
                 }
             }
             
@@ -755,10 +755,10 @@
         protected ModelAlias() {}
 
         public ModelAlias(Element aliasElement) {
-            this.entityAlias = UtilXml.checkEmpty(aliasElement.getAttribute("entity-alias"));
-            this.name = UtilXml.checkEmpty(aliasElement.getAttribute("name"));
-            this.field = UtilXml.checkEmpty(aliasElement.getAttribute("field"), this.name);
-            this.colAlias = UtilXml.checkEmpty(aliasElement.getAttribute("col-alias"), ModelUtil.javaNameToDbName(UtilXml.checkEmpty(this.name)));
+            this.entityAlias = UtilXml.checkEmpty(aliasElement.getAttribute("entity-alias")).intern();
+            this.name = UtilXml.checkEmpty(aliasElement.getAttribute("name")).intern();
+            this.field = UtilXml.checkEmpty(aliasElement.getAttribute("field"), this.name).intern();
+            this.colAlias = UtilXml.checkEmpty(aliasElement.getAttribute("col-alias"), ModelUtil.javaNameToDbName(UtilXml.checkEmpty(this.name))).intern();
             String primKeyValue = UtilXml.checkEmpty(aliasElement.getAttribute("prim-key"));
 
             if (UtilValidate.isNotEmpty(primKeyValue)) {
@@ -767,8 +767,8 @@
                 this.isPk = null;
             }
             this.groupBy = "true".equals(UtilXml.checkEmpty(aliasElement.getAttribute("group-by")));
-            this.function = UtilXml.checkEmpty(aliasElement.getAttribute("function"));
-            this.description = UtilXml.childElementValue(aliasElement, "description");
+            this.function = UtilXml.checkEmpty(aliasElement.getAttribute("function")).intern();
+            this.description = UtilXml.checkEmpty(UtilXml.childElementValue(aliasElement, "description")).intern();
             
             Element complexAliasElement = UtilXml.firstChildElement(aliasElement, "complex-alias");
             if (complexAliasElement != null) {
@@ -858,7 +858,7 @@
         }
         
         public ComplexAlias(Element complexAliasElement) {
-            this.operator = complexAliasElement.getAttribute("operator");
+            this.operator = complexAliasElement.getAttribute("operator").intern();
             // handle all complex-alias and complex-alias-field sub-elements
             List subElements = UtilXml.childElementList(complexAliasElement);
             Iterator subElementIter = subElements.iterator();
@@ -907,10 +907,10 @@
         protected String function = null;
         
         public ComplexAliasField(Element complexAliasFieldElement) {
-            this.entityAlias = complexAliasFieldElement.getAttribute("entity-alias");
-            this.field = complexAliasFieldElement.getAttribute("field");
-            this.defaultValue = complexAliasFieldElement.getAttribute("default-value");
-            this.function = complexAliasFieldElement.getAttribute("function");
+            this.entityAlias = complexAliasFieldElement.getAttribute("entity-alias").intern();
+            this.field = complexAliasFieldElement.getAttribute("field").intern();
+            this.defaultValue = complexAliasFieldElement.getAttribute("default-value").intern();
+            this.function = complexAliasFieldElement.getAttribute("function").intern();
         }
 
         public ComplexAliasField(String entityAlias, String field, String defaultValue, String function) {
@@ -960,8 +960,8 @@
         protected ModelViewLink() {}
 
         public ModelViewLink(Element viewLinkElement) {
-            this.entityAlias = UtilXml.checkEmpty(viewLinkElement.getAttribute("entity-alias"));
-            this.relEntityAlias = UtilXml.checkEmpty(viewLinkElement.getAttribute("rel-entity-alias"));
+            this.entityAlias = UtilXml.checkEmpty(viewLinkElement.getAttribute("entity-alias")).intern();
+            this.relEntityAlias = UtilXml.checkEmpty(viewLinkElement.getAttribute("rel-entity-alias")).intern();
             // if anything but true will be false; ie defaults to false
             this.relOptional = "true".equals(viewLinkElement.getAttribute("rel-optional"));
 

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=585761&r1=585760&r2=585761&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java Wed Oct 17 17:02:59 2007
@@ -255,12 +255,12 @@
     protected ModelService createModelService(Element serviceElement) {
         ModelService service = new ModelService();
 
-        service.name = UtilXml.checkEmpty(serviceElement.getAttribute("name"));
-        service.engineName = UtilXml.checkEmpty(serviceElement.getAttribute("engine"));
-        service.location = UtilXml.checkEmpty(serviceElement.getAttribute("location"));
-        service.invoke = UtilXml.checkEmpty(serviceElement.getAttribute("invoke"));
-        service.semaphore = UtilXml.checkEmpty(serviceElement.getAttribute("semaphore"));
-        service.defaultEntityName = UtilXml.checkEmpty(serviceElement.getAttribute("default-entity-name"));
+        service.name = UtilXml.checkEmpty(serviceElement.getAttribute("name")).intern();
+        service.engineName = UtilXml.checkEmpty(serviceElement.getAttribute("engine")).intern();
+        service.location = UtilXml.checkEmpty(serviceElement.getAttribute("location")).intern();
+        service.invoke = UtilXml.checkEmpty(serviceElement.getAttribute("invoke")).intern();  
+        service.semaphore = UtilXml.checkEmpty(serviceElement.getAttribute("semaphore")).intern();
+        service.defaultEntityName = UtilXml.checkEmpty(serviceElement.getAttribute("default-entity-name")).intern();
         service.fromLoader = isFromURL ? readerURL.toExternalForm() : handler.getLoaderName();        
 
         // these default to true; if anything but true, make false
@@ -421,8 +421,8 @@
         while (si.hasNext()) {
             Element element = (Element) si.next();
             ModelPermission perm = new ModelPermission();
-            perm.nameOrRole = element.getAttribute("permission");
-            perm.action = element.getAttribute("action");
+            perm.nameOrRole = element.getAttribute("permission").intern();
+            perm.action = element.getAttribute("action").intern();
             if (perm.action != null && perm.action.length() > 0) {
                 perm.permissionType = ModelPermission.ENTITY_PERMISSION;
             } else {
@@ -438,7 +438,7 @@
             Element element = (Element) ri.next();
             ModelPermission perm = new ModelPermission();
             perm.permissionType = ModelPermission.ROLE_MEMBER;
-            perm.nameOrRole = element.getAttribute("role-type");
+            perm.nameOrRole = element.getAttribute("role-type").intern();
             perm.serviceModel = service;
             group.permissions.add(perm);
         }
@@ -461,7 +461,7 @@
                 
         while (implIter.hasNext()) {
             Element implement = (Element) implIter.next();
-            String serviceName = UtilXml.checkEmpty(implement.getAttribute("service"));
+            String serviceName = UtilXml.checkEmpty(implement.getAttribute("service")).intern();
             boolean optional = UtilXml.checkBoolean(implement.getAttribute("optional"), false);
             if (serviceName.length() > 0)
                 service.implServices.add(new ModelServiceIface(serviceName, optional));
@@ -521,7 +521,7 @@
                             param.fieldName = field.getName();
                             param.name = field.getName();
                             param.type = fieldType.getJavaType();
-                            param.mode = UtilXml.checkEmpty(autoElement.getAttribute("mode"));
+                            param.mode = UtilXml.checkEmpty(autoElement.getAttribute("mode")).intern();
                             param.optional = "true".equalsIgnoreCase(autoElement.getAttribute("optional")); // default to true
                             param.formDisplay = !"false".equalsIgnoreCase(autoElement.getAttribute("form-display")); // default to false                        
                             modelParamMap.put(field.getName(), param);
@@ -564,14 +564,14 @@
             Element attribute = (Element) paramIter.next();
             ModelParam param = new ModelParam();
 
-            param.name = UtilXml.checkEmpty(attribute.getAttribute("name"));
-            param.type = UtilXml.checkEmpty(attribute.getAttribute("type"));
-            param.mode = UtilXml.checkEmpty(attribute.getAttribute("mode"));
-            param.entityName = UtilXml.checkEmpty(attribute.getAttribute("entity-name"));
-            param.fieldName = UtilXml.checkEmpty(attribute.getAttribute("field-name"));
-            param.stringMapPrefix = UtilXml.checkEmpty(attribute.getAttribute("string-map-prefix"));
-            param.stringListSuffix = UtilXml.checkEmpty(attribute.getAttribute("string-list-suffix"));
-            param.formLabel = attribute.hasAttribute("form-label")?attribute.getAttribute("form-label"):null;
+            param.name = UtilXml.checkEmpty(attribute.getAttribute("name")).intern();
+            param.type = UtilXml.checkEmpty(attribute.getAttribute("type")).intern();
+            param.mode = UtilXml.checkEmpty(attribute.getAttribute("mode")).intern();
+            param.entityName = UtilXml.checkEmpty(attribute.getAttribute("entity-name")).intern();
+            param.fieldName = UtilXml.checkEmpty(attribute.getAttribute("field-name")).intern();
+            param.stringMapPrefix = UtilXml.checkEmpty(attribute.getAttribute("string-map-prefix")).intern();
+            param.stringListSuffix = UtilXml.checkEmpty(attribute.getAttribute("string-list-suffix")).intern();
+            param.formLabel = attribute.hasAttribute("form-label")?attribute.getAttribute("form-label").intern():null;
             param.optional = "true".equalsIgnoreCase(attribute.getAttribute("optional")); // default to true
             param.formDisplay = !"false".equalsIgnoreCase(attribute.getAttribute("form-display")); // default to false
 
@@ -579,7 +579,7 @@
             String defValue = attribute.getAttribute("default-value");
             if (UtilValidate.isNotEmpty(defValue)) {
                 Debug.logInfo("Got a default-value [" + defValue + "] for service attribute [" + service.name + "." + param.name + "]", module);
-                param.setDefaultValue(defValue);
+                param.setDefaultValue(defValue.intern());
             }
             
             // set the entity name to the default if not specified
@@ -690,19 +690,19 @@
             if (param != null) {                                                        
                 // set only modified values
                 if (attribute.getAttribute("type") != null && attribute.getAttribute("type").length() > 0) {                
-                    param.type = UtilXml.checkEmpty(attribute.getAttribute("type"));
+                    param.type = UtilXml.checkEmpty(attribute.getAttribute("type")).intern();
                 }
                 if (attribute.getAttribute("mode") != null && attribute.getAttribute("mode").length() > 0) {                            
-                    param.mode = UtilXml.checkEmpty(attribute.getAttribute("mode"));
+                    param.mode = UtilXml.checkEmpty(attribute.getAttribute("mode")).intern();
                 }
                 if (attribute.getAttribute("entity-name") != null && attribute.getAttribute("entity-name").length() > 0) {
-                   param.entityName = UtilXml.checkEmpty(attribute.getAttribute("entity-name"));
+                   param.entityName = UtilXml.checkEmpty(attribute.getAttribute("entity-name")).intern();
                 }
                 if (attribute.getAttribute("field-name") != null && attribute.getAttribute("field-name").length() > 0) {
-                    param.fieldName = UtilXml.checkEmpty(attribute.getAttribute("field-name"));
+                    param.fieldName = UtilXml.checkEmpty(attribute.getAttribute("field-name")).intern();
                 }
                 if (attribute.getAttribute("form-label") != null && attribute.getAttribute("form-label").length() > 0) {                
-                    param.formLabel = UtilXml.checkEmpty(attribute.getAttribute("form-label"));
+                    param.formLabel = UtilXml.checkEmpty(attribute.getAttribute("form-label")).intern();
                 }
                 if (attribute.getAttribute("optional") != null && attribute.getAttribute("optional").length() > 0) {                            
                     param.optional = "true".equalsIgnoreCase(attribute.getAttribute("optional")); // default to true
@@ -739,18 +739,18 @@
 
             Iterator i = validateElements.iterator();
             Element validate = (Element) i.next();
-            String methodName = validate.getAttribute("method");
-            String className = validate.getAttribute("class");
+            String methodName = validate.getAttribute("method").intern();
+            String className = validate.getAttribute("class").intern();
 
             Element fail = UtilXml.firstChildElement(validate, "fail-message");
             if (fail != null) {
-                String message = fail.getAttribute("message");
+                String message = fail.getAttribute("message").intern();
                 param.addValidator(className, methodName, message);
             } else {
                 fail = UtilXml.firstChildElement(validate, "fail-property");
                 if (fail != null) {
-                    String resource = fail.getAttribute("resource");
-                    String property = fail.getAttribute("property");
+                    String resource = fail.getAttribute("resource").intern();
+                    String property = fail.getAttribute("property").intern();
                     param.addValidator(className, methodName, resource, property);
                 }
             }