You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by ry...@apache.org on 2007/05/30 00:28:25 UTC

svn commit: r542679 - in /lucene/solr/trunk/src: java/org/apache/solr/analysis/ java/org/apache/solr/core/ java/org/apache/solr/handler/ java/org/apache/solr/handler/admin/ java/org/apache/solr/request/ java/org/apache/solr/schema/ java/org/apache/solr...

Author: ryan
Date: Tue May 29 15:28:21 2007
New Revision: 542679

URL: http://svn.apache.org/viewvc?view=rev&rev=542679
Log:
SOLR-249 -- depreating new SolrException( int ... ) in favor of new SolrException( enum ...

This also refactors all calls to new SolrException()

Modified:
    lucene/solr/trunk/src/java/org/apache/solr/analysis/PatternTokenizerFactory.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/PhoneticFilterFactory.java
    lucene/solr/trunk/src/java/org/apache/solr/analysis/TrimFilterFactory.java
    lucene/solr/trunk/src/java/org/apache/solr/core/Config.java
    lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java
    lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
    lucene/solr/trunk/src/java/org/apache/solr/core/SolrException.java
    lucene/solr/trunk/src/java/org/apache/solr/handler/CSVRequestHandler.java
    lucene/solr/trunk/src/java/org/apache/solr/handler/SpellCheckerRequestHandler.java
    lucene/solr/trunk/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java
    lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
    lucene/solr/trunk/src/java/org/apache/solr/request/DisMaxRequestHandler.java
    lucene/solr/trunk/src/java/org/apache/solr/request/RequiredSolrParams.java
    lucene/solr/trunk/src/java/org/apache/solr/request/SolrParams.java
    lucene/solr/trunk/src/java/org/apache/solr/request/SolrQueryRequestBase.java
    lucene/solr/trunk/src/java/org/apache/solr/request/StandardRequestHandler.java
    lucene/solr/trunk/src/java/org/apache/solr/schema/DateField.java
    lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java
    lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java
    lucene/solr/trunk/src/java/org/apache/solr/search/DocSet.java
    lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java
    lucene/solr/trunk/src/java/org/apache/solr/tst/TestRequestHandler.java
    lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler.java
    lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler2.java
    lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java
    lucene/solr/trunk/src/java/org/apache/solr/update/UpdateHandler.java
    lucene/solr/trunk/src/java/org/apache/solr/util/DOMUtil.java
    lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java
    lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
    lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java
    lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrServlet.java

Modified: lucene/solr/trunk/src/java/org/apache/solr/analysis/PatternTokenizerFactory.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/analysis/PatternTokenizerFactory.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/analysis/PatternTokenizerFactory.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/analysis/PatternTokenizerFactory.java Tue May 29 15:28:21 2007
@@ -75,7 +75,7 @@
     this.args = args;
     String regex = args.get( PATTERN );
     if( regex == null ) {
-      throw new SolrException( 500, "missing required argument: "+PATTERN );
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "missing required argument: "+PATTERN );
     }
     int flags = 0; // TODO? -- read flags from config CASE_INSENSITIVE, etc
     pattern = Pattern.compile( regex, flags );
@@ -87,7 +87,7 @@
         group = Integer.parseInt( g );
       }
       catch( Exception ex ) {
-        throw new SolrException( 500, "invalid group argument: "+g );
+        throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "invalid group argument: "+g );
       }
     }
   }
@@ -124,7 +124,7 @@
       };
     }
     catch( IOException ex ) {
-      throw new SolrException( 500, ex );
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, ex );
     }
   }
   

Modified: lucene/solr/trunk/src/java/org/apache/solr/analysis/PhoneticFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/analysis/PhoneticFilterFactory.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/analysis/PhoneticFilterFactory.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/analysis/PhoneticFilterFactory.java Tue May 29 15:28:21 2007
@@ -38,7 +38,7 @@
  * 
  * "inject" (default=true) add tokens to the stream with the offset=0
  * 
- * @version $Id:$
+ * @version $Id$
  * @see PhoneticFilter
  */
 public class PhoneticFilterFactory extends BaseTokenFilterFactory 
@@ -69,19 +69,19 @@
     
     String name = args.get( ENCODER );
     if( name == null ) {
-      throw new SolrException( 500, "Missing required parameter: "+ENCODER
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Missing required parameter: "+ENCODER
           +" ["+registry.keySet()+"]" );
     }
     Class<? extends Encoder> clazz = registry.get(name.toUpperCase());
     if( clazz == null ) {
-      throw new SolrException( 500, "Unknown encoder: "+name +" ["+registry.keySet()+"]" );
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Unknown encoder: "+name +" ["+registry.keySet()+"]" );
     }
     
     try {
       encoder = clazz.newInstance();
     } 
     catch (Exception e) {
-      throw new SolrException( 500, "Error initializing: "+name + "/"+clazz, e );
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error initializing: "+name + "/"+clazz, e );
     }
   }
   

Modified: lucene/solr/trunk/src/java/org/apache/solr/analysis/TrimFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/analysis/TrimFilterFactory.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/analysis/TrimFilterFactory.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/analysis/TrimFilterFactory.java Tue May 29 15:28:21 2007
@@ -40,7 +40,7 @@
         updateOffsets = Boolean.valueOf( v );
       }
       catch( Exception ex ) {
-        throw new SolrException( 400, "Error reading updateOffsets value.  Must be true or false.", ex );
+        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Error reading updateOffsets value.  Must be true or false.", ex );
       }
     }
   }

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/Config.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/Config.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/Config.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/Config.java Tue May 29 15:28:21 2007
@@ -96,7 +96,7 @@
       return o;
 
     } catch (XPathExpressionException e) {
-      throw new SolrException(500,"Error in xpath:" + path +" for " + name,e,false);
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + path +" for " + name,e,false);
     }
   }
 
