uDIG
  1. uDIG
  2. UDIG-1712

The create tool is adding twice the created feature

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: UDIG 1.2.2
    • Fix Version/s: UDIG 1.2.0
    • Component/s: tools and editing
    • Labels:
      None
    • Environment:
      Linux, Postgis, uDig Snapshot 1.2.0.20100728

      Description

      The create tool is adding twice the created feature. This bug occurs if you use a PostGIS layer.
      Test scenario:
      1 -Load Multipolygon from postgis
      2- Select Create Tool.
      3- Draw the geometry.
      4- confirm: enter and commit

      The table view presents two new features in the same area.

        Issue Links

          Activity

          Hide
          Lukasz Stawicki added a comment -
          I confirm that create tool tries to add feature twice also for Oracle layer. First try is succesfull and feature is added OK, the second insert is lacking attributes - an 'empty' feature is inserted. I have spotted it after having been reported 'SQL missing foreign key' exceptions.
          Show
          Lukasz Stawicki added a comment - I confirm that create tool tries to add feature twice also for Oracle layer. First try is succesfull and feature is added OK, the second insert is lacking attributes - an 'empty' feature is inserted. I have spotted it after having been reported 'SQL missing foreign key' exceptions.
          Hide
          Mauricio Pazos added a comment -
          I have tested with wfs1.0.0 and Postgis as data store. I get similar result.
          This is the content of log file


          !ENTRY net.refractions.udig.tools.edit 1 0 2010-08-06 16:34:16.940
          !MESSAGE
          !STACK 0
          java.lang.IllegalStateException: Must call hasNext before calling next
          at org.geotools.jdbc.JDBCFeatureReader.ensureNext(JDBCFeatureReader.java:240)
          at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:254)
          at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:84)
          at org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.next(ContentFeatureCollection.java:197)
          at org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.next(ContentFeatureCollection.java:177)
          at net.refractions.udig.project.internal.commands.edit.AddFeatureCommand.getNewFeature(AddFeatureCommand.java:104)
          at net.refractions.udig.tools.edit.commands.CreateAndSelectNewFeature.run(CreateAndSelectNewFeature.java:92)
          at net.refractions.udig.project.command.UndoableComposite.execute(UndoableComposite.java:81)
          at net.refractions.udig.tools.edit.BehaviourCommand.execute(BehaviourCommand.java:65)
          at net.refractions.udig.project.command.CommandManager$Executor.execute(CommandManager.java:394)
          at net.refractions.udig.project.command.CommandManager$Executor.run(CommandManager.java:325)
          at net.refractions.udig.project.command.CommandManager$Executor.run(CommandManager.java:311)
          at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

          !ENTRY net.refractions.udig.tools.edit 1 0 2010-08-06 16:34:19.144
          !MESSAGE
          !STACK 0
          java.lang.IllegalStateException: Must call hasNext before calling next
          at org.geotools.jdbc.JDBCFeatureReader.ensureNext(JDBCFeatureReader.java:240)
          at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:254)
          at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:84)
          at org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.next(ContentFeatureCollection.java:197)
          at org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.next(ContentFeatureCollection.java:177)
          at net.refractions.udig.project.internal.commands.edit.AddFeatureCommand.getNewFeature(AddFeatureCommand.java:104)
          at net.refractions.udig.tools.edit.commands.CreateAndSelectNewFeature.run(CreateAndSelectNewFeature.java:92)
          at net.refractions.udig.project.command.UndoableComposite.execute(UndoableComposite.java:81)
          at net.refractions.udig.tools.edit.BehaviourCommand.execute(BehaviourCommand.java:65)
          at net.refractions.udig.project.command.CommandManager$Executor.execute(CommandManager.java:394)
          at net.refractions.udig.project.command.CommandManager$Executor.run(CommandManager.java:325)
          at net.refractions.udig.project.command.CommandManager$Executor.run(CommandManager.java:311)
          at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
          Show
          Mauricio Pazos added a comment - I have tested with wfs1.0.0 and Postgis as data store. I get similar result. This is the content of log file !ENTRY net.refractions.udig.tools.edit 1 0 2010-08-06 16:34:16.940 !MESSAGE !STACK 0 java.lang.IllegalStateException: Must call hasNext before calling next at org.geotools.jdbc.JDBCFeatureReader.ensureNext(JDBCFeatureReader.java:240) at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:254) at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:84) at org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.next(ContentFeatureCollection.java:197) at org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.next(ContentFeatureCollection.java:177) at net.refractions.udig.project.internal.commands.edit.AddFeatureCommand.getNewFeature(AddFeatureCommand.java:104) at net.refractions.udig.tools.edit.commands.CreateAndSelectNewFeature.run(CreateAndSelectNewFeature.java:92) at net.refractions.udig.project.command.UndoableComposite.execute(UndoableComposite.java:81) at net.refractions.udig.tools.edit.BehaviourCommand.execute(BehaviourCommand.java:65) at net.refractions.udig.project.command.CommandManager$Executor.execute(CommandManager.java:394) at net.refractions.udig.project.command.CommandManager$Executor.run(CommandManager.java:325) at net.refractions.udig.project.command.CommandManager$Executor.run(CommandManager.java:311) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) !ENTRY net.refractions.udig.tools.edit 1 0 2010-08-06 16:34:19.144 !MESSAGE !STACK 0 java.lang.IllegalStateException: Must call hasNext before calling next at org.geotools.jdbc.JDBCFeatureReader.ensureNext(JDBCFeatureReader.java:240) at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:254) at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:84) at org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.next(ContentFeatureCollection.java:197) at org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.next(ContentFeatureCollection.java:177) at net.refractions.udig.project.internal.commands.edit.AddFeatureCommand.getNewFeature(AddFeatureCommand.java:104) at net.refractions.udig.tools.edit.commands.CreateAndSelectNewFeature.run(CreateAndSelectNewFeature.java:92) at net.refractions.udig.project.command.UndoableComposite.execute(UndoableComposite.java:81) at net.refractions.udig.tools.edit.BehaviourCommand.execute(BehaviourCommand.java:65) at net.refractions.udig.project.command.CommandManager$Executor.execute(CommandManager.java:394) at net.refractions.udig.project.command.CommandManager$Executor.run(CommandManager.java:325) at net.refractions.udig.project.command.CommandManager$Executor.run(CommandManager.java:311) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
          Hide
          Jody Garnett added a comment -
          I am testing against geoserver shapefile logs to see it it is uDig issuing two requests. Adding a tasmania road results in the following:

          <Transaction xmlns:topp="http://www.openplans.org/topp" xmlns="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0" service="WFS" lockAction="ALL"><Insert><topp:tasmania_roads fid="newtopp:tasmania_roads.9223372036854775807"><topp:the_geom><gml:MultiLineString srsName="EPSG:4326"><gml:lineStringMember><gml:LineString><gml:coordinates decimal="." cs="," ts=" ">146.17758915278125,-42.23955331595147 146.21235106381766,-42.218393891842354 146.25315852459954,-42.191188917987766 146.27431794870864,-42.17456365618774</gml:coordinates>
          </gml:LineString>
          </gml:lineStringMember>
          </gml:MultiLineString>
          </topp:the_geom>
          <topp:TYPE></topp:TYPE>
          </topp:tasmania_roads>
          </Insert>
          </Transaction>

          Request: transaction
          handle = null
          service = WFS
          version = 1.0.0
          baseUrl = http://localhost:8080/geoserver/
          providedVersion = null
          lockId = null
          group = [wfs:insert=net.opengis.wfs.impl.InsertElementTypeImpl@e03802 (feature: [SimpleFeatureImpl:tasmania_roads=[SimpleFeatureImpl.Attribute: the_geom<the_geom id=newtopp:tasmania_roads.9223372036854775807>=MULTILINESTRING ((146.17758915278125 -42.23955331595147, 146.21235106381766 -42.218393891842354, 146.25315852459954 -42.191188917987766, 146.27431794870864 -42.17456365618774)), SimpleFeatureImpl.Attribute: TYPE<TYPE id=newtopp:tasmania_roads.9223372036854775807>=]], handle: null, idgen: <unset>, inputFormat: <unset>, srsName: null)]
          insert = [net.opengis.wfs.impl.InsertElementTypeImpl@e03802 (feature: [SimpleFeatureImpl:tasmania_roads=[SimpleFeatureImpl.Attribute: the_geom<the_geom id=newtopp:tasmania_roads.9223372036854775807>=MULTILINESTRING ((146.17758915278125 -42.23955331595147, 146.21235106381766 -42.218393891842354, 146.25315852459954 -42.191188917987766, 146.27431794870864 -42.17456365618774)), SimpleFeatureImpl.Attribute: TYPE<TYPE id=newtopp:tasmania_roads.9223372036854775807>=]], handle: null, idgen: <unset>, inputFormat: <unset>, srsName: null)]
          update = []
          delete = []
          native = []
          releaseAction = ALL

          So that looks like only one input request coming from uDig.
          Show
          Jody Garnett added a comment - I am testing against geoserver shapefile logs to see it it is uDig issuing two requests. Adding a tasmania road results in the following: <Transaction xmlns:topp=" http://www.openplans.org/topp " xmlns=" http://www.opengis.net/wfs " xmlns:gml=" http://www.opengis.net/gml " xmlns:ogc=" http://www.opengis.net/ogc " version="1.0.0" service="WFS" lockAction="ALL"><Insert><topp:tasmania_roads fid="newtopp:tasmania_roads.9223372036854775807"><topp:the_geom><gml:MultiLineString srsName="EPSG:4326"><gml:lineStringMember><gml:LineString><gml:coordinates decimal="." cs="," ts=" ">146.17758915278125,-42.23955331595147 146.21235106381766,-42.218393891842354 146.25315852459954,-42.191188917987766 146.27431794870864,-42.17456365618774</gml:coordinates> </gml:LineString> </gml:lineStringMember> </gml:MultiLineString> </topp:the_geom> <topp:TYPE></topp:TYPE> </topp:tasmania_roads> </Insert> </Transaction> Request: transaction handle = null service = WFS version = 1.0.0 baseUrl = http://localhost:8080/geoserver/ providedVersion = null lockId = null group = [wfs:insert=net.opengis.wfs.impl.InsertElementTypeImpl@e03802 (feature: [SimpleFeatureImpl:tasmania_roads=[SimpleFeatureImpl.Attribute: the_geom<the_geom id=newtopp:tasmania_roads.9223372036854775807>=MULTILINESTRING ((146.17758915278125 -42.23955331595147, 146.21235106381766 -42.218393891842354, 146.25315852459954 -42.191188917987766, 146.27431794870864 -42.17456365618774)), SimpleFeatureImpl.Attribute: TYPE<TYPE id=newtopp:tasmania_roads.9223372036854775807>=]], handle: null, idgen: <unset>, inputFormat: <unset>, srsName: null)] insert = [ net.opengis.wfs.impl.InsertElementTypeImpl@e03802 (feature: [SimpleFeatureImpl:tasmania_roads=[SimpleFeatureImpl.Attribute: the_geom<the_geom id=newtopp:tasmania_roads.9223372036854775807>=MULTILINESTRING ((146.17758915278125 -42.23955331595147, 146.21235106381766 -42.218393891842354, 146.25315852459954 -42.191188917987766, 146.27431794870864 -42.17456365618774)), SimpleFeatureImpl.Attribute: TYPE<TYPE id=newtopp:tasmania_roads.9223372036854775807>=]], handle: null, idgen: <unset>, inputFormat: <unset>, srsName: null)] update = [] delete = [] native = [] releaseAction = ALL So that looks like only one input request coming from uDig.
          Hide
          Jody Garnett added a comment - - edited
          So I did not have a normal postgis database set up to test against; but I did have an earlier experiment with one table that was writable.

          By putting a breakpoint in JDBCDataStore.insertSQL(PS) I could see it was infact called twice.
          - once when I added the feature using the create polygon tool
          - and again when I called commit

          I also put breakpoints in the CreateAndSelectNewFeature command in order to see what was going on; given my experimental database as often as not I ended up having trouble with feature id creation.
          Show
          Jody Garnett added a comment - - edited So I did not have a normal postgis database set up to test against; but I did have an earlier experiment with one table that was writable. By putting a breakpoint in JDBCDataStore.insertSQL(PS) I could see it was infact called twice. - once when I added the feature using the create polygon tool - and again when I called commit I also put breakpoints in the CreateAndSelectNewFeature command in order to see what was going on; given my experimental database as often as not I ended up having trouble with feature id creation.
          Hide
          Mauricio Pazos added a comment -
          Today, I have updated my udig trunk in order to debug this issue. I cannot reproduce this bug (udig+postgis and udig+wfs+postgis). It looks right in this revision
          Last Changed Rev: 31932.!!
          Show
          Mauricio Pazos added a comment - Today, I have updated my udig trunk in order to debug this issue. I cannot reproduce this bug (udig+postgis and udig+wfs+postgis). It looks right in this revision Last Changed Rev: 31932.!!
          Hide
          Mauricio Pazos added a comment -
          I have a look at the svn log.
          Modified:
             udig/trunk/plugins/net.refractions.udig.libs/.classpath
             udig/trunk/plugins/net.refractions.udig.libs/META-INF/MANIFEST.MF
             udig/trunk/plugins/net.refractions.udig.libs/build.properties
             udig/trunk/plugins/net.refractions.udig.libs/copy.properties
             udig/trunk/plugins/net.refractions.udig/about.mappings
          Log:
          Change over to GeoTools 2.6.5 for uDig 1.1.0 release

          Maybe, the bug was in geotools, thus the Revision: 31931 has solved the problem.
          I think we can colse this issue.???


          Show
          Mauricio Pazos added a comment - I have a look at the svn log. Modified:    udig/trunk/plugins/net.refractions.udig.libs/.classpath    udig/trunk/plugins/net.refractions.udig.libs/META-INF/MANIFEST.MF    udig/trunk/plugins/net.refractions.udig.libs/build.properties    udig/trunk/plugins/net.refractions.udig.libs/copy.properties    udig/trunk/plugins/net.refractions.udig/about.mappings Log: Change over to GeoTools 2.6.5 for uDig 1.1.0 release Maybe, the bug was in geotools, thus the Revision: 31931 has solved the problem. I think we can colse this issue.???

            People

            • Assignee:
              Unassigned
              Reporter:
              Mauricio Pazos
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: