Bug 1074005 - java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoundsException:
Summary: java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoun...
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.6
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Pino Toscano
QA Contact: Virtualization Bugs
Depends On: 1073906
TreeView+ depends on / blocked
Reported: 2014-03-07 16:12 UTC by Richard W.M. Jones
Modified: 2015-07-22 05:55 UTC (History)
8 users (show)

Fixed In Version: libguestfs-1.20.11-12.el6
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.
Clone Of: 1073906
Last Closed: 2015-07-22 05:55:13 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1444 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2015-07-20 18:44:02 UTC

Description Richard W.M. Jones 2014-03-07 16:12:50 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):


How reproducible:


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 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.

--- Additional comment from Maarten on 2014-03-07 08:24:57 EST ---

This same bug appears with a ubuntu guest machine.

Tewsted it with JDK Oracle 1.8 and multiple  libguestfs versions (up to 1.24.5)

--- Additional comment from Richard W.M. Jones on 2014-03-07 10:29:16 EST ---

Patches posted:

--- Additional comment from Richard W.M. Jones on 2014-03-07 11:04:26 EST ---

I pushed this series upstream, on the basis that:

 - passes make check

 - passes make check-valgrind [but valgrind probably isn't run on
   the java bindings, so this may not be meaningful]

 - should be at least an improvement on the previous situation, even
   if we discover further problems.

Therefore I'm closing this bug, fixed upstream in libguestfs >= 1.25.43.

These are candidates for backporting to the stable branch.

Please reopen if you find further problems with
g.inspect_list_applications2.  For other Java bindings bugs,
open a new bug.

Comment 1 Richard W.M. Jones 2014-03-07 16:13:23 UTC
Fixed upstream in:


& regression test:


Comment 5 Hu Zhang 2014-12-10 09:11:21 UTC
Verified the issue.

Host Version:

Packages Version:

verify steps:
1. javac -classpath /usr/share/java/libguestfs-1.20.11.jar InspectVM.java

2. java -classpath /usr/share/java/libguestfs-1.20.11.jar:. InspectVM RHEL7.1.64-hvm.raw
Root device: /dev/rhel/root
  Product name: Red Hat Enterprise Linux Server release 7.1 Beta (Maipo)
  Version:      7.1
  Type:         linux
  Distro:       rhel
  Number of apps installed = 497
    ModemManager-glib 1.1.0 6.git20130913.el7
    NetworkManager 7.git20141125.f32075d2.el7
    NetworkManager-config-server 7.git20141125.f32075d2.el7

No ArrayIndexOutOfBoundsException error returned.


Comment 7 errata-xmlrpc 2015-07-22 05:55:13 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.


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