@@ -122,12 +122,12 @@
 
     } catch (XPathExpressionException e) {
       SolrException.log(log,"Error in xpath",e);
-      throw new SolrException(500,"Error in xpath:" + xstr + " for " + name,e,false);
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr + " for " + name,e,false);
     } catch (SolrException e) {
       throw(e);
     } catch (Throwable e) {
       SolrException.log(log,"Error in xpath",e);
-      throw new SolrException(500,"Error in xpath:" + xstr+ " for " + name,e,false);
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr+ " for " + name,e,false);
     }
   }
 
@@ -217,7 +217,7 @@
         }
       }
 
-      throw new SolrException(500, "Error loading class '" + cname + "'", e, false);
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error loading class '" + cname + "'", e, false);
     }
   }
 
@@ -226,7 +226,7 @@
     try {
       return clazz.newInstance();
     } catch (Exception e) {
-      throw new SolrException(500,"Error instantiating class " + clazz, e, false);
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error instantiating class " + clazz, e, false);
     }
   }
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java Tue May 29 15:28:21 2007
@@ -157,7 +157,7 @@
           SolrRequestHandler old = register( name, handler );
           if( old != null ) {
             String msg = "multiple handlers registered on the same path! ignoring: "+old;
-            Throwable t = new SolrException( 500, msg );
+            Throwable t = new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
             SolrConfig.severeErrors.add( t );
             SolrException.logOnce(log,null,t);
           }
@@ -252,7 +252,7 @@
           _handler.init( _args );
         }
         catch( Exception ex ) {
-          throw new SolrException( 500, "lazy loading error", ex );
+          throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "lazy loading error", ex );
         }
       }
       return _handler; 
@@ -323,6 +323,7 @@
     }
   }
 }
+
 
 
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java Tue May 29 15:28:21 2007
@@ -164,7 +164,7 @@
     } catch (SolrException e) {
       throw e;
     } catch (Exception e) {
-      throw new SolrException(500,"Error Instantiating Update Handler "+className, e);
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating Update Handler "+className, e);
     }
   }
 
@@ -411,7 +411,7 @@
         String msg="Error opening new searcher. exceeded limit of maxWarmingSearchers="+maxWarmingSearchers + ", try again later.";
         log.warning(msg);
         // HTTP 503==service unavailable, or 409==Conflict
-        throw new SolrException(503,msg,true);
+        throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,msg,true);
       } else if (onDeckSearchers > 1) {
         log.info("PERFORMANCE WARNING: Overlapping onDeckSearchers=" + onDeckSearchers);
       }
@@ -668,7 +668,7 @@
     SolrRequestHandler handler = getRequestHandler(req.getQueryType());
     if (handler==null) {
       log.warning("Unknown Request Handler '" + req.getQueryType() +"' :" + req);
-      throw new SolrException(400,"Unknown Request Handler '" + req.getQueryType() + "'", true);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + req.getQueryType() + "'", true);
     }
     execute(handler, req, rsp);
   }
@@ -690,7 +690,7 @@
     if( ep != null ) {
       EchoParamStyle echoParams = EchoParamStyle.get( ep );
       if( echoParams == null ) {
-        throw new SolrException(400,"Invalid value '" + ep + "' for " + SolrParams.HEADER_ECHO_PARAMS 
+        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Invalid value '" + ep + "' for " + SolrParams.HEADER_ECHO_PARAMS 
             + " parameter, use '" + EchoParamStyle.EXPLICIT + "' or '" + EchoParamStyle.ALL + "'" );
       }
       if( echoParams == EchoParamStyle.EXPLICIT ) {
@@ -775,5 +775,6 @@
     return getQueryResponseWriter(request.getParam("wt")); 
   }
 }
+
 
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/SolrException.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/SolrException.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/SolrException.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/SolrException.java Tue May 29 15:28:21 2007
@@ -25,31 +25,80 @@
  * @author yonik
  * @version $Id$
  */
-
-
 public class SolrException extends RuntimeException {
+  
+  /**
+   * @since solr 1.2
+   */
+  public enum ErrorCode {
+    BAD_REQUEST( 400 ),
+    NOT_FOUND( 404 ),
+    SERVER_ERROR( 500 ),
+    SERVICE_UNAVAILABLE( 503 ); 
+    
+    final int code;
+    
+    private ErrorCode( int c )
+    {
+      code = c;
+    }
+  };
+  
   public boolean logged=false;
 
+  public SolrException(ErrorCode code, String msg) {
+    super(msg);
+    this.code=code.code;
+  }
+  
+  public SolrException(ErrorCode code, String msg, boolean alreadyLogged) {
+    super(msg);
+    this.code=code.code;
+    this.logged=alreadyLogged;
+  }
+
+  public SolrException(ErrorCode code, String msg, Throwable th, boolean alreadyLogged) {
+    super(msg,th);
+    this.code=code.code;
+    logged=alreadyLogged;
+  }
+
+  public SolrException(ErrorCode code, String msg, Throwable th) {
+    this(code,msg,th,true);
+  }
+
+  public SolrException(ErrorCode code, Throwable th) {
+    super(th);
+    this.code=code.code;
+    logged=true;
+  }
+  
+  @Deprecated
   public SolrException(int code, String msg) {
     super(msg);
     this.code=code;
   }
+  
+  @Deprecated
   public SolrException(int code, String msg, boolean alreadyLogged) {
     super(msg);
     this.code=code;
     this.logged=alreadyLogged;
   }
 
+  @Deprecated
   public SolrException(int code, String msg, Throwable th, boolean alreadyLogged) {
     super(msg,th);
     this.code=code;
     logged=alreadyLogged;
   }
 
+  @Deprecated
   public SolrException(int code, String msg, Throwable th) {
     this(code,msg,th,true);
   }
 
+  @Deprecated
   public SolrException(int code, Throwable th) {
     super(th);
     this.code=code;
@@ -87,6 +136,7 @@
 
 
   // public String toString() { return toStr(this); }  // oops, inf loop
+  @Override
   public String toString() { return super.toString(); }
 
   public static String toStr(Throwable e) {

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/CSVRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/CSVRequestHandler.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/CSVRequestHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/CSVRequestHandler.java Tue May 29 15:28:21 2007
@@ -47,7 +47,7 @@
     Iterable<ContentStream> streams = req.getContentStreams();
     if (streams == null) {
       if(!RequestHandlerUtils.handleCommit(req, rsp, false)) {
-        throw new SolrException( 400, "missing content stream" );
+        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "missing content stream" );
       }
       return;
     }
@@ -189,7 +189,7 @@
           base.add(builder,line,column,val);
         }
       } catch (IOException e) {
-        throw new SolrException(400,"");
+        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"");
       }
     }
   }
