avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Tagunov <atagu...@mail.cnt.ru>
Subject Re: cvs commit: avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl HTTPClientSourceFactory.java HTTPClientSource.java
Date Thu, 03 Jul 2003 11:49:46 GMT
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


Mime
View raw message