Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » JET Exceptions and Exception Handling
JET Exceptions and Exception Handling [message #41877] Wed, 13 February 2008 21:16 Go to next message
Eclipse UserFriend
Originally posted by: pankaj.surti.accenture.com

Hi All,

I want to know the following things:

- Does JET internals throw back exceptions for any XPATH?

- Is there any Exception Handling tips for the JET template?

Thanks,
-Pankaj.
Re: JET Exceptions and Exception Handling [message #41916 is a reply to message #41877] Thu, 14 February 2008 13:52 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Pankaj:

XPath engine throws XPathRuntimeException, which are derived from
RuntimeException.

All JET tags are wrapped in safe handlers that convert all but the most
agregious Errors into context log entries and allow the template to continue
execution.

For embedded Java code, there is no special exception handling. If you call
a method that throws a checked exception, you have to include try/catch
blocks to handle it.

If you can describe a particular situation, I may be able to provide more
specific suggestions.

Paul

"pankaj" <pankaj.surti@accenture.com> wrote in message
news:129e31aa0214d216eccb194bd8cfca6b$1@www.eclipse.org...
> Hi All,
>
> I want to know the following things:
>
> - Does JET internals throw back exceptions for any XPATH?
>
> - Is there any Exception Handling tips for the JET template?
>
> Thanks,
> -Pankaj.
>
Re: JET Exceptions and Exception Handling [message #42235 is a reply to message #41916] Tue, 26 February 2008 20:36 Go to previous messageGo to next message
Roshan S. is currently offline Roshan S.Friend
Messages: 125
Registered: July 2009
Senior Member
Hi,

In my template I use the following <c:if test="$var::VarClass">

and after I run, although my generation creates the correct output when I
look at my log file I have the following error. Is this a bug? I got the
test code from the FAQs:

http://wiki.eclipse.org/JET_FAQ_How_do_I_test_for_the_type/E Class_of_an_element_in_XPath%3F

Is there a way I can catch this exception because they are all thrown at
the end to the IProgressMonitor I pass into my transformation and I never
get a clean run.

org.eclipse.jet.taglib.JET2TagException: Unrecognized token: ::
at
org.eclipse.jet.XPathContextExtender.resolveAsObject(XPathCo ntextExtender.java:448)
at
org.eclipse.jet.internal.taglib.control.IfTag.doEvalConditio n(IfTag.java:60)
at
org.eclipse.jet.internal.runtime.SafeConditionalRuntimeTag$1 .doRun(SafeConditionalRuntimeTag.java:69)
at
org.eclipse.jet.internal.runtime.SafeCustomRuntimeTag$TagSaf eRunnable.run(SafeCustomRuntimeTag.java:72)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:857)
at
org.eclipse.jet.internal.runtime.SafeConditionalRuntimeTag.o kToProcessBody(SafeConditionalRuntimeTag.java:64)

Caused by: org.eclipse.jet.xpath.XPathSyntaxException: Unrecognized token:
::
at org.eclipse.jet.internal.xpath.XPathImpl.compile(XPathImpl.j ava:103)
at
org.eclipse.jet.XPathContextExtender.compileXPath(XPathConte xtExtender.java:189)
at
org.eclipse.jet.XPathContextExtender.resolveAsObject(XPathCo ntextExtender.java:443)
... 32 more
Re: JET Exceptions and Exception Handling [message #42418 is a reply to message #42235] Wed, 27 February 2008 21:51 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Roshan:

$var::VarClass is not valid XPath, hence the exception.

You want:

$var/self::VarClass

Paul

"Roshan Soni" <roshan.soni1@gmail.com> wrote in message
news:5b8d412df496d627afa7f0d8d9a80861$1@www.eclipse.org...
> Hi,
>
> In my template I use the following <c:if test="$var::VarClass">
>
> and after I run, although my generation creates the correct output when I
> look at my log file I have the following error. Is this a bug? I got the
> test code from the FAQs:
>
> http://wiki.eclipse.org/JET_FAQ_How_do_I_test_for_the_type/E Class_of_an_element_in_XPath%3F
>
> Is there a way I can catch this exception because they are all thrown at
> the end to the IProgressMonitor I pass into my transformation and I never
> get a clean run.
>
> org.eclipse.jet.taglib.JET2TagException: Unrecognized token: ::
> at
> org.eclipse.jet.XPathContextExtender.resolveAsObject(XPathCo ntextExtender.java:448)
> at
> org.eclipse.jet.internal.taglib.control.IfTag.doEvalConditio n(IfTag.java:60)
> at
> org.eclipse.jet.internal.runtime.SafeConditionalRuntimeTag$1 .doRun(SafeConditionalRuntimeTag.java:69)
> at
> org.eclipse.jet.internal.runtime.SafeCustomRuntimeTag$TagSaf eRunnable.run(SafeCustomRuntimeTag.java:72)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
> at org.eclipse.core.runtime.Platform.run(Platform.java:857)
> at
> org.eclipse.jet.internal.runtime.SafeConditionalRuntimeTag.o kToProcessBody(SafeConditionalRuntimeTag.java:64)
>
> Caused by: org.eclipse.jet.xpath.XPathSyntaxException: Unrecognized token:
> ::
> at org.eclipse.jet.internal.xpath.XPathImpl.compile(XPathImpl.j ava:103)
> at
> org.eclipse.jet.XPathContextExtender.compileXPath(XPathConte xtExtender.java:189)
> at
> org.eclipse.jet.XPathContextExtender.resolveAsObject(XPathCo ntextExtender.java:443)
> ... 32 more
>
Previous Topic:simple JET2 example?
Next Topic:ws:project tag: How to specify a project type?
Goto Forum:
  


Current Time: Fri Dec 19 08:47:39 GMT 2014

Powered by FUDForum. Page generated in 0.01685 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software