Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior when a single-byte space character is specified in MessageSelecter #377

Open
glassfishrobot opened this issue Nov 7, 2016 · 6 comments
Assignees
Labels
bug Something isn't working Priority: Minor Type: Bug

Comments

@glassfishrobot
Copy link

If you specify a single-byte space character in MessageSelecter, in EMBEDDED operation or REMOTE operation,
When you try to generate the Browser instance, in each of the operating method, the results will differ.

A: EMBEDDED operation
Call the createBrowser method with a single-byte space character to MessageSelector.
ex) browser = JMSContext.createBrowser (Queue, " ")

At JMSServiceImpl of class addBrowser method, there is a process to invoke the compile method of the Selector class, In the same place, exception SelectorFormatException occurs, it fails to generate the instance.

B. REMOTE operation
As well as the A calls the createBrowser method.
At verifyDestination method of ProtocolHandler class, the value of MessageSelector is Null or, empty, in the case of a single-byte blank, All there is processing that is Null, and later because it is treated as Null, generation of the instance is completed successfully.

As the behavior of the A and B, and which is correct?

Using Open MQ version is 5.1_b09.

Affected Versions

[5.1 (RI-Bug-Fix), 5.1.1_b01]

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
Reported by T_Asano

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
@nigeldeakin said:
The syntax for message selectors is defined in the javadoc for javax.jms.Message. This states:

If the value of a message selector is an empty string, the value is treated as a null and indicates that there is no message selector for the message consumer.

Now a string that contains one space is not, strictly speaking, an "empty string", since the method isEmpty would return false. So the specification is a little vague. However it seems reasonable to treat it like an empty string, and as you observe that's what ProtocolHandler does on the remote client before the selector is passed to the server. However in embedded mode the ProtocolHandler is by-passed, and from your report it appears that a SelectorFormatException is thrown.

So A is the correct behaviour. Please report the exact exception and stack trace you get in case B,

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
t_asano said:
Thank you for answer.
I think from your opinion it seems that REMOTE operation is correct behaviour and EMBEDDED operation is mistaken.

So A is the correct behaviour. Please report the exact exception and stack trace you get in case B,
A … EMBEDDED operation
B … REMOTE operation
A and B are opposite.
Is that so?

I report on an exact exception and the stack trace of the EMBEDDED operation.

com.sun.messaging.jmq.util.selector.SelectorFormatException: Missing operand: " "
at com.sun.messaging.jmq.util.selector.Selector.match(Selector.java:1602)
at com.sun.messaging.jmq.util.selector.Selector.match(Selector.java:1216)
at com.sun.messaging.jmq.util.selector.Selector.compile(Selector.java:338)
at com.sun.messaging.jmq.util.selector.Selector.compile(Selector.java:241)
at com.sun.messaging.jmq.jmsserver.service.imq.JMSServiceImpl.addBrowser(JMSServiceImpl.java:2143)
at com.sun.messaging.jms.ra.DirectSession._createAndAddBrowser(DirectSession.java:1827)
at com.sun.messaging.jms.ra.DirectSession.createBrowser(DirectSession.java:312)
at com.sun.messaging.jmq.jmsclient.JMSContextImpl.createBrowser(JMSContextImpl.java:874)
at application.ConsumerBean.(ConsumerBean.java:41)
at servlet.testA.tpstart(testA.java:87)
at servlet.testA.doGet(testA.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:452)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:308)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:244)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:589)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:128)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:60)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:148)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:576)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:553)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:102)
at java.util.Stack.pop(Stack.java:84)
at com.sun.messaging.jmq.util.selector.Selector.match(Selector.java:1599)
... 42 more

Thanks.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
@nigeldeakin said:
Sorry for the confusion. Yes, B (remote) is correct. A (embedded) is incorrect.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA MQ-376

@glassfishrobot
Copy link
Author

@keilw keilw added the bug Something isn't working label Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority: Minor Type: Bug
Projects
None yet
Development

No branches or pull requests

3 participants