Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: joist/java/org/joist/search Query.java

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

CVS update: joist/java/org/joist/search Query.java

Author stack
Full name Michael Stack
Date 2000-10-24 11:32:03 PDT
Message User: stack
  Date: 00/10/24 11:32:03

  Modified: java/org/joist/search Query.java
  Log:
  Added check for the passed index file's presence -- throw exception if doesn't exist
  
  Revision Changes Path
  1.2 +24 -8 joist/java/org/joist​/search/Query.java
  
  Index: Query.java
  ====================​====================​====================​=======
  RCS file: /cvs/joist/java/org/​joist/search/Query.j​ava,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Query.java 2000/10/23 23:21:45 1.1
  +++ Query.java 2000/10/24 18:32:03 1.2
  @@ -60,14 +60,14 @@
   * paging through returned results.
   *
   * @author <a href="mailto:stack@c​ollab.net">St.Ack​</a>
  -* @version $Id: Query.java,v 1.1 2000/10/23 23:21:45 stack Exp $
  +* @version $Id: Query.java,v 1.2 2000/10/24 18:32:03 stack Exp $
   */
   public class Query
   {
       /** Class version string
       */
       public static final String versionID
  - = "$Id: Query.java,v 1.1 2000/10/23 23:21:45 stack Exp $";
  + = "$Id: Query.java,v 1.2 2000/10/24 18:32:03 stack Exp $";
       
       
       /** Number of search result items to return per query.
  @@ -110,18 +110,31 @@
       * @exception IndexOutOfBoundsException If passed in
       * inResultsPerQuery is less than 0 or greater than
       * QUERY_RESULTS_UPPER_LIMIT, our arbitrary upper-bound.
  + * @exception java.io.FileNotFoundException If search
  + * index does not exist.
       */
       public Query( String inQuery,
                       String inSearchIndex,
                       int inResultsPerQuery )
  - throws NullPointerException, IndexOutOfBoundsException
  + throws NullPointerException,
  + IndexOutOfBoundsException,
  + java.io.FileNotFoundException
       {
           if( inQuery == null || inQuery.length( ) <= 0 )
               throw new NullPointerException( "inQuery is null or empty" );
           query = inQuery;
                
  - if( inSearchIndex == null || inSearchIndex.length( ) <= 0 )
  +
  + // Test for non-null index and that it exists
  + //
  + if( inSearchIndex == null
  + || inSearchIndex.length( ) <= 0 )
               throw new NullPointerException( "inSearchIndex is null or empty" );
  + java.io.File fileIndex = new java.io.File( inSearchIndex );
  + if( !fileIndex.exists( ) )
  + throw new java.io.FileNotFoundException( "inSearchIndex swish-e at location <"
  + + inSearchIndex
  + + "> does not exist" );
           searchIndex = inSearchIndex;
           
           if( inResultsPerQuery < 0 || inResultsPerQuery > QUERY_RESULTS_UPPER_LIMIT )
  @@ -144,13 +157,16 @@
       * @exception NullPointerException If passed in params are null
       * or empty.
       * @exception IndexOutOfBoundsException If passed in
  - * inResultsPerQuery is less
  - * than 0 or greater than QUERY_RESULTS_UPPER_LIMIT, our
  - * arbitrary upper-bound.
  + * inResultsPerQuery is less than 0 or greater than
  + * QUERY_RESULTS_UPPER_LIMIT, our arbitrary upper-bound.
  + * @exception java.io.FileNotFoundException If search
  + * index does not exist.
       */
       public Query( String inQuery,
                       String inSearchIndex )
  - throws NullPointerException, IndexOutOfBoundsException
  + throws NullPointerException,
  + IndexOutOfBoundsException,
  + java.io.FileNotFoundException
       {
           this( inQuery, inSearchIndex, 0 );
       }

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: joist/java/org/joist/search Query.java stack Michael Stack 2000-10-24 11:32:03 PDT
Messages per page: