Revision 47732 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPFeatureWriter.java

View differences:

SHPFeatureWriter.java
130 130
    }
131 131

  
132 132
    public void end() throws DataException {
133
        if (envelope == null) {
134
            try {
135
                envelope =
136
                    GEOM_MANAGER.createEnvelope(0, 0, 0, 0, SUBTYPES.GEOM2D);
137
            } catch (CreateEnvelopeException e) {
138
                LOGGER.error("Error creating the envelope", e);
133
        try {
134
            if (envelope == null) {
135
                try {
136
                    envelope
137
                        = GEOM_MANAGER.createEnvelope(0, 0, 0, 0, SUBTYPES.GEOM2D);
138
                } catch (CreateEnvelopeException e) {
139
                    LOGGER.error("Error creating the envelope", e);
140
                }
139 141
            }
142
            int shapeType = getShapeTypeAndSetSupportedGeometries(shpFeatureType);
143
            shpWrite.writeHeaders(envelope, shapeType, super.getRowCount(),
144
                shpWrite.size());
145
            super.end();
146
            shpWrite.close();
147
        } catch (IOException e) {
148
            throw new RuntimeException("Can't write SHP file.", e);
140 149
        }
141
        int shapeType = getShapeTypeAndSetSupportedGeometries(shpFeatureType);
142
        shpWrite.writeHeaders(envelope, shapeType, super.getRowCount(),
143
            fileSize);
144
        super.end();
145
        shpWrite.close();
146 150
    }
147 151

  
148 152
    public void append(Feature feature) throws DataException {

Also available in: Unified diff