Bug 906366 - Wrong Error Message in the Alert API
Summary: Wrong Error Message in the Alert API
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: REST
Version: 4.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: RHQ 4.6
Assignee: Heiko W. Rupp
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-31 14:12 UTC by Fernando Ribeiro
Modified: 2013-09-03 14:43 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-03 14:43:23 UTC
Embargoed:


Attachments (Terms of Use)

Description Fernando Ribeiro 2013-01-31 14:12:06 UTC
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 13:27:01 UTC
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 14:03:03 UTC
Great, you may also want to update the docs, which say that the priority is required.

Comment 3 Heiko W. Rupp 2013-09-03 14:43:23 UTC
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.