You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Anthony Green <gr...@redhat.com> on 2001/09/18 18:34:41 UTC

build problem

One of the local changes I had to make to Tomcat in order to build with gcj is
in JspReader.java...

    char[] getChars(Mark start, Mark stop) throws ParseException {
        Mark oldstart = mark();
        reset(start);
        CharArrayWriter caw = new CharArrayWriter();
        while (!stop.equals(mark()))
            caw.write(nextChar());
        caw.close();
        reset(oldstart);
        return caw.toCharArray();
    }

Our implementation of CharArrayWriter.write() can throw an IOException, as per
the JDK1.3 docs - resulting in...

upstream/jasper/src/share/org/apache/jasper/compiler/JspReader.java:397:
Exception `java.io.IOException' must be caught, or it must be declared in the
`throws' clause of `getChars'.
            caw.write(nextChar());
               ^
1 error

What's going on here?

Thanks!

AG



Re: build problem

Posted by cm...@yahoo.com.
Hi Anthony,

AFAIK ( and I just checked the java lang spec ), a class (
CharArrayWriter) can override a method ( write ) and have fewer
"throws" declarations. It can't have _more_ exceptions.

CharArrayWriter.write() doesn't have any throw() declaration, so the code
seems correct.

We can add a catch(Exception) as a workaround. 

Could you try a build with tomcat3.3 ? I assume there are other places
like that, and we should add the workarounds ( or fix what have to be
fixed ) before RC2/final. 

We can do that for a 3.2.4 or something - I'm not sure when or if it is
planned, but my main concern now is making sure 3.3 will work.

( I'll try to reproduce the build - I assume you're using gcc3.0 - is
there anything else you need ? )

Costin 


On Tue, 18 Sep 2001, Anthony Green wrote:

> One of the local changes I had to make to Tomcat in order to build with gcj is
> in JspReader.java...
> 
>     char[] getChars(Mark start, Mark stop) throws ParseException {
>         Mark oldstart = mark();
>         reset(start);
>         CharArrayWriter caw = new CharArrayWriter();
>         while (!stop.equals(mark()))
>             caw.write(nextChar());
>         caw.close();
>         reset(oldstart);
>         return caw.toCharArray();
>     }
> 
> Our implementation of CharArrayWriter.write() can throw an IOException, as per
> the JDK1.3 docs - resulting in...
> 
> upstream/jasper/src/share/org/apache/jasper/compiler/JspReader.java:397:
> Exception `java.io.IOException' must be caught, or it must be declared in the
> `throws' clause of `getChars'.
>             caw.write(nextChar());
>                ^
> 1 error
> 
> What's going on here?
> 
> Thanks!
> 
> AG
>