You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ernesto Reinaldo Barreiro <re...@gmail.com> on 2013/02/13 08:38:30 UTC

problems with "AJAX function" processEvaluation (1.4.x - 6.x)

Hi,

We are having problems on Wicket 1.4.x with and "AJAX function"
processEvaluation... and I see the code is practically the same at 6.x. So,
let's bring the subject to the list...

Our problem is that after evaluating some expressions with errors, screen
"freezes" because post-call handlers are not called. Problem seems to be
related to the code.

                                // test if the javascript is in form of
identifier|code
// if it is, we allow for letting the javascript decide when the rest of
processing will continue
// by invoking identifier();
var res = text.match(new
RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n)*)$"));

if (res !== null) {
var f = jQuery.noop;
text = "f = function(" + res[1] + ") {" + res[2] + "};";

try {
// do the evaluation
eval(text);
f(notify);
} catch (exception) {
Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating
javascript: " + exception + ", text: " + text);
}

}


Questions:

1- Shouldn't

text = "f = function(" + res[1] + ") {" + res[2] + "};";

be

text = "f = function(" + res[1] + ") {" + res[2] + ";" + res[1]+"();" +"};";

so that f(notify) ==> notify() gets called?

2- In case of error. Shouldn't it be

                                      try {
// do the evaluation
eval(text);
f(notify);
} catch (exception) {
Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating
javascript: " + exception + ", text: " + text);
                                                notify();
}

So that next steps in processing get called. The above solves or freezing
problem in case of error but... I'm still not sure about 1) above.

Can someone shed some light on the above?

Thanks in advance!

-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>

Re: problems with "AJAX function" processEvaluation (1.4.x - 6.x)

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Sven,

Thank you for your answer.

On Wed, Feb 13, 2013 at 1:10 PM, Sven Meier <sv...@meiers.net> wrote:

> This I think is an error... as if eval fails... processing should continue.
>> Shall I create an issue for this?
>>
>
> Please create an issue for Wicket 6 (or 1.5.x). As you know, 1.4.x doesn't
> get bug fixes any longer.
>
> Sven
>
>

Yes I know 1.4.x is frozen... Fixing that on 6.x (and 1.5.x) will be more
than enough.

We will back-port solution to our local 1.4.x branch: in fact, we already
patched it for that problem but I wanted to be sure I was not wrong... and
also that we do not encounter the same problem if we migrate to a newer
version;-)

Cheers

Ernesto Reinaldo Barreiro

Re: problems with "AJAX function" processEvaluation (1.4.x - 6.x)

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,

https://issues.apache.org/jira/browse/WICKET-5039

On Wed, Feb 13, 2013 at 1:10 PM, Sven Meier <sv...@meiers.net> wrote:

> This I think is an error... as if eval fails... processing should continue.
>> Shall I create an issue for this?
>>
>
> Please create an issue for Wicket 6 (or 1.5.x). As you know, 1.4.x doesn't
> get bug fixes any longer.
>
> Sven
>
>
>
> On 02/13/2013 10:25 AM, Ernesto Reinaldo Barreiro wrote:
>
>> Hi,
>>
>> On Wed, Feb 13, 2013 at 8:38 AM, Ernesto Reinaldo Barreiro <
>> reiern70@gmail.com> wrote:
>>
>>  Hi,
>>>
>>> We are having problems on Wicket 1.4.x with and "AJAX function"
>>> processEvaluation... and I see the code is practically the same at 6.x.
>>> So,
>>> let's bring the subject to the list...
>>>
>>> Our problem is that after evaluating some expressions with errors, screen
>>> "freezes" because post-call handlers are not called. Problem seems to be
>>> related to the code.
>>>
>>>                                  // test if the javascript is in form of
>>> identifier|code
>>> // if it is, we allow for letting the javascript decide when the rest of
>>> processing will continue
>>>   // by invoking identifier();
>>> var res = text.match(new
>>> RegExp("^([a-z|A-Z_][a-z|A-Z|**0-9_]*)\\|((.|\\n)*)$"));
>>>
>>> if (res !== null) {
>>> var f = jQuery.noop;
>>> text = "f = function(" + res[1] + ") {" + res[2] + "};";
>>>
>>> try {
>>> // do the evaluation
>>> eval(text);
>>>   f(notify);
>>> } catch (exception) {
>>> Wicket.Log.error("Wicket.Ajax.**Call.processEvaluation: Exception
>>> evaluating
>>> javascript: " + exception + ", text: " + text);
>>>   }
>>>
>>> }
>>>
>>>
>>> Questions:
>>>
>>> 1- Shouldn't
>>>
>>> text = "f = function(" + res[1] + ") {" + res[2] + "};";
>>>
>>> be
>>>
>>> text = "f = function(" + res[1] + ") {" + res[2] + ";" + res[1]+"();"
>>> +"};";
>>>
>>> so that f(notify) ==> notify() gets called?
>>>
>>>  Ok. This part is clearly correct according to
>>
>> // test if the javascript is in form of identifier|code
>> // if it is, we allow for letting the javascript decide when the rest of
>> processing will continue
>> // by invoking identifier();
>> var res = text.match(new
>> RegExp("^([a-z|A-Z_][a-z|A-Z|**0-9_]*)\\|((.|\\n)*)$"));
>>
>> So, forget my question.
>>
>>
>>  2- In case of error. Shouldn't it be
>>>
>>>                                        try {
>>> // do the evaluation
>>>   eval(text);
>>> f(notify);
>>> } catch (exception) {
>>>   Wicket.Log.error("Wicket.Ajax.**Call.processEvaluation: Exception
>>> evaluating javascript: " + exception + ", text: " + text);
>>>                                                  notify();
>>> }
>>>
>>>  This I think is an error... as if eval fails... processing should
>> continue.
>> Shall I create an issue for this?
>>
>>  So that next steps in processing get called. The above solves or freezing
>>> problem in case of error but... I'm still not sure about 1) above.
>>>
>>> Can someone shed some light on the above?
>>>
>>> Thanks in advance!
>>>
>>> --
>>> Regards - Ernesto Reinaldo Barreiro
>>> Antilia Soft
>>> http://antiliasoft.com/ <http://antiliasoft.com/**antilia<http://antiliasoft.com/antilia>
>>> >
>>>
>>>
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>

Re: problems with "AJAX function" processEvaluation (1.4.x - 6.x)

Posted by Sven Meier <sv...@meiers.net>.
>This I think is an error... as if eval fails... processing should continue.
>Shall I create an issue for this?

Please create an issue for Wicket 6 (or 1.5.x). As you know, 1.4.x doesn't get bug fixes any longer.

Sven


On 02/13/2013 10:25 AM, Ernesto Reinaldo Barreiro wrote:
> Hi,
>
> On Wed, Feb 13, 2013 at 8:38 AM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
>> Hi,
>>
>> We are having problems on Wicket 1.4.x with and "AJAX function"
>> processEvaluation... and I see the code is practically the same at 6.x. So,
>> let's bring the subject to the list...
>>
>> Our problem is that after evaluating some expressions with errors, screen
>> "freezes" because post-call handlers are not called. Problem seems to be
>> related to the code.
>>
>>                                  // test if the javascript is in form of
>> identifier|code
>> // if it is, we allow for letting the javascript decide when the rest of
>> processing will continue
>>   // by invoking identifier();
>> var res = text.match(new
>> RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n)*)$"));
>>
>> if (res !== null) {
>> var f = jQuery.noop;
>> text = "f = function(" + res[1] + ") {" + res[2] + "};";
>>
>> try {
>> // do the evaluation
>> eval(text);
>>   f(notify);
>> } catch (exception) {
>> Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating
>> javascript: " + exception + ", text: " + text);
>>   }
>>
>> }
>>
>>
>> Questions:
>>
>> 1- Shouldn't
>>
>> text = "f = function(" + res[1] + ") {" + res[2] + "};";
>>
>> be
>>
>> text = "f = function(" + res[1] + ") {" + res[2] + ";" + res[1]+"();"
>> +"};";
>>
>> so that f(notify) ==> notify() gets called?
>>
> Ok. This part is clearly correct according to
>
> // test if the javascript is in form of identifier|code
> // if it is, we allow for letting the javascript decide when the rest of
> processing will continue
> // by invoking identifier();
> var res = text.match(new
> RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n)*)$"));
>
> So, forget my question.
>
>
>> 2- In case of error. Shouldn't it be
>>
>>                                        try {
>> // do the evaluation
>>   eval(text);
>> f(notify);
>> } catch (exception) {
>>   Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception
>> evaluating javascript: " + exception + ", text: " + text);
>>                                                  notify();
>> }
>>
> This I think is an error... as if eval fails... processing should continue.
> Shall I create an issue for this?
>
>> So that next steps in processing get called. The above solves or freezing
>> problem in case of error but... I'm still not sure about 1) above.
>>
>> Can someone shed some light on the above?
>>
>> Thanks in advance!
>>
>> --
>> Regards - Ernesto Reinaldo Barreiro
>> Antilia Soft
>> http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: problems with "AJAX function" processEvaluation (1.4.x - 6.x)

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,

On Wed, Feb 13, 2013 at 8:38 AM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Hi,
>
> We are having problems on Wicket 1.4.x with and "AJAX function"
> processEvaluation... and I see the code is practically the same at 6.x. So,
> let's bring the subject to the list...
>
> Our problem is that after evaluating some expressions with errors, screen
> "freezes" because post-call handlers are not called. Problem seems to be
> related to the code.
>
>                                 // test if the javascript is in form of
> identifier|code
> // if it is, we allow for letting the javascript decide when the rest of
> processing will continue
>  // by invoking identifier();
> var res = text.match(new
> RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n)*)$"));
>
> if (res !== null) {
> var f = jQuery.noop;
> text = "f = function(" + res[1] + ") {" + res[2] + "};";
>
> try {
> // do the evaluation
> eval(text);
>  f(notify);
> } catch (exception) {
> Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating
> javascript: " + exception + ", text: " + text);
>  }
>
> }
>
>
> Questions:
>
> 1- Shouldn't
>
> text = "f = function(" + res[1] + ") {" + res[2] + "};";
>
> be
>
> text = "f = function(" + res[1] + ") {" + res[2] + ";" + res[1]+"();"
> +"};";
>
> so that f(notify) ==> notify() gets called?
>

Ok. This part is clearly correct according to

// test if the javascript is in form of identifier|code
// if it is, we allow for letting the javascript decide when the rest of
processing will continue
// by invoking identifier();
var res = text.match(new
RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n)*)$"));

So, forget my question.


>
> 2- In case of error. Shouldn't it be
>
>                                       try {
> // do the evaluation
>  eval(text);
> f(notify);
> } catch (exception) {
>  Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception
> evaluating javascript: " + exception + ", text: " + text);
>                                                 notify();
> }
>

This I think is an error... as if eval fails... processing should continue.
Shall I create an issue for this?

>
> So that next steps in processing get called. The above solves or freezing
> problem in case of error but... I'm still not sure about 1) above.
>
> Can someone shed some light on the above?
>
> Thanks in advance!
>
> --
> Regards - Ernesto Reinaldo Barreiro
> Antilia Soft
> http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>



-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>