Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
[BZ 1105743] - Viewing operation details for operations with no resul…
Browse files Browse the repository at this point in the history
…ts causes Globally uncaught exception in UI - java.lang.IllegalArgumentException:Null configuration.

- BZ 1103375 for RHQ
- Handled cases where null results are returned from an operation excecution.
- Fixed one op history update path where [results] data could be lost.

(cherry picked from commit ed8a2c4)
Signed-off-by: Jirka Kremser <jkremser@redhat.com>

Conflicts:
	modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/topology/AgentDetailView.java
  • Loading branch information
jshaughn authored and jkremser committed Jun 25, 2014
1 parent 4f23c5d commit ff3591d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
Expand Up @@ -138,7 +138,8 @@ protected Canvas buildResultsSection(ResourceOperationHistory operationHistory)
ConfigurationDefinition resultsConfigurationDefinition = operationDefinition
.getResultsConfigurationDefinition();
if (resultsConfigurationDefinition != null
&& !resultsConfigurationDefinition.getPropertyDefinitions().isEmpty()) {
&& !resultsConfigurationDefinition.getPropertyDefinitions().isEmpty()
&& operationHistory.getResults() != null) {
ConfigurationEditor editor = new ConfigurationEditor(
operationDefinition.getResultsConfigurationDefinition(), operationHistory.getResults());
editor.setPreserveTextFormatting(true);
Expand Down
Expand Up @@ -126,18 +126,24 @@ protected ResourceOperationHistory createOperationHistory(String jobName, String
return persisted;
}

/**
* @return This returns all optional data and should be suitable for modification and subsequent update.
*/
protected ResourceOperationHistory findOperationHistory(String name, String group,
OperationManagerLocal operationManager,
ResourceOperationSchedule schedule) {
OperationManagerLocal operationManager, ResourceOperationSchedule schedule) {

JobId jobId = new JobId(name,group);
JobId jobId = new JobId(name, group);

ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
criteria.addFilterJobId(jobId);
criteria.fetchOperationDefinition(true);
criteria.fetchParameters(true);
criteria.fetchResults(true);

ResourceOperationHistory history ;
List<ResourceOperationHistory> list = operationManager.findResourceOperationHistoriesByCriteria(schedule.getSubject(),criteria);
if (list==null || list.isEmpty()) {
ResourceOperationHistory history;
List<ResourceOperationHistory> list = operationManager.findResourceOperationHistoriesByCriteria(
schedule.getSubject(), criteria);
if (list == null || list.isEmpty()) {
return null;
}

Expand Down
Expand Up @@ -290,10 +290,10 @@ public ResourceOperationSchedule scheduleResourceOperation(Subject subject, int
jobDataMap.put(OperationJob.DATAMAP_INT_ENTITY_ID, String.valueOf(schedule.getId()));

// Create an IN_PROGRESS item
// - we need a copy of parameters to avoid constraint violations upon delete
ResourceOperationHistory history;
history = new ResourceOperationHistory(uniqueJobId, jobGroupName, subject.getName(), opDef,
// we need a copy to avoid constraint violations upon delete
parameters == null ? null : parameters.deepCopy(false), schedule.getResource(), null);
(parameters == null ? null : parameters.deepCopy(false)), schedule.getResource(), null);

updateOperationHistory(subject,history);

Expand Down

0 comments on commit ff3591d

Please sign in to comment.