Merge pull request #394 from ukwa/update-ampq-client

Update AMPQ client library to address security warning.
This commit is contained in:
Andy Jackson
2021-05-28 13:24:23 +01:00
committed by GitHub
2 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -55,7 +55,7 @@
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>3.2.1</version>
<version>4.8.0</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
@@ -26,6 +26,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
@@ -180,7 +181,7 @@ public class AMQPUrlReceiver
// start up again
try {
startConsumer();
} catch (IOException e) {
} catch (IOException | TimeoutException e) {
logger.log(Level.SEVERE, "problem starting AMQP consumer (will try again after 10 seconds)", e);
}
}
@@ -193,7 +194,7 @@ public class AMQPUrlReceiver
consumerTag = null;
logger.info("Cancelled URLConsumer.");
}
} catch (IOException e) {
} catch (IOException | TimeoutException e) {
logger.log(Level.SEVERE, "problem cancelling AMQP consumer (will try again after 10 seconds)", e);
}
}
@@ -209,7 +210,7 @@ public class AMQPUrlReceiver
}
}
public void startConsumer() throws IOException {
public void startConsumer() throws IOException, TimeoutException {
Consumer consumer = new UrlConsumer(channel());
channel().exchangeDeclare(getExchange(), "direct", true);
channel().queueDeclare(getQueueName(), durable,
@@ -235,7 +236,7 @@ public class AMQPUrlReceiver
// try to synchronously start the consumer right now, so
// that the queue is bound before crawling starts
starterRestarter.startConsumer();
} catch (IOException e) {
} catch (IOException | TimeoutException e) {
logger.log(Level.SEVERE, "problem starting AMQP consumer (will try again soon)", e);
}
starterRestarter.start();
@@ -278,7 +279,7 @@ public class AMQPUrlReceiver
transient protected Connection connection = null;
transient protected Channel channel = null;
protected Connection connection() throws IOException {
protected Connection connection() throws IOException, TimeoutException {
lock.lock();
try {
if (connection != null && !connection.isOpen()) {
@@ -302,7 +303,7 @@ public class AMQPUrlReceiver
}
}
protected Channel channel() throws IOException {
protected Channel channel() throws IOException, TimeoutException {
lock.lock();
try {
if (channel != null && !channel.isOpen()) {