@@ -220,13 +220,13 @@
     strategy = new CSVStrategy(',', '"', CSVStrategy.COMMENTS_DISABLED, true,  false, true);
     String sep = params.get(SEPARATOR);
     if (sep!=null) {
-      if (sep.length()!=1) throw new SolrException(400,"Invalid separator:'"+sep+"'");
+      if (sep.length()!=1) throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Invalid separator:'"+sep+"'");
       strategy.setDelimiter(sep.charAt(0));
     }
 
     String encapsulator = params.get(ENCAPSULATOR);
     if (encapsulator!=null) {
-      if (encapsulator.length()!=1) throw new SolrException(400,"Invalid encapsulator:'"+sep+"'");
+      if (encapsulator.length()!=1) throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Invalid encapsulator:'"+sep+"'");
       strategy.setEncapsulator(encapsulator.charAt(0));
     }
 
@@ -242,7 +242,7 @@
         // assume the file has the headers if they aren't supplied in the args
         hasHeader=true;
       } else if (hasHeader) {
-        throw new SolrException(400,"CSVLoader: must specify fieldnames=<fields>* or header=true");
+        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"CSVLoader: must specify fieldnames=<fields>* or header=true");
       }
     } else {
       // if the fieldnames were supplied and the file has a header, we need to
@@ -285,7 +285,7 @@
         for (String mapRule : fmap) {
           String[] mapArgs = colonSplit.split(mapRule,-1);
           if (mapArgs.length!=2)
-            throw new SolrException(400, "Map rules must be of the form 'from:to' ,got '"+mapRule+"'");
+            throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Map rules must be of the form 'from:to' ,got '"+mapRule+"'");
           adders[i] = new CSVLoader.FieldMapperSingle(mapArgs[0], mapArgs[1], adders[i]);
         }
       }
@@ -311,7 +311,7 @@
     sb.append(errHeader+", line="+lineno + ","+msg+"\n\tvalues={");
     for (String val: line) { sb.append("'"+val+"',"); }
     sb.append('}');
-    throw new SolrException(400,sb.toString());
+    throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,sb.toString());
   }
 
   /** load the CSV input */
@@ -333,7 +333,7 @@
     if (fieldnames==null) {
       fieldnames = parser.getLine();
       if (fieldnames==null) {
-        throw new SolrException(400,"Expected fieldnames in CSV input");
+        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Expected fieldnames in CSV input");
       }
       prepareFields();
     }
@@ -387,4 +387,5 @@
     doAdd(line, vals, builder, templateAdd);
   }
 }
+
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/SpellCheckerRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/SpellCheckerRequestHandler.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/SpellCheckerRequestHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/SpellCheckerRequestHandler.java Tue May 29 15:28:21 2007
@@ -113,7 +113,7 @@
         reopen();
         rsp.add("cmdExecuted","reopen");
       } else {
-        throw new SolrException(400, "Unrecognized Command: " + cmd);
+        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unrecognized Command: " + cmd);
       }
     }
 
@@ -147,7 +147,7 @@
   private void rebuild(SolrQueryRequest req) throws IOException, SolrException {
     if (null == termSourceField) {
       throw new SolrException
-        (500, "can't rebuild spellchecker index without termSourceField configured");
+        (SolrException.ErrorCode.SERVER_ERROR, "can't rebuild spellchecker index without termSourceField configured");
     }
       
     IndexReader indexReader = req.getSearcher().getReader();

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java Tue May 29 15:28:21 2007
@@ -72,7 +72,7 @@
     Iterable<ContentStream> streams = req.getContentStreams();
     if( streams == null ) {
       if( !RequestHandlerUtils.handleCommit(req, rsp, false) ) {
-        throw new SolrException( 400, "missing content stream" );
+        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "missing content stream" );
       }
       return;
     }
@@ -262,7 +262,7 @@
                    (System.currentTimeMillis()-startTime));
         } else {
           log.warning("unexpected XML tag /delete/"+currTag);
-          throw new SolrException(400,"unexpected XML tag /delete/"+currTag);
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unexpected XML tag /delete/"+currTag);
         }
 
           res.add( "delete", "" );
@@ -303,7 +303,7 @@
 
       if (!"field".equals(tname)) {
         log.warning("unexpected XML tag doc/"+tname);
-        throw new SolrException(400,"unexpected XML tag doc/"+tname);
+        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unexpected XML tag doc/"+tname);
       }
 
       //

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java Tue May 29 15:28:21 2007
@@ -105,7 +105,7 @@
       Term t = new Term( uniqueKey.getName(), v );
       docId = searcher.getFirstMatch( t );
       if( docId < 0 ) {
-        throw new SolrException( 404, "Can't find document: "+params.get( ID ) );
+        throw new SolrException( SolrException.ErrorCode.NOT_FOUND, "Can't find document: "+params.get( ID ) );
       }
     }
         
