You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Anton Tagunov <at...@mail.cnt.ru> on 2003/07/03 13:49:46 UTC

Re: cvs commit: avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl HTTPClientSourceFactory.java HTTPClientSource.java

Hello, Marcus!

cao>       public boolean exists()
cao>       {
cao>           // REVISIT(MC): should this return true if the server does not return
cao>           // a 404, or a 410, or should it only return true if the user can
cao>           // successfully get an InputStream from it without getting errors.

Not sure I will ever use this code, so my opinion may be weak here,
just theoretically I would prefer to get true from exists iff I can
get an InputStream from it without getting errors.

But then probably we should do in FileSource the following change?

      public SourceValidity getValidity()
      {
-         if (m_file.exists())
+         if (m_file.canRead())
          {
              return new FileTimeStampValidity(m_file);
          }

          
      public boolean exists()
      {
-         return getFile().exists();
+         return getFile().canRead();
      }

Must confess I am sort of at a loss here too.
On the one hand, what is the user of knowing a file
exist without me being able to read from it.

On the other hand the method should have been called
canRead() then to avoid confusion.

:-/

  
cao>           // resource does not exist if HttpClient returns a 404 or a 410
cao>           return !( m_response == HttpStatus.SC_GONE || 
cao>                     m_response == HttpStatus.SC_NOT_FOUND );
cao>       }

- Anton


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org