Bug 1073906 - java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoundsException:
Summary: java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoun...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
: 1249918 (view as bug list)
Depends On:
Blocks: 1073917 1074005
TreeView+ depends on / blocked
 
Reported: 2014-03-07 13:08 UTC by Richard W.M. Jones
Modified: 2015-08-04 10:24 UTC (History)
6 users (show)

Fixed In Version:
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:
: 1073917 1074005 (view as bug list)
Environment:
Last Closed: 2014-03-07 16:04:26 UTC
Embargoed:


Attachments (Terms of Use)
InspectVM.java (3.58 KB, text/plain)
2014-03-07 13:08 UTC, Richard W.M. Jones
no flags Details

Description Richard W.M. Jones 2014-03-07 13:08:47 UTC
Created attachment 871888 [details]
InspectVM.java

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 1 Maarten 2014-03-07 13:24:57 UTC
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)

Comment 2 Richard W.M. Jones 2014-03-07 15:29:16 UTC
Patches posted:
https://www.redhat.com/archives/libguestfs/2014-March/thread.html#00042

Comment 3 Richard W.M. Jones 2014-03-07 16:04:26 UTC
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 4 Richard W.M. Jones 2014-03-08 13:24:36 UTC
I've backported the fixes to 1.24.7 which will be released soon.

Comment 5 Richard W.M. Jones 2015-08-04 10:24:05 UTC
*** Bug 1249918 has been marked as a duplicate of this bug. ***


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