Defensive check for null returned from createConnection()
Closes gh-29706
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -192,7 +192,13 @@ public abstract class JmsAccessor implements InitializingBean {
|
|||||||
* @see jakarta.jms.ConnectionFactory#createConnection()
|
* @see jakarta.jms.ConnectionFactory#createConnection()
|
||||||
*/
|
*/
|
||||||
protected Connection createConnection() throws JMSException {
|
protected Connection createConnection() throws JMSException {
|
||||||
return obtainConnectionFactory().createConnection();
|
ConnectionFactory cf = obtainConnectionFactory();
|
||||||
|
Connection con = cf.createConnection();
|
||||||
|
if (con == null) {
|
||||||
|
throw new jakarta.jms.IllegalStateException(
|
||||||
|
"ConnectionFactory returned null from createConnection(): " + cf);
|
||||||
|
}
|
||||||
|
return con;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user