[
https://issues.apache.org/jira/browse/NIFI-1378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15092511#comment-15092511
]
Joseph Witt edited comment on NIFI-1378 at 1/11/16 7:20 PM:
------------------------------------------------------------
Also to your example above
{quote}
(tcp://localhost:18987,localhost:18988)?initialReconnectDelay=100
{quote}
I put that in a unit test
{code}
@Test
public void testInvalidURL2() throws Exception {
GetJMSQueue getJmsQueue = new GetJMSQueue();
TestRunner runner = TestRunners.newTestRunner(getJmsQueue);
runner.setProperty(JmsProperties.JMS_PROVIDER,
JmsProperties.ACTIVEMQ_PROVIDER);
runner.setProperty(JmsProperties.URL,
"(tcp://localhost:18987,localhost:18988. . .)?initialReconnectDelay=100");
runner.setProperty(JmsProperties.DESTINATION_NAME, "queue.testing");
runner.setProperty(JmsProperties.ACKNOWLEDGEMENT_MODE,
JmsProperties.ACK_MODE_AUTO);
runner.assertNotValid();
}
{code}
And got this result
{quote}
java.lang.AssertionError: Processor has 1 validation failures:
'URL' validated against '(tcp://localhost:18987,localhost:18988. .
.)?initialReconnectDelay=100' is invalid because Not a valid URI
at org.junit.Assert.fail(Assert.java:88)
at
org.apache.nifi.util.MockProcessContext.assertValid(MockProcessContext.java:232)
at
org.apache.nifi.util.StandardProcessorTestRunner.assertValid(StandardProcessorTestRunner.java:330)
at
org.apache.nifi.processors.standard.TestGetJMSQueue.testInvalidURL2(TestGetJMSQueue.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
{quote}
So the key observation there is that the given example itself is not a valid
URI - is it? And our processor expects a given URI and not simply some vendor
specific connection string. It is quite easy to setup a flow in NiFi to
correctly failover.
was (Author: joewitt):
Also to your example above
{quote}
(tcp://localhost:18987,localhost:18988. . .)?initialReconnectDelay=100
{quote}
I put that in a unit test
{code}
@Test
public void testInvalidURL2() throws Exception {
GetJMSQueue getJmsQueue = new GetJMSQueue();
TestRunner runner = TestRunners.newTestRunner(getJmsQueue);
runner.setProperty(JmsProperties.JMS_PROVIDER,
JmsProperties.ACTIVEMQ_PROVIDER);
runner.setProperty(JmsProperties.URL,
"(tcp://localhost:18987,localhost:18988. . .)?initialReconnectDelay=100");
runner.setProperty(JmsProperties.DESTINATION_NAME, "queue.testing");
runner.setProperty(JmsProperties.ACKNOWLEDGEMENT_MODE,
JmsProperties.ACK_MODE_AUTO);
runner.assertNotValid();
}
{code}
And got this result
{quote}
java.lang.AssertionError: Processor has 1 validation failures:
'URL' validated against '(tcp://localhost:18987,localhost:18988. .
.)?initialReconnectDelay=100' is invalid because Not a valid URI
at org.junit.Assert.fail(Assert.java:88)
at
org.apache.nifi.util.MockProcessContext.assertValid(MockProcessContext.java:232)
at
org.apache.nifi.util.StandardProcessorTestRunner.assertValid(StandardProcessorTestRunner.java:330)
at
org.apache.nifi.processors.standard.TestGetJMSQueue.testInvalidURL2(TestGetJMSQueue.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
{quote}
So the key observation there is that the given example itself is not a valid
URI - is it? And our processor expects a given URI and not simply some vendor
specific connection string. It is quite easy to setup a flow in NiFi to
correctly failover.
> GetJMSQueue throws NPE with invalid URL
> ---------------------------------------
>
> Key: NIFI-1378
> URL: https://issues.apache.org/jira/browse/NIFI-1378
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 0.4.1
> Reporter: Joseph Witt
> Assignee: Joseph Witt
> Fix For: 0.5.0
>
> Attachments:
> 0001-NIFI-1378-added-validator-to-ensure-the-JMS-URI-has-.patch
>
>
> GetJMSQueue throws an NPE. Easily reproduced even without an actual JMS
> broker setup. Use a URL of 'localhost' and some bogus topic.
> {quote}
> 2016-01-10 01:20:23,430 WARN [Timer-Driven Process Thread-3]
> o.a.n.c.t.ContinuallyRunProcessorTask Administratively Yielding
> GetJMSQueue[id=e1ce5a1b-818a-4b84-b913-7
> 16e9206c73e] due to uncaught Exception: java.lang.NullPointerException
> 2016-01-10 01:20:23,431 WARN [Timer-Driven Process Thread-3]
> o.a.n.c.t.ContinuallyRunProcessorTask
> java.lang.NullPointerException: null
> at
> org.apache.nifi.processors.standard.util.JmsFactory.createConnectionFactory(JmsFactory.java:366)
> ~[na:na]
> at
> org.apache.nifi.processors.standard.util.JmsFactory.createConnection(JmsFactory.java:111)
> ~[na:na]
> at
> org.apache.nifi.processors.standard.util.JmsFactory.createConnection(JmsFactory.java:104)
> ~[na:na]
> at
> org.apache.nifi.processors.standard.util.JmsFactory.createQueueMessageConsumer(JmsFactory.java:239)
> ~[na:na]
> at
> org.apache.nifi.processors.standard.GetJMSQueue.onTrigger(GetJMSQueue.java:63)
> ~[na:na]
> at
> org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
> ~[nifi-api-1.1.1.0-12.jar:1.1.1.0-12]
> at
> org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1146)
> ~[nifi-framework-core-1.1.1.0-12.jar:1.1.1.0-12]
> at
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:139)
> [nifi-framework-core-1.1.1.0-12.jar:1.1.1.0-12]
> at
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:49)
> [nifi-framework-core-1.1.1.0-12.jar:1.1.1.0-12]
> at
> org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:119)
> [nifi-framework-core-1.1.1.0-12.jar:1.1.1.0-12]
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> [na:1.7.0_79]
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
> [na:1.7.0_79]
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
> [na:1.7.0_79]
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> [na:1.7.0_79]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> [na:1.7.0_79]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> [na:1.7.0_79]
> at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
> {quote}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)