Bug 906366 - Wrong Error Message in the Alert API
Wrong Error Message in the Alert API
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: REST (Show other bugs)
4.5
Unspecified Unspecified
unspecified Severity unspecified (vote)
: ---
: RHQ 4.6
Assigned To: Heiko W. Rupp
Mike Foley
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-31 09:12 EST by Fernando Ribeiro
Modified: 2013-09-03 10:43 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-03 10:43:23 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Fernando Ribeiro 2013-01-31 09:12:06 EST
Description of problem:

When the priority is not set in an AlertDefinitionRest object in a PUT call to "alert/definition/{id}", the API mis-sends the following error message:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rhqErrorWrapper>
  <message>Name is null</message> <!-- Should be "Priority is null" -->
</rhqErrorWrapper>

Version-Release number of selected component (if applicable):

4.5.1

How reproducible:

Steps to Reproduce:
1. Create an AlertDefinitionRest object without the priority set
2. Add the object to a PUT call to the "alert/definition/{id}" resource
3. Verify the returned error message
  
Actual results:

The API sends an error message that says "Name is null"

Expected results:

The API sends an error message that says "Priority is null"

Additional info:
Comment 1 Heiko W. Rupp 2013-02-01 08:27:01 EST
The error message is shown, as there is indeed no name supplied for the enum:

Caused by: java.lang.NullPointerException: Name is null
	at java.lang.Enum.valueOf(Enum.java:235) [rt.jar:1.7.0_11]
	at org.rhq.core.domain.alert.AlertPriority.valueOf(AlertPriority.java:28) [rhq-core-domain-ejb3.jar:4.6.0-SNAPSHOT]
	at org.rhq.enterprise.server.rest.AlertDefinitionHandlerBean.updateDefinition(AlertDefinitionHandlerBean.java:279) [rhq-enterprise-server-ejb3.jar:4.6.0-SNAPSHOT]


As AlertsDefinitions need to have a priority, Low will be used if none supplied.

master 142d9dc590c0bd4
Comment 2 Fernando Ribeiro 2013-02-01 09:03:03 EST
Great, you may also want to update the docs, which say that the priority is required.
Comment 3 Heiko W. Rupp 2013-09-03 10:43:23 EDT
Bulk closing of issues in old RHQ releases that are in production for a while now.

Please open a new issue when running into an issue.

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