struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ing. Andrea Vettori" <m...@andreavettori.com>
Subject Re: [S2] App produces lot garbage IMPORTANT NEWS (I HOPE)
Date Wed, 04 Jul 2007 23:53:31 GMT
All the traces points me to this function on the xwork library
Since it contains an infinte loop it's promising ;)
Need to sleep now, I hope tomorrow to find someone else solution in  
my inbox :)

Thank you




     public static Object translateVariables(char open, String  
expression, ValueStack stack, Class asType, ParsedValueEvaluator  
evaluator) {
         // deal with the "pure" expressions first!
         //expression = expression.trim();
         Object result = expression;

         while (true) {
             int start = expression.indexOf(open + "{");
             int length = expression.length();
             int x = start + 2;
             int end;
             char c;
             int count = 1;
             while (start != -1 && x < length && count != 0) {
                 c = expression.charAt(x++);
                 if (c == '{') {
                     count++;
                 } else if (c == '}') {
                     count--;
                 }
             }
             end = x - 1;

             if ((start != -1) && (end != -1) && (count == 0)) {
                 String var = expression.substring(start + 2, end);

                 Object o = stack.findValue(var, asType);
                 if (evaluator != null) {
                 	o = evaluator.evaluate(o);
                 }


                 String left = expression.substring(0, start);
                 String right = expression.substring(end + 1);
                 if (o != null) {
                     if (TextUtils.stringSet(left)) {
                         result = left + o;
                     } else {
                         result = o;
                     }

                     if (TextUtils.stringSet(right)) {
                         result = result + right;
                     }

                     expression = left + o + right;
                 } else {
                     // the variable doesn't exist, so don't display  
anything
                     result = left + right;
                     expression = left + right;
                 }
             } else {
                 break;
             }
         }

         return XWorkConverter.getInstance().convertValue 
(stack.getContext(), result, asType);
     }



--
Ing. Andrea Vettori
Consulente per l'Information Technology



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message