camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] git commit: Avoid potential NPE from testing.
Date Mon, 24 Feb 2014 17:40:11 GMT
Avoid potential NPE from testing.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/415e51c8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/415e51c8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/415e51c8

Branch: refs/heads/camel-2.12.x
Commit: 415e51c89aa610c84278020647d36a92017a1349
Parents: b24ac95
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Feb 24 18:28:50 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Feb 24 18:42:00 2014 +0100

----------------------------------------------------------------------
 .../camel/component/solr/SolrComponentTestSupport.java  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/415e51c8/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrComponentTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrComponentTestSupport.java
b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrComponentTestSupport.java
index 853b281..a422943 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrComponentTestSupport.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrComponentTestSupport.java
@@ -75,7 +75,9 @@ public class SolrComponentTestSupport extends SolrTestSupport {
 
     @AfterClass
     public static void afterClass() throws Exception {
-        solrRunner.stop();
+        if (solrRunner != null) {
+            solrRunner.stop();
+        }
     }
 
     @Override
@@ -96,8 +98,10 @@ public class SolrComponentTestSupport extends SolrTestSupport {
 
     @Before
     public void clearIndex() throws Exception {
-        // Clear the Solr index.
-        solrServer.deleteByQuery("*:*");
-        solrServer.commit();
+        if (solrServer != null) {
+            // Clear the Solr index.
+            solrServer.deleteByQuery("*:*");
+            solrServer.commit();
+        }
     }
 }


Mime
View raw message