Bug 1061954 - NPE when calling system.listActiveSystemsDetails API method
Summary: NPE when calling system.listActiveSystemsDetails API method
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: API
Version: 2.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Milan Zázrivec
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space21
TreeView+ depends on / blocked
 
Reported: 2014-02-05 22:49 UTC by Shannon Hughes
Modified: 2015-04-15 22:50 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-03-04 13:07:44 UTC
Embargoed:


Attachments (Terms of Use)
patch to correct null pointer xmlrpc faults (1.90 KB, patch)
2014-02-05 22:49 UTC, Shannon Hughes
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1061484 1 None None None 2021-01-20 06:05:38 UTC

Internal Links: 1061484

Description Shannon Hughes 2014-02-05 22:49:31 UTC
Created attachment 859904 [details]
patch to correct null pointer xmlrpc faults

Systems registered with the --nohardware flag cause a null pointer exception when using the api listActiveSystemsDetails. The SystemHandler.java class does not handle null values for the DMI info, CPU, RAM or Swap and causes a xmlrpc fault: 

XML or text declaration not at start of entity at line 35, column 76, byte 3983 at /usr/lib64/perl5/vendor_perl/XML/Parser.pm line 187
</value></data></array></value></member><member><name>dmi_info</name><value><?xml version="1.0" encoding="UTF-8"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>-1</int></value></member><member><name>faultString</name><value><string>java.lang.NullPointerException: null</string></value></member></struct></value></fault></methodResponse>

attaching a patch that correctly sets the structs to empty Hashmaps and instantiates Longs for RAM/Swap. 


Duplicator steps: 

1) register a system with the --nohardware or force register existing systems
2) create a api script to call the system with no records in rhnServerDMI, rhnCPU, etc. 
3) Observe the XMLRPC fault

Sample perl api script for testing

#!/usr/bin/perl -w 

use strict; 
use Frontier::Client; 

my $HOST = 'sat560.sat.lan';
my $USER = 'admin';
my $PASS = 'redhat';

my $client = new Frontier::Client(url => "http://$HOST/rpc/api", debug=>1);
my $session = $client->call('auth.login', $USER, $PASS);

my $ref = [1000010017];
my $foo =  $client->call('system.listActiveSystemsDetails',$session, $ref);

Comment 1 Milan Zázrivec 2014-02-06 06:59:58 UTC
Patch applied in spacewalk.git master: f72f426327a1006e215ab5e7cb39b7b3b24da410

Comment 2 Matej Kollar 2014-03-04 13:07:44 UTC
Spacewalk 2.1 has been released.
https://fedorahosted.org/spacewalk/wiki/ReleaseNotes21

Comment 3 Matej Kollar 2014-03-04 13:08:54 UTC
Spacewalk 2.1 has been released.
https://fedorahosted.org/spacewalk/wiki/ReleaseNotes21


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