Author: jleroux
Date: Sat Mar 24 09:35:09 2012 New Revision: 1304737 URL: http://svn.apache.org/viewvc?rev=1304737&view=rev Log: Revert r1304193 for now Removed: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/UtilPropertiesTests.java Modified: ofbiz/trunk/framework/base/dtd/ofbiz-properties.xsd ofbiz/trunk/framework/base/testdef/basetests.xml ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelInfo.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Modified: ofbiz/trunk/framework/base/dtd/ofbiz-properties.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/dtd/ofbiz-properties.xsd?rev=1304737&r1=1304736&r2=1304737&view=diff ============================================================================== --- ofbiz/trunk/framework/base/dtd/ofbiz-properties.xsd (original) +++ ofbiz/trunk/framework/base/dtd/ofbiz-properties.xsd Sat Mar 24 09:35:09 2012 @@ -18,31 +18,22 @@ specific language governing permissions under the License. --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> - <xs:import namespace="http://www.w3.org/XML/1998/namespace" - schemaLocation="http://www.w3.org/2001/xml.xsd"/> <xs:element name="resource"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="1" maxOccurs="unbounded" ref="property"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="property"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="property"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="1" maxOccurs="unbounded" name="value" type="valueType"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="value"/> + <xs:attributeGroup ref="attlist.property"/> </xs:sequence> - <xs:attributeGroup ref="attlist.property"/> </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.property"> <xs:attribute type="xs:string" name="key" use="required"/> </xs:attributeGroup> - <xs:complexType name="valueType"> - <xs:simpleContent> - <xs:extension base="xs:string"> - <xs:attribute ref="xml:lang"/> - </xs:extension> - </xs:simpleContent> - </xs:complexType> </xs:schema> Modified: ofbiz/trunk/framework/base/testdef/basetests.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/testdef/basetests.xml?rev=1304737&r1=1304736&r2=1304737&view=diff ============================================================================== --- ofbiz/trunk/framework/base/testdef/basetests.xml (original) +++ ofbiz/trunk/framework/base/testdef/basetests.xml Sat Mar 24 09:35:09 2012 @@ -36,6 +36,5 @@ <junit-test-suite class-name="org.ofbiz.base.json.test.JSONTests"/> <junit-test-suite class-name="org.ofbiz.base.util.test.UtilIOTests"/> <junit-test-suite class-name="org.ofbiz.base.test.BaseUnitTests"/> - <junit-test-suite class-name="org.ofbiz.base.util.test.UtilPropertiesTests"/> </test-group> </test-suite> Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelInfo.java?rev=1304737&r1=1304736&r2=1304737&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelInfo.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelInfo.java Sat Mar 24 09:35:09 2012 @@ -35,7 +35,7 @@ public class LabelInfo { protected String fileName = ""; protected Map<String, LabelValue> labelValues = FastMap.newInstance(); - public LabelInfo(String labelKey, String labelKeyComment, String fileName, String localeStr, String labelValue, String labelComment) { + public LabelInfo(String labelKey, String labelKeyComment, String fileName, String localeStr, String labelValue, String labelComment) throws GeneralException { this.labelKey = labelKey; this.labelKeyComment = labelKeyComment; this.fileName = fileName; @@ -85,9 +85,7 @@ public class LabelInfo { labelValues.remove(localeStr); } } else { - if (Debug.warningOn()) { - Debug.logWarning("Already found locale " + localeStr + " for label " + labelKey + " into the file " + fileName, module); - } + Debug.logWarning("Already found locale " + localeStr + " for label " + labelKey + " into the file " + fileName, module); isDuplicatedLocales = true; } } Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java?rev=1304737&r1=1304736&r2=1304737&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java Sat Mar 24 09:35:09 2012 @@ -60,7 +60,7 @@ public class LabelManagerFactory { protected Set<String> localesFound = new TreeSet<String>(); protected List<LabelInfo> duplicatedLocalesLabelsList = FastList.newInstance(); - public static synchronized LabelManagerFactory getInstance() throws IOException { + public static synchronized LabelManagerFactory getInstance() throws GeneralException, IOException { if (componentNamesFound == null) { loadComponentNames(); } @@ -120,9 +120,7 @@ public class LabelManagerFactory { if (UtilValidate.isNotEmpty(fileName) && !fileName.equals(fileInfo.getFileName())) { continue; } - if (Debug.infoOn()) { - Debug.logInfo("Current file : " + fileInfo.getFileName(), module); - } + Debug.logInfo("Current file : " + fileInfo.getFileName(), module); Document resourceDocument = UtilXml.readXmlDocument(fileInfo.file.toURI().toURL(), false); Element resourceElem = resourceDocument.getDocumentElement(); String labelKeyComment = ""; @@ -134,12 +132,7 @@ public class LabelManagerFactory { for (Node valueNode : UtilXml.childNodeList(propertyElem.getFirstChild())) { if (valueNode instanceof Element) { Element valueElem = (Element) valueNode; - // Support old way of specifying xml:lang value. - // Old way: en_AU, new way: en-AU String localeName = valueElem.getAttribute("xml:lang"); - if( localeName.contains("_")) { - localeName = localeName.replace('_', '-'); - } String labelValue = StringUtil.defaultWebEncoder.canonicalize(UtilXml.nodeValue(valueElem.getFirstChild())); LabelInfo label = labels.get(labelKey + keySeparator + fileInfo.getFileName()); @@ -215,10 +208,8 @@ public class LabelManagerFactory { } else { label.setLabelKeyComment(keyComment); } - if (label != null) { - label.setLabelValue(localeName, localeValue, localeComment, true); - notEmptyLabels++; - } + label.setLabelValue(localeName, localeValue, localeComment, true); + notEmptyLabels++; } } return notEmptyLabels; Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=1304737&r1=1304736&r2=1304737&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original) +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Sat Mar 24 09:35:09 2012 @@ -113,7 +113,6 @@ public class SaveLabelsToXmlFile { Document resourceDocument = UtilXml.makeEmptyXmlDocument("resource"); Element resourceElem = resourceDocument.getDocumentElement(); resourceElem.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); - resourceElem.setAttribute("xsi:noNamespaceSchemaLocation","http://ofbiz.apache.org/dtds/ofbiz-properties.xsd"); for (String labelKey : labelsList) { LabelInfo labelInfo = labels.get(labelKey); if (!(labelInfo.getFileName().equalsIgnoreCase(fileName))) { @@ -136,7 +135,7 @@ public class SaveLabelsToXmlFile { valueString = StringEscapeUtils.unescapeHtml(valueString); Element valueElem = UtilXml.addChildElementValue(propertyElem, "value", valueString, resourceDocument); valueElem.setAttribute("xml:lang", localeFound); - if (valueString.trim().isEmpty()) { + if (valueString.trim().length() == 0) { valueElem.setAttribute("xml:space", "preserve"); } if (UtilValidate.isNotEmpty(labelValue.getLabelComment())) { |
Free forum by Nabble | Edit this page |