Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#15378 closed (fixed)

geodjango layermapping save method missed an except

Reported by: Lucio Asnaghi Owned by: jbronn
Component: GIS Version: 1.2
Severity: Keywords: layermapping OGR_F_GetGeometryRef
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

If you use layermapping and you get an OGR error in _save method, then it is impossible to continue due to a missed except (thus the strict parameter is useless then):

django.contrib.gis.gdal.error.OGRException: Invalid geometry pointer returned from "OGR_F_GetGeometryRef".

Attachments (3)

layermapping.patch (736 bytes ) - added by Lucio Asnaghi 13 years ago.
add one more except to catch OGR exceptions in layermapping
15378.1.diff (3.2 KB ) - added by jbronn 13 years ago.
Test case and data that reproduces the problem.
15378.2.diff (4.0 KB ) - added by jbronn 13 years ago.
Now catch OGRException and raise LayerMapError in right place.

Download all attachments as: .zip

Change History (11)

by Lucio Asnaghi, 13 years ago

Attachment: layermapping.patch added

add one more except to catch OGR exceptions in layermapping

comment:1 by Lucio Asnaghi, 13 years ago

milestone: 1.3

comment:2 by Russell Keith-Magee, 13 years ago

Triage Stage: UnreviewedAccepted

comment:3 by jbronn, 13 years ago

Owner: changed from nobody to jbronn
Status: newassigned

I've confirmed this exists with an invalid shapefile.

by jbronn, 13 years ago

Attachment: 15378.1.diff added

Test case and data that reproduces the problem.

comment:4 by jbronn, 13 years ago

Patch needs improvement: set

I'm -1 on the implementation layermapping.patch, as I think the exception should be caught in the methods where it is raised (e.g., in methods that LayerMapping.feature_kwargs() calls), and then caught as a LayerMapError in LayerMapping.save().

However, my patch has implemented tests and includes a shapefile which recreates the issue.

by jbronn, 13 years ago

Attachment: 15378.2.diff added

Now catch OGRException and raise LayerMapError in right place.

comment:5 by jbronn, 13 years ago

Resolution: fixed
Status: assignedclosed

In [15813]:

Fixed #15378 -- Now properly handle OGR layers that have features with invalid geometries. Thanks, kunitoki for bug report and initial patch.

comment:6 by jbronn, 13 years ago

In [15814]:

[1.2.X] Fixed #15378 -- Now properly handle OGR layers that have features with invalid geometries. Thanks, kunitoki for bug report and initial patch.

Backport of r15813 from trunk.

comment:7 by jbronn, 13 years ago

In [15815]:

[1.2.X] Previous changeset did not include new test data, stupid hgsubversion. Refs #15378.

comment:8 by Jacob, 12 years ago

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top