[Gvsig_english] Error in PostGIS.getSqlModifyFeature

Francisco José Peñarrubia fjp at scolab.es
Fri Jan 23 09:37:06 CET 2009


You are right, Radim.

This code will solve the bug. Thank you very much.

Cheers.

Fran.

Radim Blazek escribió:
> In the mean time I found the bug in
> /extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/PostGIS.java
> getSqlModifyFeature:
>
> for (int i = 0; i < numAlphanumericFields; i++) {
>     ....
>     sqlBuf.append(" " + name + " = " + strAux + " ,");
>     ....
> }
> sqlBuf.deleteCharAt(sqlBuf.lastIndexOf(","));
>
> Obviously if there are no AlphanumericFields it fails (I had only id
> and geometry).
> I would prefere something like:
> for (int i = 0; i < numAlphanumericFields; i++) {
>     ....
>     if ( col_count > 0 ) sqlBuf.append(" ,");  // note the check for
> fldDesc != null, so 'i > 0' cannot be used
>     sqlBuf.append(" " + name + " = " + strAux);
>     ....
> }
>
> Radim
>
> On Thu, Jan 22, 2009 at 11:42 AM, Benjamin Ducke
> <benjamin.ducke at oxfordarch.co.uk> wrote:
>   
>> Hi Radim,
>>
>> Did you create that PostGIS layer in gvSIG or QGIS (or any other way?).
>> I vaguely remember some problems one of our gvSIG users had with PostGIS
>> layers created in QGIS. For some reason, QGIS seemed to handle PostGIS
>> layers created by gvSIG just fine, though.
>>
>> Ben
>>
>> Radim Blazek wrote:
>>     
>>> Hi all,
>>> whenever I try to save modified PostGIS layer I get this error:
>>>
>>> java.lang.StringIndexOutOfBoundsException: String index out of range:
>>> -1 java.lang.StringIndexOutOfBoundsException: String index out of
>>> range: -1
>>> java.lang.AbstractStringBuilder.deleteCharAt(Unknown Source)
>>> java.lang.StringBuffer.deleteCharAt(Unknown Source)
>>>
>>> com.iver.cit.gvsig.fmap.drivers.jdbc.postgis.PostGIS.getSqlModifyFeature(Unknown
>>> Source)
>>> com.iver.cit.gvsig.fmap.drivers.jdbc.postgis.PostGISWriter.process(Unknown
>>> Source) com.iver.cit.gvsig.fmap.edition.EditableAdapter.saveEdits(Unknown
>>> Source)
>>> com.iver.cit.gvsig.fmap.edition.EditableAdapter.stopEdition(Unknown
>>> Source)
>>>
>>> Can you help me?
>>> Radim
>>> _______________________________________________
>>> Gvsig_internacional mailing list
>>> Gvsig_internacional at runas.cap.gva.es
>>> http://runas.cap.gva.es/mailman/listinfo/gvsig_internacional
>>>
>>>
>>>       
>> --
>> Benjamin Ducke
>> Senior Applications Support and Development Officer
>>
>> Oxford Archaeology Ltd
>> Janus House
>> Osney Mead
>> OX2 0ES
>> Oxford, U.K.
>>
>> Tel: +44 (0)1865 263 800 (switchboard)
>> Tel: +44 (0)1865 980 758 (direct)
>> Fax :+44 (0)1865 793 496
>> benjamin.ducke at oxfordarch.co.uk
>>
>>
>>
>>
>> ------
>> Files attached to this email may be in ISO 26300 format (OASIS Open Document
>> Format). If you have difficulty opening them, please visit
>> http://iso26300.info for more information.
>>
>> _______________________________________________
>> Gvsig_internacional mailing list
>> Gvsig_internacional at runas.cap.gva.es
>> http://runas.cap.gva.es/mailman/listinfo/gvsig_internacional
>>
>>     
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at runas.cap.gva.es
> http://runas.cap.gva.es/mailman/listinfo/gvsig_internacional
>   



More information about the Gvsig_internacional mailing list