@@ -117,7 +117,7 @@
       }
       catch( Exception ex ) {}
       if( doc == null ) {
-        throw new SolrException( 404, "Can't find document: "+docId );
+        throw new SolrException( SolrException.ErrorCode.NOT_FOUND, "Can't find document: "+docId );
       }
       
       SimpleOrderedMap<Object> info = getDocumentFieldsInfo( doc, docId, reader, schema );
@@ -528,6 +528,7 @@
     return info;
   }
 }
+
 
 
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/request/DisMaxRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/request/DisMaxRequestHandler.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/request/DisMaxRequestHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/request/DisMaxRequestHandler.java Tue May 29 15:28:21 2007
@@ -227,7 +227,7 @@
           altUserQuery = p.parse(altQ);
           query.add( altUserQuery , Occur.MUST );
         } else {
-          throw new SolrException( 400, "missing query string" );
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "missing query string" );
         }
       }
       else {

Modified: lucene/solr/trunk/src/java/org/apache/solr/request/RequiredSolrParams.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/request/RequiredSolrParams.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/request/RequiredSolrParams.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/request/RequiredSolrParams.java Tue May 29 15:28:21 2007
@@ -47,7 +47,7 @@
   public String get(String param) {
     String val = params.get(param);
     if( val == null )  {
-      throw new SolrException( 400, "Missing required parameter: "+param );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Missing required parameter: "+param );
     }
     return val;
   }
@@ -56,7 +56,7 @@
   public String[] getParams(String param) {
     String[] vals = params.getParams(param);
     if( vals == null || vals.length == 0 ) {
-      throw new SolrException( 400, "Missing required parameter: "+param );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Missing required parameter: "+param );
     }
     return vals;
   }

Modified: lucene/solr/trunk/src/java/org/apache/solr/request/SolrParams.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/request/SolrParams.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/request/SolrParams.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/request/SolrParams.java Tue May 29 15:28:21 2007
@@ -252,7 +252,7 @@
       return val==null ? null : Integer.valueOf(val);
     }
     catch( Exception ex ) {
-      throw new SolrException( 400, ex.getMessage(), ex );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
 
@@ -263,7 +263,7 @@
       return val==null ? def : Integer.parseInt(val);
     }
     catch( Exception ex ) {
-      throw new SolrException( 400, ex.getMessage(), ex );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
   
@@ -275,7 +275,7 @@
       return val==null ? null : Integer.valueOf(val);
     }
     catch( Exception ex ) {
-      throw new SolrException( 400, ex.getMessage(), ex );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
   
@@ -287,7 +287,7 @@
       return val==null ? def : Integer.parseInt(val);
     }
     catch( Exception ex ) {
-      throw new SolrException( 400, ex.getMessage(), ex );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
 
@@ -299,7 +299,7 @@
       return val==null ? null : Float.valueOf(val);
     }
     catch( Exception ex ) {
-      throw new SolrException( 400, ex.getMessage(), ex );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
 
@@ -310,7 +310,7 @@
       return val==null ? def : Float.parseFloat(val);
     }
     catch( Exception ex ) {
-      throw new SolrException( 400, ex.getMessage(), ex );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
 
@@ -321,7 +321,7 @@
       return val==null ? null : Float.valueOf(val);
     }
     catch( Exception ex ) {
-      throw new SolrException( 400, ex.getMessage(), ex );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
 
@@ -333,7 +333,7 @@
       return val==null ? def : Float.parseFloat(val);
     }
     catch( Exception ex ) {
-      throw new SolrException( 400, ex.getMessage(), ex );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
   
@@ -349,7 +349,7 @@
         return false;
       }
     }
-    throw new SolrException( 400, "invalid boolean value: "+s );
+    throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "invalid boolean value: "+s );
   }
 
   /** Create a Map<String,String> from a NamedList given no keys are repeated */
@@ -400,6 +400,7 @@
     return result;
   }
 }
+
 
 
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/request/SolrQueryRequestBase.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/request/SolrQueryRequestBase.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/request/SolrQueryRequestBase.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/request/SolrQueryRequestBase.java Tue May 29 15:28:21 2007
@@ -98,7 +98,7 @@
   public int getIntParam(String name) {
     String s = getParam(name);
     if (s==null) {
-      throw new SolrException(500,"Missing required parameter '"+name+"' from " + this);
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Missing required parameter '"+name+"' from " + this);
     }
     return Integer.parseInt(s);
   }
@@ -119,7 +119,7 @@
   public String getStrParam(String name) {
     String s = getParam(name);
     if (s==null) {
-      throw new SolrException(500,"Missing required parameter '"+name+"' from " + this);
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Missing required parameter '"+name+"' from " + this);
     }
     return s;
   }

Modified: lucene/solr/trunk/src/java/org/apache/solr/request/StandardRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/request/StandardRequestHandler.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/request/StandardRequestHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/request/StandardRequestHandler.java Tue May 29 15:28:21 2007
@@ -93,7 +93,7 @@
           qstr = commands.get( 0 );
         }
         else if( commands.size() > 2 ) {
-          throw new SolrException( 400, "If you want to use multiple ';' in the query, use the 'sort' param." );
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "If you want to use multiple ';' in the query, use the 'sort' param." );
         }
       }
 
@@ -199,6 +199,7 @@
     catch( MalformedURLException ex ) { return null; }
   }
 }
