lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r786784 - /lucene/solr/trunk/src/common/org/apache/solr/common/SolrException.java
Date Sat, 20 Jun 2009 10:02:42 GMT
Author: noble
Date: Sat Jun 20 10:02:42 2009
New Revision: 786784

URL: http://svn.apache.org/viewvc?rev=786784&view=rev
Log:
added a sttaic method to get the enum from an int code

Modified:
    lucene/solr/trunk/src/common/org/apache/solr/common/SolrException.java

Modified: lucene/solr/trunk/src/common/org/apache/solr/common/SolrException.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/common/org/apache/solr/common/SolrException.java?rev=786784&r1=786783&r2=786784&view=diff
==============================================================================
--- lucene/solr/trunk/src/common/org/apache/solr/common/SolrException.java (original)
+++ lucene/solr/trunk/src/common/org/apache/solr/common/SolrException.java Sat Jun 20 10:02:42
2009
@@ -36,14 +36,20 @@
     FORBIDDEN( 403 ),
     NOT_FOUND( 404 ),
     SERVER_ERROR( 500 ),
-    SERVICE_UNAVAILABLE( 503 ); 
-    
+    SERVICE_UNAVAILABLE( 503 ),
+    UNKNOWN(0);
     final int code;
     
     private ErrorCode( int c )
     {
       code = c;
     }
+    public static ErrorCode getErrorCode(int c){
+      for (ErrorCode err : values()) {
+        if(err.code == c) return err;
+      }
+      return UNKNOWN;
+    }
   };
   
   public boolean logged=false;



Mime
View raw message