> > > > I have thought about this a while ago, too. We should be able to
> > > extract
> > > > that from the exception stacktrace.
> > >
> > > Line number in Java source is already shown, correctly. The question is
> > > how to map this to XSP source line numbers.
> >
> > well, addtionally we need the full classpath of the failed class itself
> > from the stacktrace. then we need to lookup the java source code filename
> > from the ProgrammGenerator. unfortunately that's not yet possible AFAICS.
> > but as a workaround we might translate back the class into a path and use
> > the workdir of the ProgrammGenerator as root, add the path and we should
> > have the generated file path from the repository...
>
> OK, that would make it easier to see the source (if I understand
> correctly, that is). But I believe the original problem is infeasible
> since we don't know what transformations happened on the way to the
> final XSP (all taglibs but XSP done).

true... that's why I am not sure if it is really worth the work.
fact is: it will only really be useful if the error does not come from a
logicsheet. otherwise you would present code to the user/developer he
has probably never seen before. it might be easier to track things
though... I am really torn apart :-/

Some comments from XSP *users* would be fine...

> One could, of course,
>       first run the XSP through a transformer that adds line number
>          comments that are kept 'til the java file is generated,
>
>       find the enclosing line number comments (well, one would suffice)
>
>       output the XSP with the line highlighted that translates to the
>               faulty java code
>
> Would be kind of overhead outside development but then, a deployed
> application wouldn't compile XSPs too often.

hm.. you mean this way?

  ...
  <xsp:logic>
     int a = 5;
  </xsp:logic>
     <my:logicsheet-tag/>
  <xsp:logic>
     b = a;
     c = x;
  </xsp:logic>
 ...

transform it once to add the line numbers. (it would be cool if the XSP
logicsheet could already provide this. but I fear that's not possible with
XSLT)
  ...
  <xsp:logic>
     /* line:4 */ int a = 5;
  </xsp:logic>
     <my:logicsheet-tag/>
  <xsp:logic>
     /* line:8 */ b = a;
     /* line:9 */ c = x;
  </xsp:logic>
  ....

Then apply the logicsheets which might insert or remove lines from the
original code:

  ...
     /* line:4 */ int a = 5;

     .....

     /* line:8 */ b = a;
     /* line:9 */ c = x;
  ....

Now the exception provides information about the final class line numbers.
We still would need to obtaint the information as described. but we could
then also parse the comment to get the original line number an present
that one in a nice exception. the malicious line highlighted with +/- 5
lines. if there is no line number in comments we know it was introduced by
a logicsheet and might not be very helpful to display this way.

But as I said... quite some hours of work...

question is: do people think this is helpful?

people? comments please...
--
Torsten


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to