+
 
 
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/DateField.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/DateField.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/DateField.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/DateField.java Tue May 29 15:28:21 2007
@@ -102,10 +102,10 @@
       try {
         return toInternal(p.parseMath(val.substring(3)));
       } catch (ParseException e) {
-        throw new SolrException(400,"Invalid Date Math String:'" +val+'\'',e);
+        throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Invalid Date Math String:'" +val+'\'',e);
       }
     }
-    throw new SolrException(400,"Invalid Date String:'" +val+'\'');
+    throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Invalid Date String:'" +val+'\'');
   }
   
   public String toInternal(Date val) {

Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/FieldType.java Tue May 29 15:28:21 2007
@@ -170,7 +170,7 @@
     try {
       val = toInternal(externalVal);
     } catch (NumberFormatException e) {
-      throw new SolrException(500, "Error while creating field '" + field + "' from value '" + externalVal + "'", e, false);
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error while creating field '" + field + "' from value '" + externalVal + "'", e, false);
     }
     if (val==null) return null;
     if (!field.indexed() && !field.stored()) {

Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java Tue May 29 15:28:21 2007
@@ -344,7 +344,7 @@
           String msg = "[schema.xml] Duplicate fieldType definition for '"
             + ft.typeName + "' ignoring: "+old.toString();
           
-          Throwable t = new SolrException( 500, msg );
+          Throwable t = new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
           SolrException.logOnce(log,null,t);
           SolrConfig.severeErrors.add( t );
         }
@@ -370,7 +370,7 @@
 
         FieldType ft = fieldTypes.get(type);
         if (ft==null) {
-          throw new SolrException(400,"Unknown fieldtype '" + type + "'",false);
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown fieldtype '" + type + "'",false);
         }
 
         Map<String,String> args = DOMUtil.toMapExcept(attrs, "name", "type");
@@ -386,7 +386,7 @@
             String msg = "[schema.xml] Duplicate field definition for '"
               + f.getName() + "' ignoring: "+old.toString();
             
-            Throwable t = new SolrException( 500, msg );
+            Throwable t = new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
             SolrException.logOnce(log,null,t);
             SolrConfig.severeErrors.add( t );
           }
@@ -408,7 +408,7 @@
               String msg = "[schema.xml] Duplicate DynamicField definition for '"
                 + f.getName() + "' ignoring: "+f.toString();
               
-              Throwable t = new SolrException( 500, msg );
+              Throwable t = new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
               SolrException.logOnce(log,null,t);
               SolrConfig.severeErrors.add( t );
               dup = true;
@@ -516,7 +516,7 @@
               }
             }
             if( df == null ) {
-              throw new SolrException( 500, "copyField dynamic destination must match a dynamicField." );
+              throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "copyField dynamic destination must match a dynamicField." );
             }
             dCopies.add(new DynamicDestCopy(source, df ));
           }
@@ -526,7 +526,7 @@
         } 
         else if( destIsPattern ) {
           String msg =  "copyField only supports a dynamic destination if the source is also dynamic" ;
-          throw new SolrException( 500, msg );
+          throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
         }
         else {
           // retrieve the field to force an exception if it doesn't exist
@@ -553,7 +553,7 @@
     } catch(Exception e) {
       // unexpected exception...
       SolrConfig.severeErrors.add( e );
-      throw new SolrException(500,"Schema Parsing Failed",e,false);
+      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Schema Parsing Failed",e,false);
     }
 
      analyzer = new SolrIndexAnalyzer();
@@ -588,7 +588,7 @@
     NodeList nList = (NodeList)xpath.evaluate("./filter", node, XPathConstants.NODESET);
 
     if (tokNode==null){
-      throw new SolrException(500,"analyzer without class or tokenizer & filter list");
+      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"analyzer without class or tokenizer & filter list");
     }
     TokenizerFactory tfac = readTokenizerFactory(tokNode);
 
@@ -598,7 +598,7 @@
     NodeList nList = node.getChildNodes();
     TokenizerFactory tfac = readTokenizerFactory(nList.item(0));
      if (tfac==null) {
-       throw new SolrException(500,"TokenizerFactory must be specified first in analyzer");
+       throw new SolrException( SolrException.StatusCode.SERVER_ERROR,"TokenizerFactory must be specified first in analyzer");
      }
     ******/
 
@@ -826,7 +826,7 @@
     /***  REMOVED -YCS
     if (defaultFieldType != null) return new SchemaField(fieldName,defaultFieldType);
     ***/
