commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Brown" <bro...@nlg.com>
Subject [jelly] Re: Junit error in script used by j:include, reportsgeneric error
Date Tue, 01 Apr 2003 16:35:00 GMT
Hi James,
    Thanks for getting back to me.  I am definitely specifying a filename 
which, since it worked, seemed OK by me.
ex:
       <j:include uri="run.jelly"/>

run.jelly is a jelly file in the current directory of the executing script.
I am using jelly:junit, which I assume is the same thing as jellyunit.

In order to get around my problem, I added the following truly ugly 
System.out.println line into IncludeTag.java within the doTag method. 
I have included enough context so that you can figure out where I added 
it.

       catch (JellyException e) {
            System.out.println(e.getMessage());  // Mighty ugly, but it works
            throw new JellyTagException("could not include jelly script",e);
        }

With the addition of this line, the error in the included script is no longer
hidden.
I am pretty sure that whatever code catches the include tag's exception is 
not printing out any information from the "cause" exception, included in the 
"could not include jelly script" exception.  The println does  print out the 
real error.

Can you suggest a better fix? 

By the by, while I have your ear, I suspect that the "new" tag does not 
"return a value" in the same manner in which the "invoke" tag does.  This 
makes it difficult to embed the "new" tag within other tags like the  "arg" 
tag.  I will attempt to confirm this problem/issue.

Also, as another basic problem with the base tags, I have found no way 
to call a class method on an object.  I could have gotten around the 
problem I had with the "new" tag by using invoke tag to call the initializer 
directly on the class.  But, this doesn't seem possible.

So, are these problems or do I not know what I am doing?  I produced 
a small tool that provided an XML syntax for running java code in a 
previous life.  The ability to call class methods was really handy.

Thanks very much for you time James.

                                           Bill




>>> James Strachan 04/01/03 08:28AM >>>
On 31/3/03 8:35 pm, "Bill Brown" <brownb@nlg.com> wrote:

> Hi,
>   I am a new user of Jelly, attempting to get Jelly to work well
> along with junit.  So, I used the include tag to run a jelly script and
> that jelly script uses junit to report errors. The errors were not
> reported, just a generic failure of the script.  I get the string,
> "could not include jelly script" in the exception, which led me to the
> doTag method within the IncludeTag.java code.  The includeTag code is
> changing the type of error, from JellyException to JellyTagException,
> and then setting the cause of the JellyTagException to the original
> exception.  TagScript.java, which appears to run tags, does not access
> the cause of an Exception.
>   Since I am very new to Jelly, I am not sure if I have diagnosed
> this problem correctly.  Could you please advise me?
>   Thanks very much for your time.

Any chance you could give us an example of a use of <j:include> that fails?
Typically the <j:include> expects a URI which is either relative to the
current URL context in JellyContext or an absolute URL. Are you specifying a
file name maybe?
 
BTW if you're looking at using Jelly with Junit have you looked at
JellyUnit?

http://jakarta.apache.org/commons/jelly/jellyunit.html 

James
-------
http://radio.weblogs.com/0112098/ 


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


Mime
View raw message