Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

AbstractMethodError?

  Asked By: Bastet    Date: Nov 19    Category: Java    Views: 610
  

I don't know if this is the appropriate list to post this to, if not please
forgive me, but I am
stumped and I need some help.

I am working on a Java application. Part of the work that I have to do involves
interfacing with
a C api. One of the functions that I need to create will accept a Vector as an
argument, call the
backend code to get a list of objects, and then for each element in the list add
a new object to
the vector. The code I have is as follows: (yes, I know that goto's are
generally considered
bad... I used them anyhow... :-( )

JNIEXPORT void JNICALL Java_volume_VolumeSetList_getSetObjs(JNIEnv* env, jclass
cls,
jobject sets)
{
set_list_t* list;
set_list_t* ptr;
jclass vol_set;
jclass vector;
jmethodID vol_set_const;
jmethodID vector_add;

list = get_set_list();

vol_set = (*env)->FindClass(env, "volume/VolumeSet");
if((*env)->ExceptionOccurred(env)) {
goto clean_up;
}

vector = (*env)->GetObjectClass(env, sets);
if((*env)->ExceptionOccurred(env)) {
goto clean_up;
}

vol_set_const = (*env)->GetMethodID(env, vol_set, "<init>",
"(Ljava/lang/String;)V");
if((*env)->ExceptionOccurred(env)) {
goto clean_up;
}

vector_add = (*env)->GetMethodID(env, vector, "addElement",
"(Ljava/lang/Object;)V");
if((*env)->ExceptionOccurred(env)) {
goto clean_up;
}


for(ptr = list; ptr != NULL; ptr = ptr->next) {
jstring jstr;
jobject jobj;

jstr = (*env)->NewStringUTF(env, ptr->name);
if((*env)->ExceptionOccurred(env)) {
goto clean_up;
}

jobj = (*env)->NewObject(env, vol_set, vol_set_const, jstr);
if((*env)->ExceptionOccurred(env)) {
goto clean_up;
}

(*env)->CallVoidMethod(env, vector, vector_add, jobj);
if((*env)->ExceptionOccurred(env)) {
goto clean_up;
}
}

clean_up:
free_set_list(list);
}


If I leave out the call to CallVoidMethod() I don't get any errors (that I know
of - without
populating the vector I have no idea whether the VolumeSet objects are being
created properly or
not). Once I include the call I get an AbstractMethodError. I am running suns
jdk1.3.1_03 on
linux. I have unjared the source for Suns library and checked out their
implementation of
Vector.addElement() and it is not abstract... I have no idea what is wrong.
Anyone have any
suggestions?


Share: 

 

1 Answer Found

 
Answer #1    Answered By: Guilherme Silva     Answered On: Nov 19

You would think that gcc would have
caught my stupid error (passing the class object  to CallVoidMethod
rather than the jobject).

 
Didn't find what you were looking for? Find more on AbstractMethodError? Or get search suggestion and latest updates.

Related Topics:




 
 
 

Related Post