You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/03/05 14:38:19 UTC

[camel] branch master updated (09fcc04 -> fc9413a)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 09fcc04  CAMEL-16285: Extensible ResourceHelper
     new 240f68a  do not init in constructor
     new fc9413a  Avoid NPE

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/oaipmh/component/OAIPMHConsumer.java     | 30 +++++++++++++---------
 .../camel/oaipmh/utils/MockOaipmhServer.java       |  5 +++-
 2 files changed, 22 insertions(+), 13 deletions(-)


[camel] 01/02: do not init in constructor

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 240f68ae3a28eb24b7134d0cecdbd021ea3a8921
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Mar 5 15:36:14 2021 +0100

    do not init in constructor
---
 .../camel/oaipmh/component/OAIPMHConsumer.java     | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/OAIPMHConsumer.java b/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/OAIPMHConsumer.java
index fa83a7b..39b66ed 100644
--- a/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/OAIPMHConsumer.java
+++ b/components/camel-oaipmh/src/main/java/org/apache/camel/oaipmh/component/OAIPMHConsumer.java
@@ -20,30 +20,36 @@ import org.apache.camel.Processor;
 import org.apache.camel.oaipmh.handler.ConsumerResponseHandler;
 import org.apache.camel.oaipmh.handler.Harvester;
 import org.apache.camel.support.DefaultScheduledPollConsumer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * The OAIPMH consumer.
  */
 public class OAIPMHConsumer extends DefaultScheduledPollConsumer {
 
-    private static final Logger LOG = LoggerFactory.getLogger(OAIPMHConsumer.class);
-
     private Harvester harvester;
 
     public OAIPMHConsumer(OAIPMHEndpoint endpoint, Processor processor) throws Exception {
         super(endpoint, processor);
+    }
+
+    @Override
+    public OAIPMHEndpoint getEndpoint() {
+        return (OAIPMHEndpoint) super.getEndpoint();
+    }
+
+    @Override
+    protected void doInit() throws Exception {
+        super.doInit();
         this.harvester = new Harvester(
                 new ConsumerResponseHandler(this),
-                endpoint.getUrl(),
-                endpoint.getVerb(),
-                endpoint.getMetadataPrefix(),
-                endpoint.getUntil(),
-                endpoint.getFrom(),
-                endpoint.getSet(),
-                endpoint.getIdentifier());
-        if (endpoint.isIgnoreSSLWarnings()) {
+                getEndpoint().getUrl(),
+                getEndpoint().getVerb(),
+                getEndpoint().getMetadataPrefix(),
+                getEndpoint().getUntil(),
+                getEndpoint().getFrom(),
+                getEndpoint().getSet(),
+                getEndpoint().getIdentifier());
+        if (getEndpoint().isIgnoreSSLWarnings()) {
             this.harvester.getHttpClient().setIgnoreSSLWarnings(true);
         }
     }


[camel] 02/02: Avoid NPE

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit fc9413af2cf8dab2c74754dc9eabd8de235a45ff
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Mar 5 15:37:48 2021 +0100

    Avoid NPE
---
 .../test/java/org/apache/camel/oaipmh/utils/MockOaipmhServer.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/utils/MockOaipmhServer.java b/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/utils/MockOaipmhServer.java
index de7349b..eed6792 100644
--- a/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/utils/MockOaipmhServer.java
+++ b/components/camel-oaipmh/src/test/java/org/apache/camel/oaipmh/utils/MockOaipmhServer.java
@@ -103,7 +103,10 @@ public final class MockOaipmhServer {
     }
 
     public void stop() {
-        server.stop();
+        if (server != null) {
+            server.stop();
+            server = null;
+        }
     }
 
     public int getHttpPort() {