dnaber      2004/08/26 05:41:14

  Modified:    src/java/org/apache/lucene/index CompoundFileWriter.java
  Log:
  throw NullPointerException instead of IllegalArgumentException if appropriate
  
  Revision  Changes    Path
  1.6       +12 -8     
jakarta-lucene/src/java/org/apache/lucene/index/CompoundFileWriter.java
  
  Index: CompoundFileWriter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/CompoundFileWriter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CompoundFileWriter.java   25 Aug 2004 11:56:17 -0000      1.5
  +++ CompoundFileWriter.java   26 Aug 2004 12:41:14 -0000      1.6
  @@ -42,7 +42,7 @@
    *
    * The fileCount integer indicates how many files are contained in this compound
    * file. The {directory} that follows has that many entries. Each directory entry
  - * contains an encoding identifier, an long pointer to the start of this file's
  + * contains an encoding identifier, a long pointer to the start of this file's
    * data section, and a UTF String with that file's extension.
    *
    * @author Dmitry Serebrennikov
  @@ -71,12 +71,13 @@
   
       /** Create the compound stream in the specified file. The file name is the
        *  entire name (no extensions are added).
  +     *  @throws NullPointerException if <code>dir</code> or <code>name</code> is 
null
        */
       public CompoundFileWriter(Directory dir, String name) {
           if (dir == null)
  -            throw new IllegalArgumentException("Missing directory");
  +            throw new NullPointerException("directory cannot be null");
           if (name == null)
  -            throw new IllegalArgumentException("Missing name");
  +            throw new NullPointerException("name cannot be null");
   
           directory = dir;
           fileName = name;
  @@ -98,8 +99,9 @@
        *  sub-stream will be known in the compound stream.
        * 
        *  @throws IllegalStateException if this writer is closed
  -     *  @throws IllegalArgumentException if <code>file</code> is null
  -     *   or if a file with the same name has been added already
  +     *  @throws NullPointerException if <code>file</code> is null
  +     *  @throws IllegalArgumentException if a file with the same name
  +     *   has been added already
        */
       public void addFile(String file) {
           if (merged)
  @@ -107,8 +109,8 @@
                   "Can't add extensions after merge has been called");
   
           if (file == null)
  -            throw new IllegalArgumentException(
  -                "Missing source file");
  +            throw new NullPointerException(
  +                "file cannot be null");
   
           if (! ids.add(file))
               throw new IllegalArgumentException(
  @@ -123,6 +125,8 @@
        *  All files with these extensions are combined sequentially into the
        *  compound stream. After successful merge, the source files
        *  are deleted.
  +     *  @throws IllegalStateException if close() had been called before or
  +     *   if no file has been added to this object
        */
       public void close() throws IOException {
           if (merged)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to