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 ma...@apache.org on 2010/01/23 16:02:41 UTC
svn commit: r902413 -
/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java
Author: markrmiller
Date: Sat Jan 23 15:02:41 2010
New Revision: 902413
URL: http://svn.apache.org/viewvc?rev=902413&view=rev
Log:
improve error reporting when using missing collection
Modified:
lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java
Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java?rev=902413&r1=902412&r2=902413&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java Sat Jan 23 15:02:41 2010
@@ -22,8 +22,14 @@
import java.util.Map;
import java.util.Set;
+import org.apache.solr.common.SolrException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
// effectively immutable
public class CloudState {
+ protected static Logger log = LoggerFactory.getLogger(CloudState.class);
+
private Map<String,Map<String,Slice>> collectionStates = new HashMap<String,Map<String,Slice>>();
private Set<String> liveNodes = null;
@@ -38,7 +44,13 @@
// nocommit
public Map<String,Slice> getSlices(String collection) {
- return Collections.unmodifiableMap(collectionStates.get(collection));
+ Map<String,Slice> collectionState = collectionStates.get(collection);
+ if(collectionState == null) {
+ log.error("Could not find cloud state for collection:" + collection);
+ throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
+ "Could not find cloud state for collection:" + collection);
+ }
+ return Collections.unmodifiableMap(collectionState);
}
public Set<String> getLiveNodes() {