Share

Java Unified Expression Language

Tracker: Feature Requests

5 Exceptions improvement - ID: 1751763
Last Update: Comment added ( nobody )

Hi,

I met the following problem during JUEL usage:
My system provides an ability to enter/edit expressions via text area. User
doesn't want to see/enter "${" and "}" symbols. So if she enters incorrect
expression then she would like to see "syntax error at position <n> ...",
where <n> is actual position in her expression. But instead she will see
<n+2> position because EL requires "${" at the beginning of expression.
Right now I'm parsing a message (using resource bundle messages of course)
and replacing <n+2> with correct one, but I don't like this solution.

Is it possible to throw special Exception (which extends ELException of
course) which contains additional fields: error position, wrong char and
expected char?
Other solutions are welcome.

Related problem is with other exceptions: they doesn't provide error
position at all. It would be nice to have error position field for all EL
exceptions.

Thanks,
Varrey.

P.S. I know that the best way is to implement such approach in the
javax.el, but I don't think that it's possible in the nearest future.


Varrey ( varrey ) - 2007-07-11 09:32

5

Closed

None

Nobody/Anonymous

None

None

Public


Comments ( 5 )




Date: 2008-12-28 10:57
Sender: nobody

3yrOpF <a href="http://ckmhrlvfmjsi.com/">ckmhrlvfmjsi</a>,
[url=http://ydlghhtblffw.com/]ydlghhtblffw[/url],
[link=http://fkyvayeryjrc.com/]fkyvayeryjrc[/link],
http://eugnbwqjbtpg.com/


Date: 2008-11-26 23:28
Sender: nobody

kNLp7N <a href="http://djqxyuiepxyr.com/">djqxyuiepxyr</a>,
[url=http://omdemqghrafk.com/]omdemqghrafk[/url],
[link=http://ubpptmwmhnch.com/]ubpptmwmhnch[/link],
http://jasyhvyukshp.com/


Date: 2007-07-20 14:03
Sender: varrey


That looks great, thanks!
I'm closing this enhancement (I'm not sure who should close it, so if I
shouldn't feel free to reopen it again).


Date: 2007-07-15 12:11
Sender: nobody

Logged In: NO

Varrey,

I have made some changes to address this.
You may want to get the latest code from
the repository and try it.

There's now a TreeBuilderException (which
extends ELException) and which is thrown
when building the abstract syntax tree for
an expression (that is: by scan and parse).

See the Calculator example for how to use
this to create a customized error message.

Let me know what you think,

Christoph


Date: 2007-07-15 09:44
Sender: beckchrProject Admin


Hi Varrey,

Thanks for your suggestions!

Though it's not possible (and wouldn't be useful) to have these fields
in every ELException, this could be done for exceptions that are thrown
during parse.
The dark side of doing this is that your code will still be JUEL
implementation specific, but of cause it's better than analyzing
error messages...

Will include this with the next release.

So far, Christoph



Log in to comment.




Attached File

No Files Currently Attached

Changes ( 2 )

Field Old Value Date By
status_id Open 2007-07-20 14:03 varrey
close_date - 2007-07-20 14:03 varrey