Revision 20367 trunk/libraries/libjni-gdal/src/main/java/org/gvsig/jogr/OGRFeatureDefn.java

View differences:

OGRFeatureDefn.java
67 67
	
68 68
	public String getName()throws OGRException{
69 69
		
70
		if(cPtr <= 0)
70
		if(cPtr == 0)
71 71
			throw new OGRException("Error en getName(). El constructor ha fallado.");
72 72
		    
73 73
		String name = getNameNat(cPtr);
......
85 85
	
86 86
	public String getGeomType()throws OGRException{
87 87
		
88
		if(cPtr <= 0)
88
		if(cPtr == 0)
89 89
			throw new OGRException("Error en getGeomType(). El constructor ha fallado.");
90 90
		    
91 91
		int tipo = getGeomTypeNat(cPtr);
......
138 138
	
139 139
	public OGRFieldDefn getFieldDefn(int i)throws OGRException{
140 140
		
141
		if(cPtr <= 0)
141
		if(cPtr == 0)
142 142
			throw new OGRException("Error en getFieldDefn(). El constructor ha fallado.");
143 143
		
144 144
		long id = getFieldDefnNat(cPtr,i);
145
		if(id<=0)
145
		if(id == 0)
146 146
			throw new OGRException("Error en getGeomType(). No se ha podido obtener un tipo de geometria valido.");
147 147
		 
148 148
		OGRFieldDefn field = new OGRFieldDefn(id);
......
153 153
	 * Destructor 
154 154
	 */
155 155
	
156
	protected void finalize(){
157
		if(cPtr > 0)
158
			FreeOGRFeatureDefnNat(cPtr);
156
	protected void finalize() throws OGRFailureException{
157
		if(cPtr == 0)
158
			throw new OGRFailureException("Fallo al acceder al dato.");
159
		
160
		FreeOGRFeatureDefnNat(cPtr);
159 161
	}
160 162
	
161 163
	/**
......
164 166
	
165 167
	public int getFieldIndex( String field )throws OGRException{
166 168
		
167
		if(cPtr <= 0)
169
		if(cPtr == 0)
168 170
			throw new OGRException("Error en getFieldIndex(). El constructor ha fallado.");
169 171
		
170
		if(field==null)
171
			throw new OGRException("Error en getFieldIndex(). Par?metro invalido.");	
172
		if(field == null)
173
			throw new OGRException("Error en getFieldIndex(). Par?metro invalido.");
174
		
172 175
		int index =  getFieldIndexNat(cPtr, field);
173 176
		
174
		if(index<0)
177
		if(index == 0)
175 178
			throw new OGRException("Error en getFieldIndex(). No se ha podido obtener un ?ndice valido.");
176 179
		return index;
177 180
		
......
183 186
	
184 187
	public void addFieldDefn( OGRFieldDefn fd )throws OGRException{
185 188
		
186
		if(cPtr <= 0)
189
		if(cPtr == 0)
187 190
			throw new OGRException("Error en addFieldDefn(). El constructor ha fallado.");
188 191
		
189
		if(fd==null || fd.getPtro() <= 0)
192
		if(fd == null || fd.getPtro() <= 0)
190 193
			throw new OGRException("Error en addFieldDefn(). La referencia del par?metro OGRFieldDefn no es valida.");
191 194
		
192 195
		addFieldDefnNat(cPtr, fd.getPtro());
......
199 202
		
200 203
	public void setGeomType( String gtype )throws OGRException{ //OGRwkbGeometryType OGRFeatureDefn
201 204
		
202
		if(cPtr <= 0)
205
		if(cPtr == 0)
203 206
			throw new OGRException("Error en setGeomType(). El constructor ha fallado.");
204 207
		
205 208
		boolean ok=false;
......
233 236
		
234 237
	public OGRFeatureDefn cloneFeatureDefn()throws OGRException{
235 238
		
236
		if(cPtr <= 0)
239
		if(cPtr == 0)
237 240
			throw new OGRException("Error en cloneFeatureDefn(). El constructor ha fallado.");
238 241
		
239 242
		long ptr_fd = cloneFeatureDefnNat(cPtr);
240
		if(ptr_fd<=0)
243
		
244
		if(ptr_fd == 0)
241 245
			throw new OGRException("Error en cloneFeatureDefn(). No se ha podido obtener un valor de referencia valido para OGRFeatureDefn.");
246
		
242 247
		return new OGRFeatureDefn(ptr_fd);
243 248
		
244 249
	}
......
287 292
		
288 293
		long ptr_fd = createFeatureDefnNat( pszName);
289 294
		
290
		if(ptr_fd<=0)
295
		if(ptr_fd == 0)
291 296
			throw new OGRException("Error en cloneFeatureDefn(). No se ha podido obtener un valor de referencia valido para OGRFeatureDefn.");
297
		
292 298
		return new OGRFeatureDefn(ptr_fd);
293 299
		
294 300
		
......
302 308
	
303 309
	public static void destroyFeatureDefn( OGRFeatureDefn fd )throws OGRException{
304 310
		
305
		if(fd == null || fd.getPtro()<=0)
311
		if(fd == null || fd.getPtro() == 0)
306 312
			throw new OGRException("Error en destroyFeatureDefn(). Par?metro invalido.");
307 313
		
308 314
		destroyFeatureDefnNat( fd.getPtro());

Also available in: Unified diff