Bug 1056578

Summary: Improve exception information when incorrect format of list or object was used
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Ondrej Chaloupka <ochaloup>
Component: Domain ManagementAssignee: Brian Stansberry <brian.stansberry>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Kremensky <pkremens>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: dandread, kkhan
Target Milestone: DR1   
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: 2019-08-19 12:38:29 UTC 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 Ondrej Chaloupka 2014-01-22 13:52:50 UTC
Currently when you use in CLI some command working with LIST or OBJECT and you does not specify that it should be LIST {[]} or OBJECT {} you will general exception which talks about nothing:

"failure-description" => "JBAS014749: Operation handler failed: null",

Please, improve the message for user would know understand that he used incorrect value type.

E.g. 
/subsystem=datasources/data-source=ExampleDS:write-attribute(name=valid-connection-checker-properties, value=1)

should inform the user that incorrect data type was used and OBJECT is needed to be used.

The better message should be used when user uses incorrect syntax, like:
/subsystem=datasources/data-source=ExampleDS:write-attribute(name=valid-connection-checker-properties, value={abc:abc})
instead of
/subsystem=datasources/data-source=ExampleDS:write-attribute(name=valid-connection-checker-properties, value={abc=abc})

The user should get information that incorrect syntax was used and not just info that there is some NullPointerException.

There is quite informative message when you use LIST instead of OBJECT
/subsystem=datasources/data-source=ExampleDS:write-attribute(name=valid-connection-checker-properties, value={[a=a]})
you could see
"failure-description" => "JBAS014688: Wrong type for valid-connection-checker-properties. Expected [OBJECT] but was LIST"

Just I would have a proposal to use text which lead to way how to use OBJECT and LIST. I mean use something like:
"JBAS014688: Wrong type for valid-connection-checker-properties. Expected {OBJECT} but was {[LIST]}"

Comment 2 Petr Kremensky 2014-09-19 08:10:36 UTC
Verified on EAP 6.4.0.DR1.1

[standalone@localhost:9999 /] /subsystem=datasources/data-source=ExampleDS:write-attribute(name=valid-connection-checker-properties, value=1)
{
    "outcome" => "failed",
    "failure-description" => "JBAS014688: Wrong type for valid-connection-checker-properties. Expected [OBJECT] but was INT",
    "rolled-back" => true
}
[standalone@localhost:9999 /] /subsystem=datasources/data-source=ExampleDS:write-attribute(name=valid-connection-checker-properties, value={abc:abc})
{
    "outcome" => "failed",
    "failure-description" => "JBAS014688: Wrong type for valid-connection-checker-properties. Expected [OBJECT] but was STRING",
    "rolled-back" => true
}