Bug 1008497 - CLI permits creation of mail-session with name different from JNDI name
CLI permits creation of mail-session with name different from JNDI name
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Mail (Show other bugs)
Unspecified Unspecified
unspecified Severity medium
: DR10
: EAP 6.4.0
Assigned To: Tomaz Cerar
Radim Hatlapatka
Depends On:
  Show dependency treegraph
Reported: 2013-09-16 09:33 EDT by Jan Blizňák
Modified: 2017-10-09 20:21 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jan Blizňák 2013-09-16 09:33:23 EDT
Description of problem:

CLI permits creating new mail-session with name different to jndi-name attribute's value. 
But because only jndi-name is saved in config xml, the name for mail-session cannot be restored and it is changed to the same value as jndi-name attribute after server reload/restart. This might be seen as unexpected behaviour.

Steps to Reproduce:

1. starting server with no mail-session defined gives this output:
[standalone@localhost:9999 /] /subsystem=mail:read-children-names(child-type=mail-session)
    "outcome" => "success",
    "result" => []

2. add new mail-session with name different from jndi-name value:
[standalone@localhost:9999 /] /subsystem=mail/mail-session=testMS:add(jndi-name=java:jboss/mail/testJNDI)
{"outcome" => "success"}

3. check result - name of created mail-session:
[standalone@localhost:9999 /] /subsystem=mail:read-children-names(child-type=mail-session)
    "outcome" => "success",
    "result" => ["testMS"]

4. check result - jndi-name value for created mail sesison:
[standalone@localhost:9999 /] /subsystem=mail/mail-session=testMS:read-attribute(name=jndi-name)
    "outcome" => "success",
    "result" => "java:jboss/mail/testJNDI"

5. reload/restart server
6. list created mail-sessions - different name shows up:

[standalone@localhost:9999 /] /subsystem=mail:read-children-names(child-type=mail-session)
    "outcome" => "success",
    "result" => ["java:jboss/mail/testJNDI"]

7. check if it is the mail session I want - print its jndi-name value:
[standalone@localhost:9999 /] /subsystem=mail/mail-session=java\:jboss\/mail\/testJNDI:read-attribute(name=jndi-name) 
    "outcome" => "success",
    "result" => "java:jboss/mail/testJNDI"

Actual results:
The name of mail-session node in CLI configuation is changed to jndi-name attribute's value after server reload/restart.

Expected results:

a) prohibit creating mail-session with different names for mail-session itself and for jndi-name. Then step 2 should fail.
b) the actual node name is also saved into config xml so that it can be restored after reload/restart

Additional info:
This can also lead to error in web management console. After step 2 try to edit any paramater of this mail-session through web console and you get error since it uses jndi-name as mail-session name in configuration address.
Comment 2 Martin Velas 2014-08-11 06:05:13 EDT
Issue is still valid for EAP 6.3.0.ER10.

The only difference came up in step 1. - starting server with no mail-session defined gives actually this output:
[standalone@localhost:9999 /] /subsystem=mail:read-children-names(child-type=mail-session)
    "outcome" => "success",
    "result" => ["java:jboss/mail/Default"]

But the invalid name changing still persists.
Comment 4 Tomaz Cerar 2014-11-06 09:04:41 EST
This is bug that was fixed in upstream long time ago. Just needs backporting.
Comment 6 Radim Hatlapatka 2014-11-19 06:49:34 EST
Verified with EAP 6.4.0.DR10

Note You need to log in before you can comment on or make changes to this bug.