Ignore:
Timestamp:
2005-05-04T14:52:53+12:00 (19 years ago)
Author:
kjdon
Message:

for runQuery, now clear the old query result before we do anything else. also, removed the asserts that qd (query data) is not null - instead test for null and return.

Location:
branches/ant-install-branch
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ant-install-branch/gsdl3/packages/mg/jni/MGWrapperImpl.c

    r8920 r9803  
    315315
    316316  /* Check that the index was loaded successfully */
    317   assert(qd != NULL);
     317  if (qd==NULL) {
     318    return NULL;
     319  }
     320  /*assert(qd != NULL);*/
    318321
    319322  /* Get the document position and length in the text file */
     
    372375  jthrowable exc;
    373376
    374   /* Make sure an index has been specified */
    375   index_path = data->queryInfo->index;
    376   assert(index_path != NULL);
    377 
    378   /* Obtain C versions of the two string parameters */
    379   base_dir = (*j_env)->GetStringUTFChars(j_env, j_base_dir, NULL);
    380   if (base_dir == NULL) {
    381     return;
    382   }
    383   text_path = (*j_env)->GetStringUTFChars(j_env, j_text_path, NULL);
    384   if (text_path == NULL) {
    385     (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
    386     return;
    387   }
    388 
    389   /* Load the appropriate index for satisfying this request */
    390   qd = loadIndexData((char*) base_dir, (char*) index_path, (char*) text_path);
    391 
    392   /* The C text strings are no longer needed */
    393   (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
    394   (*j_env)->ReleaseStringUTFChars(j_env, j_text_path, text_path);
    395 
    396   /* Check that the index was loaded successfully */
    397   assert(qd != NULL);
    398 
    399   /* Remove anything hanging around from last time */
    400   FreeQueryDocs(qd);
    401 
     377  /* First of all, clear the previous result */
    402378  /* The result to write to */
    403379  result_ptr = (*j_env)->GetObjectField(j_env, j_obj, FID_query_result);
     
    411387    return;
    412388  }
     389
     390  /* Make sure an index has been specified */
     391  index_path = data->queryInfo->index;
     392  assert(index_path != NULL);
     393
     394  /* Obtain C versions of the two string parameters */
     395  base_dir = (*j_env)->GetStringUTFChars(j_env, j_base_dir, NULL);
     396  if (base_dir == NULL) {
     397    return;
     398  }
     399  text_path = (*j_env)->GetStringUTFChars(j_env, j_text_path, NULL);
     400  if (text_path == NULL) {
     401    (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
     402    return;
     403  }
     404
     405  /* Load the appropriate index for satisfying this request */
     406  qd = loadIndexData((char*) base_dir, (char*) index_path, (char*) text_path);
     407
     408  /* The C text strings are no longer needed */
     409  (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
     410  (*j_env)->ReleaseStringUTFChars(j_env, j_text_path, text_path);
     411
     412  /* Check that the index was loaded successfully */
     413  if (qd == NULL) {
     414    return;
     415  }
     416  /*assert(qd != NULL);*/
     417
     418  /* Remove anything hanging around from last time */
     419  FreeQueryDocs(qd);
    413420
    414421  /* Obtain a C version of the query string */
  • branches/ant-install-branch/gsdl3/src/packages/mg/jni/MGWrapperImpl.c

    r8920 r9803  
    315315
    316316  /* Check that the index was loaded successfully */
    317   assert(qd != NULL);
     317  if (qd==NULL) {
     318    return NULL;
     319  }
     320  /*assert(qd != NULL);*/
    318321
    319322  /* Get the document position and length in the text file */
     
    372375  jthrowable exc;
    373376
    374   /* Make sure an index has been specified */
    375   index_path = data->queryInfo->index;
    376   assert(index_path != NULL);
    377 
    378   /* Obtain C versions of the two string parameters */
    379   base_dir = (*j_env)->GetStringUTFChars(j_env, j_base_dir, NULL);
    380   if (base_dir == NULL) {
    381     return;
    382   }
    383   text_path = (*j_env)->GetStringUTFChars(j_env, j_text_path, NULL);
    384   if (text_path == NULL) {
    385     (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
    386     return;
    387   }
    388 
    389   /* Load the appropriate index for satisfying this request */
    390   qd = loadIndexData((char*) base_dir, (char*) index_path, (char*) text_path);
    391 
    392   /* The C text strings are no longer needed */
    393   (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
    394   (*j_env)->ReleaseStringUTFChars(j_env, j_text_path, text_path);
    395 
    396   /* Check that the index was loaded successfully */
    397   assert(qd != NULL);
    398 
    399   /* Remove anything hanging around from last time */
    400   FreeQueryDocs(qd);
    401 
     377  /* First of all, clear the previous result */
    402378  /* The result to write to */
    403379  result_ptr = (*j_env)->GetObjectField(j_env, j_obj, FID_query_result);
     
    411387    return;
    412388  }
     389
     390  /* Make sure an index has been specified */
     391  index_path = data->queryInfo->index;
     392  assert(index_path != NULL);
     393
     394  /* Obtain C versions of the two string parameters */
     395  base_dir = (*j_env)->GetStringUTFChars(j_env, j_base_dir, NULL);
     396  if (base_dir == NULL) {
     397    return;
     398  }
     399  text_path = (*j_env)->GetStringUTFChars(j_env, j_text_path, NULL);
     400  if (text_path == NULL) {
     401    (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
     402    return;
     403  }
     404
     405  /* Load the appropriate index for satisfying this request */
     406  qd = loadIndexData((char*) base_dir, (char*) index_path, (char*) text_path);
     407
     408  /* The C text strings are no longer needed */
     409  (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
     410  (*j_env)->ReleaseStringUTFChars(j_env, j_text_path, text_path);
     411
     412  /* Check that the index was loaded successfully */
     413  if (qd == NULL) {
     414    return;
     415  }
     416  /*assert(qd != NULL);*/
     417
     418  /* Remove anything hanging around from last time */
     419  FreeQueryDocs(qd);
    413420
    414421  /* Obtain a C version of the query string */
  • branches/ant-install-branch/indexers/mg/jni/MGWrapperImpl.c

    r8920 r9803  
    315315
    316316  /* Check that the index was loaded successfully */
    317   assert(qd != NULL);
     317  if (qd==NULL) {
     318    return NULL;
     319  }
     320  /*assert(qd != NULL);*/
    318321
    319322  /* Get the document position and length in the text file */
     
    372375  jthrowable exc;
    373376
    374   /* Make sure an index has been specified */
    375   index_path = data->queryInfo->index;
    376   assert(index_path != NULL);
    377 
    378   /* Obtain C versions of the two string parameters */
    379   base_dir = (*j_env)->GetStringUTFChars(j_env, j_base_dir, NULL);
    380   if (base_dir == NULL) {
    381     return;
    382   }
    383   text_path = (*j_env)->GetStringUTFChars(j_env, j_text_path, NULL);
    384   if (text_path == NULL) {
    385     (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
    386     return;
    387   }
    388 
    389   /* Load the appropriate index for satisfying this request */
    390   qd = loadIndexData((char*) base_dir, (char*) index_path, (char*) text_path);
    391 
    392   /* The C text strings are no longer needed */
    393   (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
    394   (*j_env)->ReleaseStringUTFChars(j_env, j_text_path, text_path);
    395 
    396   /* Check that the index was loaded successfully */
    397   assert(qd != NULL);
    398 
    399   /* Remove anything hanging around from last time */
    400   FreeQueryDocs(qd);
    401 
     377  /* First of all, clear the previous result */
    402378  /* The result to write to */
    403379  result_ptr = (*j_env)->GetObjectField(j_env, j_obj, FID_query_result);
     
    411387    return;
    412388  }
     389
     390  /* Make sure an index has been specified */
     391  index_path = data->queryInfo->index;
     392  assert(index_path != NULL);
     393
     394  /* Obtain C versions of the two string parameters */
     395  base_dir = (*j_env)->GetStringUTFChars(j_env, j_base_dir, NULL);
     396  if (base_dir == NULL) {
     397    return;
     398  }
     399  text_path = (*j_env)->GetStringUTFChars(j_env, j_text_path, NULL);
     400  if (text_path == NULL) {
     401    (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
     402    return;
     403  }
     404
     405  /* Load the appropriate index for satisfying this request */
     406  qd = loadIndexData((char*) base_dir, (char*) index_path, (char*) text_path);
     407
     408  /* The C text strings are no longer needed */
     409  (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir);
     410  (*j_env)->ReleaseStringUTFChars(j_env, j_text_path, text_path);
     411
     412  /* Check that the index was loaded successfully */
     413  if (qd == NULL) {
     414    return;
     415  }
     416  /*assert(qd != NULL);*/
     417
     418  /* Remove anything hanging around from last time */
     419  FreeQueryDocs(qd);
    413420
    414421  /* Obtain a C version of the query string */
Note: See TracChangeset for help on using the changeset viewer.