ECC-616: BUFR operator 203YYY: better error handling/messages

This commit is contained in:
Shahram Najm 2018-04-12 12:45:56 +01:00
parent fe4b23e135
commit 52c739c7ee
1 changed files with 16 additions and 2 deletions

View File

@ -1149,8 +1149,10 @@ static int encode_new_element(grib_context* c,grib_accessor_bufr_data_array* sel
return GRIB_ENCODING_ERROR;
}
if ( self->refValIndex >= self->refValListSize ) {
grib_context_log(c, GRIB_LOG_ERROR,"encode_new_element: Overridden Reference Values error: index=%ld, size=%ld",
self->refValIndex, self->refValListSize);
grib_context_log(c, GRIB_LOG_ERROR,"encode_new_element: Overridden Reference Values: index=%ld, size=%ld. "
"\nThe number of overridden reference values must be equal to "
"number of descriptors between operator 203YYY and 203255",
self->refValIndex, self->refValListSize);
return GRIB_ENCODING_ERROR;
}
currRefVal = self->refValList[self->refValIndex];
@ -2642,6 +2644,16 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start
err = tableB_override_set_key(h, self);
if (err) return err;
}
if (flag != PROCESS_DECODE) {
/* Encoding operator 203YYY */
if (self->refValIndex != self->refValListSize) {
grib_context_log(c, GRIB_LOG_ERROR,
"process_elements: The number of overridden reference values (%ld) different from"
" number of descriptors between operator 203YYY and 203255 (%ld)",
self->refValListSize, self->refValIndex);
return GRIB_ENCODING_ERROR;
}
}
} else if (descriptors[i]->Y == 0) {
grib_context_log(c, GRIB_LOG_DEBUG,"Operator 203YYY: Y=0, clearing override of table B");
tableB_override_clear(c, self);
@ -2862,6 +2874,8 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start
}
}
/*if (c->debug) grib_vdarray_print("process_elements: self->numericValues", self->numericValues);*/
if(decoding) {
err=create_keys(a,0,0,0);
self->bitsToEndData=totalSize;