Issue Details (XML | Word | Printable)

Key: GLASSFISH-19033
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: David Zhao
Reporter: tak09
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
glassfish

Invalid characters can be entered for Physical Destination Name

Created: 23/Aug/12 03:03 AM   Updated: 11/Jul/13 02:20 AM   Resolved: 05/Jul/13 02:44 AM
Component/s: jms
Affects Version/s: 4.0_b45
Fix Version/s: 4.0.1

Time Tracking:
Not Specified

File Attachments: None
Image Attachments:

1. PhysicalDestinationName.png
(182 kB)

Tags:
Participants: David Zhao, Nigel Deakin and tak09


 Description  « Hide

In the GlassFish GUI, invalid characters can be entered for Physical Destination Name.

According to the imqcmd manual (http://docs.oracle.com/cd/E26576_01/doc.312/e24943/command-line-reference.htm#aeonj) , some characters are not allowed for the Physical Destination Name.

"The destination name destName may contain only alphanumeric characters (no spaces) and must begin with an alphabetic character or the underscore (_) or dollar sign ($) character. It may not begin with the characters mq."

The imqcmd command blocks these characters as stated. However, these invalid characters are accepted in the Glassfish GUI.
For example, open Resources>JMS Resources>Destination Resources in the GUI, and invalid characters such as #PhysicalQueue, !123 or mq.abc are accepted. Please see the screenshot. When you click Save, it is created with the invalid name.

If you run a JMS client using this Physical Destination Name after the above is saved, it will fail with the following Exception.

23/08/2012 10:47:09 AM com.sun.enterprise.connectors.util.SetMethodAction handleException
WARNING: RAR7096: Exception null while trying to set the value #PhysicalQueue on property Name
com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Unre
solved Message-Destination-Ref Producer/queue@java.lang.String@null into class Producer: Lookup fail
ed for 'java:comp/env/Producer/queue' in SerialContext[myEnv=

Unknown macro: {java.naming.factory.initial=com.sun.en terprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.namin g, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl}

at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManag

When you try the same thing using the asadmin, it is a little different. Physical name 123 or !abc fails. However, mq.abc is accepted which is not supposed to be allowed.

When physical destination name is 123, asadmin create-jms-resource fails.

C:\>asadmin create-jms-resource --restype javax.jms.Queue --property Name=123 jms/TestQueue2
remote failure: Unable to create admin object. Reason: Destination Resource jms/TestQueue2 has an in
valid destination name 123
Command create-jms-resource failed.

When physical destination name is !abc, asadmin create-jms-resource fails.

C:\>asadmin create-jms-resource --restype javax.jms.Queue --property Name=!abc jms/TestQueue2
remote failure: Unable to create admin object. Reason: Destination Resource jms/TestQueue2 has an in
valid destination name !abc
Command create-jms-resource failed.

When physical destination name begins with mq., asadmin create-jms-resource works. However, this is not supposed to be.

C:\>asadmin create-jms-resource --restype javax.jms.Queue --property Name=mq.abc jms/TestQueue2
Administered object jms/TestQueue2 created.
Command create-jms-resource executed successfully.

I think Glassfish GUI and asadmin need fix for this problem. Thank you.



David Zhao added a comment - 11/Jul/13 02:20 AM

As what I mentioned previously, create-jms-resource invokes create-admin-object and create-connector-resource internally for jms destination and connection factory. In domain.xml, there is no any JMS resources actually, but they are represented by connector admin object and connector connection factory indeed. That is why you can see the same JMS resource under both Connector Resources and JMS Resources tabs in admin gui. That behavior had been existing for a long time.

In the admin gui, when creating/editing any JMS resources, it calls create-admin-object and create-connector-resource directly instead of calling create-jms-resource. That is why you spotted that it was fixed in asadmin create-jms-resource, but it exists in admin gui.

We are planning to enhance create-jms-resource for admin gui to use in the future. But currently the difference between asadmin create-jms-resource and admin gui is expected. Let me know if you have further questions.


tak09 added a comment - 11/Jul/13 01:59 AM

I checked the fix using glassfish-4.0.1-b02-07_08_2013.zip.
I confirmed the bug in asadmin has been fixed. Thank you very much.

However, I still see the bug in GUI.
For example,
1. Open Resources>JMS Resources>Destination Resources in the GUI.
2. Click "New" button.
3. Enter invalid characters such as mq.abc, #PhysicalQueue or !234 in Physical Destination Name.
4. Click Save.
5. Bug. Physical Destination Name is saved with invalid characters.

Has this been fixed already?


David Zhao added a comment - 05/Jul/13 02:44 AM

Fixed by checking "mq." prefix and non-ascii charactors for physical destination name.


Nigel Deakin added a comment - 15/Feb/13 02:42 PM

In accordance with the project triage guidelines this is not needed for 4.0 and so has been deferred until 4.0.1. Setting "fix version" accordingly.


tak09 added a comment - 06/Sep/12 01:06 AM

In addition to the above, Japanese characters must not be allowed for the physical destination name. However, this is currently not checked.

C:\>asadmin create-jms-resource --restype=javax.jms.Topic --property Name
=あ Test12345
Administered object Test12345 created.
Command create-jms-resource executed successfully.
C:\>asadmin get resources.admin-object-resource.Test12345.*
resources.admin-object-resource.Test12345.property.Name=?
resources.admin-object-resource.Test12345.enabled=true
resources.admin-object-resource.Test12345.jndi-name=Test12345
resources.admin-object-resource.Test12345.object-type=user
resources.admin-object-resource.Test12345.res-adapter=jmsra
resources.admin-object-resource.Test12345.res-type=javax.jms.Topic
Command get executed successfully.