[
https://issues.apache.org/jira/browse/AMQ-6766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16083935#comment-16083935
]
Harmen Renkema commented on AMQ-6766:
-------------------------------------
Quick and dirty test.
The first will fail because the Scheme constructor being called with -1 as port
from HttpsClientTransport.
{code:java}
package org.apache.activemq.bugs;
import static org.junit.Assert.fail;
import javax.jms.Connection;
import javax.jms.JMSException;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.junit.Test;
public class AMQ6766Test {
@Test
public void https_broker_url_without_port_number() throws JMSException {
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("https://localhost");
try {
Connection connection =
connectionFactory.createConnection();
} catch (JMSException e) {
if (e.getCause() instanceof IllegalStateException &&
"Failure trying to create scheme registry"
.equals(e.getCause().getMessage()) &&
"Port is invalid".equals(e.getCause().getCause().getMessage())) {
fail();
}
}
}
@Test
public void https_broker_url_with_port_number() throws JMSException {
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("https://localhost:123");
try {
Connection connection =
connectionFactory.createConnection();
} catch (JMSException e) {
if (e.getCause() instanceof IllegalStateException &&
"Failure trying to create scheme registry"
.equals(e.getCause().getMessage()) &&
"Port is invalid".equals(e.getCause().getCause().getMessage())) {
fail();
}
}
}
}
{code}
> HttpsClientTransport broken when port isn't explicitly included in the broker
> url
> ---------------------------------------------------------------------------------
>
> Key: AMQ-6766
> URL: https://issues.apache.org/jira/browse/AMQ-6766
> Project: ActiveMQ
> Issue Type: Bug
> Affects Versions: 5.14.3
> Reporter: Harmen Renkema
>
> In the HttpsClientTransport in the createSchemeRegistry method on line 51 a
> new Scheme is instantiated. The port fed to the constructor of Scheme is
> gotten from the remoteUrl URI, which will be set to -1 if the port wasn't
> explicitly included in the broker url.
> The code should be able to deal with this scenario. For instance fallback to
> 443 when the port on the URI is undefined.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)