uDIG
  1. uDIG
  2. UDIG-1629

PostGIS next() called before hasNext()

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: UDIG 1.2.RC1
    • Fix Version/s: UDIG 1.2.RC3
    • Component/s: database
    • Labels:
      None

      Description

      From Luk on udig-users:

      I'm trying to load some postGIS data in udig. I'm able to create the new
      layers but nothing appears due to an rendering error. The error is:
      "Rendering: Exception(s) occourred during rendering: Must call hasNext
      before calling next".

      Jody tested and found the following:

      Well I have an "answer" but I was not very happy with it ... I was able to reproduce the error (and fix it). However the application only ran into this case when it was unable to unpack the "EPSG.zip" file into a temporary directory. So although I fixed the problem showed up in the stack trace it was not really where the problem occured....

      So can you check your logs and see if there are any complaints about not being able to write to a temp directory and unpack "EPSG.zip"?
      If you can check please send me the section of the logfile; and hopefully I can learn something (or make a good bug report for GeoTools).

      After that, I ended up clearing out that directory myself, and after a restart the application was able to connect. Attached is a screen snap of the PostGIS instance described in walkthrough 1...

      So we got two issues here:
      1) The EPSG.zip did not get unpacked; and thus EPSG definitions were not available to PostGIS
      2) If the Layer and FeatureSource CoordianteReferenceSystems do not match...

      • The CRS is forced in there using ForceCoordinateSystemFeatureResults(featureSource.getFeatures(), layer.getCRS());
      • Which is in turn wrapped up in DataUtilities.source(collection)
      • which calls next() without hasNext() to sort out the FeatureType

        Activity

        Hide
        Harald Wellmann added a comment -
        Not sure if this is the same problem: I'm using the Edit tools to create a new line feature in a PostGIS layer. When double-clicking the last vertex to finish the line feature, I get the following exception.

        ENTRY net.refractions.udig.tools.edit 1 0 2010-03-31 11:34:09.733
        !MESSAGE
        !STACK 0
        java.lang.IllegalStateException: Must call hasNext before calling next
        at org.geotools.jdbc.JDBCFeatureReader.ensureNext(JDBCFeatureReader.java:238)
        at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:252)
        at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:82)
        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:101)
        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.UndoableComposite.execute(UndoableComposite.java:78)
        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:55)
        Show
        Harald Wellmann added a comment - Not sure if this is the same problem: I'm using the Edit tools to create a new line feature in a PostGIS layer. When double-clicking the last vertex to finish the line feature, I get the following exception. ENTRY net.refractions.udig.tools.edit 1 0 2010-03-31 11:34:09.733 !MESSAGE !STACK 0 java.lang.IllegalStateException: Must call hasNext before calling next at org.geotools.jdbc.JDBCFeatureReader.ensureNext(JDBCFeatureReader.java:238) at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:252) at org.geotools.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:82) 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:101) 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.UndoableComposite.execute(UndoableComposite.java:78) 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:55)
        Hide
        Jody Garnett added a comment -
        Thanks Harald, the bug you refer to was later reported and fixed earlier today. This specific bug about "hasNext" is from the EPSG database not starting up; something that is fixed for RC3.
        Show
        Jody Garnett added a comment - Thanks Harald, the bug you refer to was later reported and fixed earlier today. This specific bug about "hasNext" is from the EPSG database not starting up; something that is fixed for RC3.

          People

          • Assignee:
            Jody Garnett
            Reporter:
            Jody Garnett
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: