Bug 814579

Summary: pretty.print failed to print output in non-interactive mode
Product: [Other] RHQ Project Reporter: Filip Brychta <fbrychta>
Component: CLIAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED CURRENTRELEASE QA Contact: Jay Shaughnessy <jshaughn>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 4.4CC: hrupp, jshaughn
Target Milestone: ---   
Target Release: RHQ 4.10   
Hardware: x86_64   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-23 08:29:28 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
contains test.js and output.txt none

Description Filip Brychta 2012-04-20 03:13:26 EDT
Description of problem:
pretty.print(childResources); failed to print output however print(childResources); works correctly. See attached test.js

Version-Release number of selected component (if applicable):
Version: 4.4.0-SNAPSHOT
Build Number: ca5eecb

How reproducible:

Steps to Reproduce:
1. import Linux platform resource with all child resources to your inventory
2. run ./rhq-cli.sh -u rhqadmin -p rhqadmin -f test.js > output.txt
Actual results:
see attached output.txt

Expected results:
output of pretty.print(childResources) should not be empty

Additional info:
test.js and output.txt attached
It seems that pretty.print fails with set of resources, for single resource works correctly.
Comment 1 Filip Brychta 2012-04-20 03:15:45 EDT
Created attachment 578884 [details]
contains test.js and output.txt
Comment 2 Charles Crouch 2012-04-23 11:37:28 EDT
Investigate for easy/hard this would be to address
Comment 3 Mike Foley 2012-04-23 12:10:54 EDT
setting priority to medium per BZ triage 4/23 (crouch, santos, oleary, foley)
Comment 4 Filip Brychta 2013-02-27 08:49:07 EST
I run into this again today.
pretty.print failed to print PageList<ResourceOperationHistory> so the output of following code:

var resOpHistCri = new ResourceOperationHistoryCriteria();
var hist = OperationManager.findResourceOperationHistoriesByCriteria(resOpHistCri);

is empty.

Workaround for this is:
Comment 5 Jay Shaughnessy 2013-10-15 17:21:07 EDT
I tracked this down and eventually found the root cause.  I can't really explain it, must be a subtle issue with I/O.

commit 9eb9b7d8837736f0742eacf2151afb700733a2a9
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Tue Oct 15 17:17:29 2013 -0400

    Very strange issue. Replace out.print("\n") with out.println() calls
    seems to solve the problem.
Comment 6 Filip Brychta 2013-10-16 11:38:18 EDT
Verified on 
Version: 4.10.0-SNAPSHOT
Build Number: 9eb9b7d
Comment 7 Heiko W. Rupp 2014-04-23 08:29:28 EDT
Bulk closing of 4.10 issues.

If an issue is not solved for you, please open a new BZ (or clone the existing one) with a version designator of 4.10.