Bug 1008497

Summary: CLI permits creation of mail-session with name different from JNDI name
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Jan Blizňák <jbliznak>
Component: MailAssignee: jboss-set
Status: CLOSED CURRENTRELEASE QA Contact: Michael Cada <mcada>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.1CC: brian.stansberry, pkremens, pslavice
Target Milestone: DR10   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Blizňák 2013-09-16 13:33:23 UTC
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.
or
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 10:05:13 UTC
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 14:04:41 UTC
This is bug that was fixed in upstream long time ago. Just needs backporting.

Comment 6 Radim Hatlapatka 2014-11-19 11:49:34 UTC
Verified with EAP 6.4.0.DR10