[java-gnome-hackers] Problem with bindings generator
Brought to you by:
afcowie
From: Stefan P. <st...@pr...> - 2008-05-28 20:48:24
|
Hi all, I just stumbled over something in the generated source code for GtkTreePath.c 1. GtkTreePath.getIndices(TreePath) always returns null ======================================================== The method JNIEXPORT jintArray JNICALL Java_org_gnome_gtk_GtkTreePath_gtk_1tree_1path_1get_1indices is supposed to return an integer array. Calling it from GtkTreePath.java only returned a NullPointer. Inspecting the code I found // translate return value to JNI type _result = (jintArray) NULL; which I think explains my problems :) So, question number 1: Why was the line generated that way? 2. Modified GtkTreePath.getIndices(TreePath) succeeds, but later int array usage emits NullPointerException ======================================================== When I change the line to _result = (jintArray) result; the application crashes. JUnit tests for TreePath.getIndices() fail in the third line of the following code: int[] ind = path.getIndices(); if (ind==null) System.out.println("Indices are null"); System.out.println(ind); with the following message: Encoutered an error at ValidateTreeStore.java:430 The following exception was thrown: java.lang.NullPointerException Normally exceptions in unit tests are trapped and reported as failures; this was unexpected. It could be a bug or something deeper with your environment or setup. Running the test in Eclipse gives a stacktrace that reveals that the NullPointer originates in java.lang.String.valueOf(Object) in the one and only line public static String valueOf(Object obj) { return (obj == null) ? "null" : obj.toString(); } The only chance that this can produce a NullPointerException is Object.toString() failing on the int array. My only idea is that the int[] returned from get_indices has been cleaned up in the meantime. So question 2. is simply for ideas on this |