-    throw new SolrException(400,"undefined field "+fieldName);
+    throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"undefined field "+fieldName);
   }
 
   /**
@@ -885,7 +885,7 @@
      for (DynamicField df : dynamicFields) {
       if (df.matches(fieldName)) return df.prototype.getType();
     }
-    throw new SolrException(400,"undefined field "+fieldName);
+    throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"undefined field "+fieldName);
   }
 
   private FieldType dynFieldType(String fieldName) {
@@ -942,6 +942,7 @@
   }
 
 }
+
 
 
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/DocSet.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/DocSet.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/DocSet.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/DocSet.java Tue May 29 15:28:21 2007
@@ -166,14 +166,14 @@
    * @throws SolrException Base implementation does not allow modifications
    */
   public void add(int doc) {
-    throw new SolrException(500,"Unsupported Operation");
+    throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Unsupported Operation");
   }
 
   /**
    * @throws SolrException Base implementation does not allow modifications
    */
   public void addUnique(int doc) {
-    throw new SolrException(500,"Unsupported Operation");
+    throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Unsupported Operation");
   }
 
   /**
@@ -234,6 +234,7 @@
     return this.size() - this.intersectionSize(other);
   }
 }
+
 
 
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/QueryParsing.java Tue May 29 15:28:21 2007
@@ -73,7 +73,7 @@
 
     } catch (ParseException e) {
       SolrCore.log(e);
-      throw new SolrException(400,"Error parsing Lucene query",e);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Error parsing Lucene query",e);
     }
   }
 
@@ -101,7 +101,7 @@
 
     } catch (ParseException e) {
       SolrCore.log(e);
-      throw new SolrException(400,"Query parsing error: " + e.getMessage(),e);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Query parsing error: " + e.getMessage(),e);
     }
   }
 
@@ -177,12 +177,12 @@
     	  top = false;
     	}
     	else {
-    	  throw new SolrException( 400, "Unknown sort order: "+order);
+    	  throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unknown sort order: "+order);
     	}
     	part = part.substring( 0, idx ).trim();
       }
       else {
-		throw new SolrException( 400, "Missing sort order." );
+		throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Missing sort order." );
       }
     	
       if( "score".equals(part) ) {
@@ -204,10 +204,10 @@
           f = schema.getField(part);
         }
         catch( SolrException e ){
-          throw new SolrException( 400, "can not sort on undefined field: "+part, e );
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "can not sort on undefined field: "+part, e );
         }
         if (f == null || !f.indexed()){
-          throw new SolrException( 400, "can not sort on unindexed field: "+part );
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "can not sort on unindexed field: "+part );
         }
         lst[i] = f.getType().getSortField(f,top);
       }

Modified: lucene/solr/trunk/src/java/org/apache/solr/tst/TestRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/tst/TestRequestHandler.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/tst/TestRequestHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/tst/TestRequestHandler.java Tue May 29 15:28:21 2007
@@ -78,7 +78,7 @@
     // we need to un-escape them before we pass to QueryParser
     try {
       String sreq = req.getQueryString();
-      if (sreq==null) throw new SolrException(400,"Missing queryString");
+      if (sreq==null) throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Missing queryString");
       List<String> commands = StrUtils.splitSmart(sreq,';');
 
       String qs = commands.size() >= 1 ? commands.get(0) : "";
@@ -300,4 +300,5 @@
 
 
 }
+
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler.java Tue May 29 15:28:21 2007
@@ -109,7 +109,7 @@
   }
 
   protected boolean existsInIndex(String indexedId) throws IOException {
-    if (idField == null) throw new SolrException(400,"Operation requires schema to have a unique key field");
+    if (idField == null) throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Operation requires schema to have a unique key field");
 
     closeWriter();
     openSearcher();
@@ -127,7 +127,7 @@
 
 
   protected int deleteInIndex(String indexedId) throws IOException {
-    if (idField == null) throw new SolrException(400,"Operation requires schema to have a unique key field");
+    if (idField == null) throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Operation requires schema to have a unique key field");
 
     closeWriter(); openSearcher();
     IndexReader ir = searcher.getReader();
@@ -173,9 +173,9 @@
   // could return the number of docs deleted, but is that always possible to know???
   public void delete(DeleteUpdateCommand cmd) throws IOException {
     if (!cmd.fromPending && !cmd.fromCommitted)
-      throw new SolrException(400,"meaningless command: " + cmd);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"meaningless command: " + cmd);
     if (!cmd.fromPending || !cmd.fromCommitted)
-      throw new SolrException(400,"operation not supported" + cmd);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"operation not supported" + cmd);
     String indexedId = idFieldType.toInternal(cmd.id);
     synchronized(this) {
       deleteInIndex(indexedId);
@@ -187,9 +187,9 @@
   // Depending on implementation, we may not be able to immediately determine num...
   public void deleteByQuery(DeleteUpdateCommand cmd) throws IOException {
     if (!cmd.fromPending && !cmd.fromCommitted)
-      throw new SolrException(400,"meaningless command: " + cmd);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"meaningless command: " + cmd);
     if (!cmd.fromPending || !cmd.fromCommitted)
-      throw new SolrException(400,"operation not supported" + cmd);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"operation not supported" + cmd);
 
     Query q = QueryParsing.parseQuery(cmd.query, schema);
 
@@ -221,7 +221,7 @@
       } catch (IOException e) {
         try { closeSearcher(); } catch (Exception ee) { SolrException.log(SolrCore.log,ee); }
         SolrException.log(SolrCore.log,e);
-        throw new SolrException(500,"Error deleting doc# "+doc,e);
+        throw new SolrException( SolrException.StatusCode.SERVER_ERROR,"Error deleting doc# "+doc,e);
       }
     }
   }
@@ -324,21 +324,21 @@
       return addConditionally(cmd);
     } else if (!cmd.allowDups && cmd.overwritePending && !cmd.overwriteCommitted) {
       // return overwriteBoth(cmd);
-      throw new SolrException(400,"unsupported param combo:" + cmd);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unsupported param combo:" + cmd);
     } else if (!cmd.allowDups && cmd.overwritePending && cmd.overwriteCommitted) {
       return overwriteBoth(cmd);
     } else if (cmd.allowDups && !cmd.overwritePending && !cmd.overwriteCommitted) {
       return allowDups(cmd);
     } else if (cmd.allowDups && !cmd.overwritePending && cmd.overwriteCommitted) {
       // return overwriteBoth(cmd);
-      throw new SolrException(400,"unsupported param combo:" + cmd);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unsupported param combo:" + cmd);
     } else if (cmd.allowDups && cmd.overwritePending && !cmd.overwriteCommitted) {
       // return overwriteBoth(cmd);
-      throw new SolrException(400,"unsupported param combo:" + cmd);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unsupported param combo:" + cmd);
     } else if (cmd.allowDups && cmd.overwritePending && cmd.overwriteCommitted) {
       return overwriteBoth(cmd);
     }
-    throw new SolrException(400,"unsupported param combo:" + cmd);
+    throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unsupported param combo:" + cmd);
   }
 
   public void close() throws IOException {

Modified: lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler2.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler2.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler2.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/update/DirectUpdateHandler2.java Tue May 29 15:28:21 2007
@@ -231,27 +231,27 @@
       // protected with iwCommit (which iwAccess excludes from this block).
       synchronized (this) {
         if (!cmd.allowDups && !cmd.overwritePending && !cmd.overwriteCommitted) {
-          throw new SolrException(400,"unsupported param combo:" + cmd);
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unsupported param combo:" + cmd);
           // this would need a reader to implement (to be able to check committed
           // before adding.)
           // return addNoOverwriteNoDups(cmd);
         } else if (!cmd.allowDups && !cmd.overwritePending && cmd.overwriteCommitted) {
           rc = addConditionally(cmd);
       } else if (!cmd.allowDups && cmd.overwritePending && !cmd.overwriteCommitted) {
-          throw new SolrException(400,"unsupported param combo:" + cmd);
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unsupported param combo:" + cmd);
         } else if (!cmd.allowDups && cmd.overwritePending && cmd.overwriteCommitted) {
           rc = overwriteBoth(cmd);
         } else if (cmd.allowDups && !cmd.overwritePending && !cmd.overwriteCommitted) {
           rc = allowDups(cmd);
         } else if (cmd.allowDups && !cmd.overwritePending && cmd.overwriteCommitted) {
-          throw new SolrException(400,"unsupported param combo:" + cmd);
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unsupported param combo:" + cmd);
         } else if (cmd.allowDups && cmd.overwritePending && !cmd.overwriteCommitted) {
-          throw new SolrException(400,"unsupported param combo:" + cmd);
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unsupported param combo:" + cmd);
         } else if (cmd.allowDups && cmd.overwritePending && cmd.overwriteCommitted) {
           rc = overwriteBoth(cmd);
         }
         if (rc == -1)
-          throw new SolrException(400,"unsupported param combo:" + cmd);
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"unsupported param combo:" + cmd);
         
         if (rc == 1) {
           // adding document -- prep writer
@@ -290,12 +290,12 @@
     if (!cmd.fromPending && !cmd.fromCommitted) {
       numErrors.incrementAndGet();
       numErrorsCumulative.incrementAndGet();
-      throw new SolrException(400,"meaningless command: " + cmd);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"meaningless command: " + cmd);
     }
     if (!cmd.fromPending || !cmd.fromCommitted) {
       numErrors.incrementAndGet();
       numErrorsCumulative.incrementAndGet();
-      throw new SolrException(400,"operation not supported" + cmd);
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"operation not supported" + cmd);
     }
 
     iwCommit.lock();
@@ -315,12 +315,12 @@
      if (!cmd.fromPending && !cmd.fromCommitted) {
        numErrors.incrementAndGet();
        numErrorsCumulative.incrementAndGet();
-       throw new SolrException(400,"meaningless command: " + cmd);
+       throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"meaningless command: " + cmd);
      }
      if (!cmd.fromPending || !cmd.fromCommitted) {
        numErrors.incrementAndGet();
        numErrorsCumulative.incrementAndGet();
-       throw new SolrException(400,"operation not supported" + cmd);
+       throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"operation not supported" + cmd);
      }
 
     boolean madeIt=false;

Modified: lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java Tue May 29 15:28:21 2007
@@ -59,7 +59,7 @@
       if (!sfield.multiValued()) {
         String oldValue = map.put(sfield.getName(), val);
         if (oldValue != null) {
-          throw new SolrException(400,"ERROR: multiple values encountered for non multiValued field " + sfield.getName()
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"ERROR: multiple values encountered for non multiValued field " + sfield.getName()
                   + ": first='" + oldValue + "' second='" + val + "'");
         }
       }
@@ -94,7 +94,7 @@
 
     // error if this field name doesn't match anything
     if (sfield==null && (destArr==null || destArr.length==0)) {
-      throw new SolrException(400,"ERROR:unknown field '" + name + "'");
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"ERROR:unknown field '" + name + "'");
     }
   }
 
@@ -134,7 +134,7 @@
         builder.append(field);
         builder.append(" ");
       }
-      throw new SolrException(400, builder.toString());
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, builder.toString());
     }
     
     Document ret = doc; doc=null;

Modified: lucene/solr/trunk/src/java/org/apache/solr/update/UpdateHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/update/UpdateHandler.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/update/UpdateHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/update/UpdateHandler.java Tue May 29 15:28:21 2007
@@ -73,7 +73,7 @@
           commitCallbacks.add(listener);
           log.info("added SolrEventListener for postCommit: " + listener);
         } catch (Exception e) {
-          throw new SolrException(500,"error parsing event listevers", e, false);
+          throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"error parsing event listevers", e, false);
         }
       }
     }
@@ -88,7 +88,7 @@
           optimizeCallbacks.add(listener);
           log.info("added SolarEventListener for postOptimize: " + listener);
         } catch (Exception e) {
-          throw new SolrException(500,"error parsing event listeners", e, false);
+          throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"error parsing event listeners", e, false);
         }
       }
     }
@@ -129,15 +129,15 @@
 
   protected final String getIndexedId(Document doc) {
     if (idField == null) 
-      throw new SolrException(400,"Operation requires schema to have a unique key field");
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Operation requires schema to have a unique key field");
     
     // Right now, single valued fields that require value transformation from external to internal (indexed)
     // form have that transformation already performed and stored as the field value.
     Fieldable[] id = doc.getFieldables( idField.getName() );
     if (id == null || id.length < 1) 
-      throw new SolrException(400,"Document is missing uniqueKey field " + idField.getName());
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Document is missing uniqueKey field " + idField.getName());
     if( id.length > 1 ) 
-      throw new SolrException(400,"Document specifies multiple unique ids! " + idField.getName());
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Document specifies multiple unique ids! " + idField.getName());
     
     return idFieldType.storedToIndexed( id[0] );
   }
@@ -172,11 +172,12 @@
       } catch (IOException e) {
         // don't try to close the searcher on failure for now...
         // try { closeSearcher(); } catch (Exception ee) { SolrException.log(log,ee); }
-        throw new SolrException(500,"Error deleting doc# "+doc,e,false);
+        throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error deleting doc# "+doc,e,false);
       }
     }
   }
 
 }
+
 
 

Modified: lucene/solr/trunk/src/java/org/apache/solr/util/DOMUtil.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/util/DOMUtil.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/util/DOMUtil.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/util/DOMUtil.java Tue May 29 15:28:21 2007
@@ -296,7 +296,7 @@
         }
         fragment = System.getProperty(propertyName,defaultValue);
         if (fragment == null) {
-          throw new SolrException(500, "No system property or default value specified for " + propertyName);
+          throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "No system property or default value specified for " + propertyName);
         }
       }
       sb.append(fragment);

Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java (original)
+++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java Tue May 29 15:28:21 2007
@@ -96,7 +96,7 @@
         System.setProperty("java.util.logging.config.file", loggingConfig.getAbsolutePath() ); 
       }
       else {
-        throw new SolrException( 500, "can not find logging file: "+loggingConfig );
+        throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "can not find logging file: "+loggingConfig );
       }
     }
     
@@ -105,7 +105,7 @@
       if( Config.isInstanceDirInitialized() ) {
         String dir = Config.getInstanceDir();
         if( !dir.equals( instanceDir ) ) {
-          throw new SolrException( 500, "already initalized: "+dir  );
+          throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "already initalized: "+dir  );
         }
       }
       Config.setInstanceDir( instanceDir );
@@ -150,12 +150,12 @@
         String qt = params.get( SolrParams.QT );
         handler = core.getRequestHandler( qt );
         if( handler == null ) {
-          throw new SolrException( 400, "unknown handler: "+qt);
+          throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "unknown handler: "+qt);
         }
       }
     }
     if( handler == null ) {
-      throw new SolrException( 400, "unknown handler: "+path );
+      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "unknown handler: "+path );
     }
     
     // Make a stream for the 'body' content

Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java Tue May 29 15:28:21 2007
@@ -143,11 +143,11 @@
             solrReq = parsers.parse( path, req );
             String qt = solrReq.getParams().get( SolrParams.QT );
             if( qt != null && qt.startsWith( "/" ) ) {
-              throw new SolrException( 400, "Invalid query type.  Do not use /select to access: "+qt);
+              new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Invalid query type.  Do not use /select to access: "+qt);
             }
             handler = core.getRequestHandler( qt );
             if( handler == null ) {
-              throw new SolrException( 400, "unknown handler: "+qt);
+              new SolrException( SolrException.ErrorCode.BAD_REQUEST, "unknown handler: "+qt);
             }
           }
         }

Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java (original)
+++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java Tue May 29 15:28:21 2007
@@ -117,7 +117,7 @@
     String[] strs = params.getParams( SolrParams.STREAM_URL );
     if( strs != null ) {
       if( !enableRemoteStreams ) {
-        throw new SolrException( 400, "Remote Streaming is disabled." );
+        new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Remote Streaming is disabled." );
       }
       for( final String url : strs ) {
         ContentStreamBase stream = new ContentStreamBase.URLStream( new URL(url) );
@@ -132,7 +132,7 @@
     strs = params.getParams( SolrParams.STREAM_FILE );
     if( strs != null ) {
       if( !enableRemoteStreams ) {
-        throw new SolrException( 400, "Remote Streaming is disabled." );
+        new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Remote Streaming is disabled." );
       }
       for( final String file : strs ) {
         ContentStreamBase stream = new ContentStreamBase.FileStream( new File(file) );
@@ -185,7 +185,7 @@
         }
       }
       catch( UnsupportedEncodingException uex ) {
-        throw new SolrException( 500, uex );
+        throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, uex );
       }
     }
     return new MultiMapSolrParams( map );
@@ -303,7 +303,7 @@
       final HttpServletRequest req, ArrayList<ContentStream> streams ) throws Exception
   {
     if( !ServletFileUpload.isMultipartContent(req) ) {
-      throw new SolrException( 400, "Not multipart content! "+req.getContentType() );
+      new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Not multipart content! "+req.getContentType() );
     }
     
     MultiMapSolrParams params = SolrRequestParsers.parseQueryString( req.getQueryString() );
@@ -378,9 +378,10 @@
       }
       return raw.parseParamsAndFillStreams(req, streams);
     }
-    throw new SolrException( 400, "Unsuported method: "+method );
+    throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unsuported method: "+method );
   }
 }
+
 
 
 

Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrServlet.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrServlet.java?view=diff&rev=542679&r1=542678&r2=542679
==============================================================================
--- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrServlet.java (original)
+++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrServlet.java Tue May 29 15:28:21 2007
@@ -61,7 +61,7 @@
       SolrRequestHandler handler = core.getRequestHandler(solrReq.getQueryType());
       if (handler==null) {
         log.warning("Unknown Request Handler '" + solrReq.getQueryType() +"' :" + solrReq);
-        throw new SolrException(400,"Unknown Request Handler '" + solrReq.getQueryType() + "'", true);
+        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + solrReq.getQueryType() + "'", true);
       }
       core.execute(handler, solrReq, solrRsp );
       if (solrRsp.getException() == null) {