52North / IlwisCore

Integrated Land and Water Information System (ILWIS) is a remote sensing and GIS software. ILWIS Core is the functional center of ilwis4..
http://52north.org/communities/ilwis/
35 stars 13 forks source link

connectTo(..) should return status report _outcontainerconnector #18

Closed pokulo closed 10 years ago

pokulo commented 10 years ago

if a call of a connectTo(..) fails (e.g. bacause of wrong parameters), an ERROR is emmited, but no return value (void) reports that to the programmer. So I cannot check wether calling store() should be called.

The lack of a status reporting return value was not the first initial error causing this bugreport. A rather general issue occurs on the current behaviour of the containerconnector() method, which returns the _inputcontainerconnector if there is no _outcontainerconnector without even reporting to log. This may cause overwriting input data with manipulated without notice of the user and thus shouldn't be possible. Instead rather report an error and handle return NULL;

My store() call caused the gdalConnector to crash (SIGSEGV) on a call like this:

line125

QFileInfo fileinfo = containerConnector(IlwisObject::cmOUTPUT)->toLocalFile(_filename);

Because the raster I wanted to store was created by rastercalculation and this way had not even an _incontainerconnector.

ridoo commented 10 years ago

As far as I understood returning the _inputcontainerconnector is intended behaviour, as a connector should be able to implement both reading and writing. This is documented somewhere, but in this case naming leads to wrong interpretation quickly which I think should be tackled.

However, if the connector decides to overwrite data a log statement wouldn't help a lot by letting the user know that data has been overwritten.

I suggest that if there is a R/W connector, the object/pointer should be set to _inputcontainerconnector and _outputcontainerconnector. Would this solve the problem?

MartinSchouwenburg commented 10 years ago

ConnectTo now has a boolean return value.