I imported java.io.* ...

But if I import explicitly java.io.IOException, it might cause unqualified
references to the Tomcat IOException class to become mixed up too !

I agree that it's good practice to import each class individually using
fully-qualified names.  However (IMHO), the Tomcat development team ought to
have imported any internal implementation classes  explicitly where there's
a risk of namespace collision with very common classes.

It would have been better still if the fully-qualified names class names
were used directly in the code for Tomcat, with no imports whatsoever --
because if both the internal Tomcat classes and other classes with the same
names are ALL imported explicitly, there's still as much potential for
confusion.

Using fully-qualified class names everywhere in application code slows down
development (more typing) and may reduce readability (ok, you know which
class is which, but lines of code won't fit easily on screen at the same
time!).

-Chris

----- Original Message -----
From: "Dmitri Colebatch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 24, 2001 1:41 PM
Subject: Re: [TC4] Confusion over JspWriter and IOException in compiled JSPs
(Tomcat bug...?)


> you need to import java.io.IOException.... probably in previous versions
> of tomcat the generated code imported this method, thus masking the fact
> that you didn't import it.... they now (I guess) dont do this, and so the
> compiler is looking for IOException in the package of the code, which is
> org.apache.jsp (default jsp package).
>
> in summary  page import="java.io.IOException"  shoudl fix it.
>
> cheers
> dim
>
> On Mon, 24 Sep 2001, chris brown wrote:
>
> > Hello,
> >
> > In a JSP page, I have a method a bit like this:
> >
> > void myMethod(Object someParam, JspWriter out)
> > throws IOException
> > {
> >   ...
> > }
> >
> > The use of "out" is for some quick debugging.  Anyway, this code works
fine
> > under Tomcat 3.2.3, but porting it over to TC4 final produced the
following
> > compilation errors :
> >
> > "Class org.apache.jsp.IOException not found in throws"
> >
> > It would seem that although I'm using standard API classes/interfaces
> > (JspWriter, IOException), the "import" statements in the generated
".java"
> > files based on the ".jsp" files are too vague... "java.io.IOException"
is
> > getting mixed up with "org.apache.jsp.IOException".
> >
> > This may be in turn related to some confusion between the public
"JspWriter"
> > class and some underlying implementation class with the same unqualified
> > name.
> >
> > As it happens, I don't need to use JspWriter, as it was only for
debugging.
> > However, this sort of ambiguity could be much more annoying for some
other
> > applications!
> >
> > Hope this helps!
> > Chris Brown
> >
> >
>

Reply via email to