tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Wishnie" <j...@deluxebiz.com>
Subject Re: JSP's and J2SDK1.4 assert statement
Date Fri, 25 Oct 2002 19:37:43 GMT
The problem is in Jasper's parsing of the JSP to create the java source code, correct? The
code then gets executed in the same
VM/Classloader as the classes in the contain Webapp's WEB-INF/classes and WEB-INF/lib, correct?

If so, can this be worked around by wrapping the java assert calls in another class as follows:

public class JSPAssert {
    static void doAssert(boolean invariant, String message) {
        assert invariant: message;
    }
}


And using JSPAssert.doAssert() within the JSP?

Granted you won't get the full benefits of conditional execution because JSPAssert.doAssert()
will always execute, as will whatever
logic determines the invariant and message.

But it allows you to follow good and consistent coding practices in your JSPs and you can
still switch  on/and off the actual
throwing of the assertion exceptions.

- Jeff

----- Original Message -----
From: "Craig R. McClanahan" <craigmcc@apache.org>
To: "Oliver Jonas" <oliver@dialogue.co.uk>
Cc: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Friday, October 25, 2002 12:20 PM
Subject: RE: JSP's and J2SDK1.4 assert statement


>
>
> On Fri, 25 Oct 2002, Oliver Jonas wrote:
>
> > Date: Fri, 25 Oct 2002 19:28:34 +0200
> > From: Oliver Jonas <oliver@dialogue.co.uk>
> > To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> > Cc: craigmcc@apache.org
> > Subject: RE: JSP's and J2SDK1.4 assert statement
> >
> > Hi Craig,
> >
> > I also tried CATALINA_OPTS... same thing happens. Thinking about it "-source
> > 1.4" isn't actually a valid option for "java", only for "javac". (Maybe
> > that's why it fails because it starts fine if I only put "-enableassertions"
> > in JAVA_OPTS.
> >
> > So I guess I need to tell Jasper to use the option "-source 1.4".
> >
> >
> > Any ideas how to?
> >
>
> Nope ... you'd have to modify Jasper sources to do this.
>
> > Thanks,
> > Oliver.
> >
> > PS: Using JSP's only for HTML presentation... but would still like to have
> > asserts to make sure values returned by the underlying Java API are valid.
> >
>
> Good.
>
>
> --
> To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message