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

View differences:

OGRFieldDefn.java
68 68
	public OGRFieldType getType()throws OGRException{
69 69
		
70 70
		OGRFieldType ftipo ;
71
		if(cPtr <= 0)
71
		if(cPtr == 0)
72 72
			throw new OGRException("Error en getType(). El constructor ha fallado.");
73 73
		
74 74
		int tipo = getTypeNat(cPtr);
75
		if(tipo>=0){
75
		if(tipo >= 0){
76 76
			ftipo = new OGRFieldType();
77 77
			ftipo.setType(tipo);
78 78
		}
......
88 88
	
89 89
	public String getNameRef()throws OGRException{
90 90
		
91
		if(cPtr <= 0)
91
		if(cPtr == 0)
92 92
			throw new OGRException("Error en getNameRef(). El constructor ha fallado.");
93 93
		
94 94
		String ref = getNameRefNat(cPtr);
95
		if(ref==null)
95
		if(ref == null)
96 96
			throw new OGRException("Error en getNameRef(). No se ha podido obtener un nombre de referencia valido.");
97
		
97 98
		else return ref;	
98 99
		
99 100
	}
......
104 105
	
105 106
	public String getFieldTypeName(OGRFieldType tipo)throws OGRException{
106 107
		
107
		if(cPtr <= 0)
108
		if(cPtr == 0)
108 109
			throw new OGRException("Error en getFieldTypeName(). El constructor ha fallado.");
109 110
		
110 111
		String ref = getFieldTypeNameNat(cPtr,tipo.getType());
111
		if(ref==null)
112
		
113
		if(ref == null)
112 114
			throw new OGRException("Error en getFieldTypeName(). No se ha podido obtener un nombre de tipo de campo valido.");
115
		
113 116
		else return ref;
114 117
	
115 118
	}
......
140 143
	 * Destructor 
141 144
	 */
142 145
	
143
	protected void finalize(){
144
		if(cPtr > 0)
145
			FreeOGRFieldDefnNat(cPtr);
146
	protected void finalize() throws OGRFailureException{
147
		if(cPtr == 0)
148
			throw new OGRFailureException("Fallo al acceder al dato.");
149
		
150
		FreeOGRFieldDefnNat(cPtr);
146 151
	}
147 152
	
148 153
	

Also available in: Unified diff