Bug 1073917

Summary: java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoundsException:
Product: Red Hat Enterprise Linux 7 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: jherrman, leiwang, lkong, maarten.fonville, mbooth, ptoscano, rbalakri, yuliu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.27.56-1.1.el7 Doc Type: Bug Fix
Doc Text:
In the Java binding, or APIs that return a list of objects different from String caused an ArrayIndexOutOfBoundsException exception to be triggered. The creation of the result list has been fixed, and these APIs now return the expected result.
Story Points: ---
Clone Of: 1073906 Environment:
Last Closed: 2015-03-05 13:43:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1021149, 1062533, 1073906    
Bug Blocks:    

Description Richard W.M. Jones 2014-03-07 13:33:07 UTC
+++ This bug was initially created as a clone of Bug #1073906 +++

Description of problem:

Using the inspect_list_applications2 function causes java.lang.ArrayIndexOutOfBoundsException to be thrown.

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

libguestfs-java-1.25.42-1.fc21.x86_64

How reproducible:

100%

Steps to Reproduce:

Download InspectVM.java file attached.

Compile it like this:

javac -classpath /usr/share/java/libguestfs.jar InspectVM.java 

To test this you will need any Linux disk image.  eg. Build one using
virt-builder:

virt-builder fedora-20

Run the program on this disk image:

$ java -classpath /usr/share/java/libguestfs.jar:. InspectVM fedora-20.img 
Root device: /dev/sda3
  Product name: Fedora release 20 (Heisenbug)
  Version:      20.0
  Type:         linux
  Distro:       fedora
java.lang.ArrayIndexOutOfBoundsException: 231

It shouldn't print the ArrayIndexOutOfBoundsException error.

Comment 2 Richard W.M. Jones 2014-03-07 16:07:10 UTC
Fixed upstream in:

6aa64ee3a3f1c990b5f9ce537f2b840273c3c1ba
d00840d727e4040a7958ecc613599d6ec2851e53
8c219636a272c4288f22392ff27b9c04580aecb4
7a0e71f7331540809db5f539d1a9fe2af050c56a
dff35285e491d1905d38c90d83fed98932cbc3b3

& regression test:

ebf8a3654ac4a691d48199adb8e92e182012a8c2
1ba2e3e14aa6d58bff26646a1328969fda44610f

Comment 3 Lingfei Kong 2014-04-14 02:58:27 UTC
Can reproduce with libguestfs-java-1.22.6-22.el7

Steps to reproduce
1. Download attachment: InspectVM.java
2.# javac -classpath /usr/share/java/libguestfs-1.22.6.jar InspectVM.java
3. Download Fedora 18 disk image
4. java -classpath /usr/share/java/libguestfs-1.22.6.jar:. InspectVM Fedora-18.raw
Root device: /dev/fedora_dhcp-11-24/root
  Product name: Fedora release 18 (Spherical Cow)
  Version:      18.0
  Type:         linux
  Distro:       fedora
java.lang.ArrayIndexOutOfBoundsException: 1188


java throws exception: ArrayIndexOutOfBoundsException

Comment 4 Ludek Smid 2014-06-26 11:16:52 UTC
This request was not resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you need
to escalate this bug.

Comment 7 yuliu 2014-11-10 09:00:29 UTC
1. version : libguestfs-1.28.1-1.9.el7.x86_64

Root device: /dev/fedora_dhcp-11-24/root
  Product name: Fedora release 18 (Spherical Cow)
  Version:      18.0
  Type:         linux
  Distro:       fedora
  Number of apps installed = 1189
    GConf2 3.2.5 3.fc18
...

Verified as above.

Comment 9 errata-xmlrpc 2015-03-05 13:43:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0303.html