You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2012/10/04 00:07:11 UTC
svn commit: r1393794 - in /lucene/dev/trunk/solr: CHANGES.txt
solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java
solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
Author: hossman
Date: Wed Oct 3 22:07:09 2012
New Revision: 1393794
URL: http://svn.apache.org/viewvc?rev=1393794&view=rev
Log:
SOLR-3903: Fixed MissingFormatArgumentException in ConcurrentUpdateSolrServer
Modified:
lucene/dev/trunk/solr/CHANGES.txt
lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java
lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1393794&r1=1393793&r2=1393794&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Wed Oct 3 22:07:09 2012
@@ -403,6 +403,9 @@ Bug Fixes
* SOLR-3883: Distributed indexing forwards non-applicable request params.
(Dan Sutton, Per Steffensen, yonik, Mark Miller)
+* SOLR-3903: Fixed MissingFormatArgumentException in ConcurrentUpdateSolrServer
+ (hossman)
+
Other Changes
----------------------
Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java?rev=1393794&r1=1393793&r2=1393794&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java (original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java Wed Oct 3 22:07:09 2012
@@ -156,9 +156,9 @@ public class ConcurrentUpdateSolrServer
if (params != null) {
String fmt = null;
if (params.getBool(UpdateParams.OPTIMIZE, false)) {
- fmt = "<optimize waitSearcher=\"%s\" waitFlush=\"%s\" />";
+ fmt = "<optimize waitSearcher=\"%s\" />";
} else if (params.getBool(UpdateParams.COMMIT, false)) {
- fmt = "<commit waitSearcher=\"%s\" waitFlush=\"%s\" />";
+ fmt = "<commit waitSearcher=\"%s\" />";
}
if (fmt != null) {
byte[] content = String.format(Locale.ROOT,
Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java?rev=1393794&r1=1393793&r2=1393794&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java (original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java Wed Oct 3 22:07:09 2012
@@ -23,9 +23,17 @@ import org.apache.solr.client.solrj.Solr
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer;
import org.apache.solr.client.solrj.impl.XMLResponseParser;
import org.apache.solr.client.solrj.request.RequestWriter;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.util.ExternalPaths;
-import org.junit.BeforeClass;
+import java.util.EnumSet;
+import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.junit.BeforeClass;
+import org.junit.After;
/**
*
@@ -34,6 +42,9 @@ import org.junit.BeforeClass;
*/
@Slow
public class SolrExampleStreamingTest extends SolrExampleTests {
+
+ protected Throwable handledException = null;
+
@BeforeClass
public static void beforeTest() throws Exception {
createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
@@ -50,7 +61,7 @@ public class SolrExampleStreamingTest ex
public Throwable lastError = null;
@Override
public void handleError(Throwable ex) {
- lastError = ex;
+ handledException = lastError = ex;
}
};
@@ -63,4 +74,39 @@ public class SolrExampleStreamingTest ex
throw new RuntimeException( ex );
}
}
+
+ public void testWaitOptions() throws Exception {
+ // SOLR-3903
+ final List<Throwable> failures = new ArrayList<Throwable>();
+ ConcurrentUpdateSolrServer s = new ConcurrentUpdateSolrServer
+ ("http://127.0.0.1:"+port+context, 2, 2) {
+ @Override
+ public void handleError(Throwable ex) {
+ failures.add(ex);
+ }
+ };
+
+ int docId = 42;
+ for (UpdateRequest.ACTION action : EnumSet.allOf(UpdateRequest.ACTION.class)) {
+ for (boolean waitSearch : Arrays.asList(true, false)) {
+ for (boolean waitFlush : Arrays.asList(true, false)) {
+ UpdateRequest updateRequest = new UpdateRequest();
+ SolrInputDocument document = new SolrInputDocument();
+ document.addField("id", docId++ );
+ updateRequest.add(document);
+ updateRequest.setAction(action, waitSearch, waitFlush);
+ s.request(updateRequest);
+ }
+ }
+ }
+ s.commit();
+ s.blockUntilFinished();
+ s.shutdown();
+
+ if (0 != failures.size()) {
+ assertEquals(failures.size() + " Unexpected Exception, starting with...",
+ null, failures.get(0));
+ }
+ }
+
}