cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r450249 - in /cocoon/branches/BRANCH_2_1_X: src/java/org/apache/cocoon/transformation/I18nTransformer.java status.xml
Date Tue, 26 Sep 2006 23:04:21 GMT
Author: vgritsenko
Date: Tue Sep 26 16:04:20 2006
New Revision: 450249

URL: http://svn.apache.org/viewvc?view=rev&rev=450249
Log:
    <action dev="VG" type="fix">
      Core: i18n transformer was loosing whitespaces in i18n:text, i18n:translate,
      i18n:param elements if they had mixed content.
    </action>


Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/I18nTransformer.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/I18nTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/I18nTransformer.java?view=diff&rev=450249&r1=450248&r2=450249
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/I18nTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/I18nTransformer.java
Tue Sep 26 16:04:20 2006
@@ -1465,59 +1465,65 @@
     }
 
     private void i18nCharacters(String textValue) throws SAXException {
-        // Trim text values to avoid parsing errors.
-        textValue = textValue.trim();
-        if (textValue.length() == 0) {
-            return;
-        }
-
         if (getLogger().isDebugEnabled()) {
-            getLogger().debug( "i18n message text = '" + textValue + "'" );
+            getLogger().debug("i18n message text = '" + textValue + "'");
         }
 
-        char[] ch = textValue.toCharArray();
+        SaxBuffer buffer;
         switch (current_state) {
             case STATE_INSIDE_TEXT:
-                text_recorder.characters(ch, 0, ch.length);
+                buffer = text_recorder;
                 break;
 
             case STATE_INSIDE_PARAM:
-                param_recorder.characters(ch, 0, ch.length);
+                buffer = param_recorder;
                 break;
 
             case STATE_INSIDE_WHEN:
             case STATE_INSIDE_OTHERWISE:
                 // Previously handeld to avoid the String() conversion.
-                break;
+                return;
 
             case STATE_INSIDE_TRANSLATE:
-                if(tr_text_recorder == null) {
+                if (tr_text_recorder == null) {
                     tr_text_recorder = new ParamSaxBuffer();
                 }
-                tr_text_recorder.characters(ch, 0, ch.length);
+                buffer = tr_text_recorder;
                 break;
 
             case STATE_INSIDE_CHOOSE:
                 // No characters allowed. Send an exception ?
-                getLogger().debug("No characters allowed inside <i18n:choose> tags");
-                break;
+                if (getLogger().isDebugEnabled()) {
+                    textValue = textValue.trim();
+                    if (textValue.length() > 0) {
+                        getLogger().debug("No characters allowed inside <i18n:choose>
tag. Received: " + textValue);
+                    }
+                }
+                return;
 
             case STATE_INSIDE_DATE:
             case STATE_INSIDE_DATE_TIME:
             case STATE_INSIDE_TIME:
             case STATE_INSIDE_NUMBER:
-                if (formattingParams.get(I18N_VALUE_ATTRIBUTE) == null) {
-                    formattingParams.put(I18N_VALUE_ATTRIBUTE, textValue);
-                } else {
-                    // ignore the text inside of date element
+                // Trim text values to avoid parsing errors.
+                textValue = textValue.trim();
+                if (textValue.length() > 0) {
+                    if (formattingParams.get(I18N_VALUE_ATTRIBUTE) == null) {
+                        formattingParams.put(I18N_VALUE_ATTRIBUTE, textValue);
+                    } else {
+                        // ignore the text inside of date element
+                    }
                 }
-                break;
+                return;
 
             default:
                 throw new IllegalStateException(getClass().getName() +
                                                 " developer's fault: characters not handled.
" +
                                                 "Current state: " + current_state);
         }
+
+        char[] ch = textValue.toCharArray();
+        buffer.characters(ch, 0, ch.length);
     }
 
     // Translate all attributes that are listed in i18n:attr attribute

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&rev=450249&r1=450248&r2=450249
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Tue Sep 26 16:04:20 2006
@@ -184,8 +184,14 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.10" date="TBD">
+    <action dev="VG" type="fix">
+      Core: i18n transformer was loosing whitespaces in i18n:text, i18n:translate,
+      i18n:param elements if they had mixed content.
+    </action>
     <action dev="JBQ" type="fix" fixes-bug="COCOON-1919" due-to="Guillaume Déflache"
due-to-email="guillaume@anyware-tech.com">
-      In AbstractWidgetDefinitionBuilder, methods "setValidators", "setCreateListeners",
and "setCommonProperties" now have visibility "protected" instead of "private"
+      CForms: In AbstractWidgetDefinitionBuilder, methods "setValidators",
+      "setCreateListeners", and "setCommonProperties" now have visibility "protected"
+      instead of "private"
     </action>
     <action dev="AN" type="fix">
       Core: Rewrite of WildcardMatcherHelper where the heavy-lifting is left to the regexp
library.



Mime
View raw message