Navigation

    TripleA Logo

    TripleA Forum

    • Register
    • Login
    • Search
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags

    No Such Element Exception

    Map Making
    5
    14
    182
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      RogerCooper last edited by

      I am having a problem which is odd enough that I wanted to discuss before creating a GitHub issue. I am having problem with scenarios that I have extracted in order to edit. In 2 different scenarios I receive the NoSuchElementException and the following error in the debug console. The second error repeats multiple times.The map in one scenario has some large rectangular blank errors and the other scenario only on small part of the map is drawn. Other extracted scenarios work fine.

      java.util.NoSuchElementException
      at com.google.common.collect.AbstractIndexedListIterator.next(AbstractIndexedListIterator.java:75)
      at games.strategy.triplea.ui.mapdata.DefaultColors.nextColor(DefaultColors.java:30)
      at games.strategy.triplea.ui.mapdata.MapData.getPlayerColor(MapData.java:496)
      at games.strategy.triplea.ui.screen.SmallMapImageManager.update(SmallMapImageManager.java:48)
      at games.strategy.triplea.ui.panels.map.MapPanel.initSmallMap(MapPanel.java:854)
      at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
      at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
      at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
      at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
      at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
      at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
      at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
      at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
      at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
      at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

      May 03, 2020 4:16:49 PM org.triplea.game.client.HeadedGameRunner lambda$initializeClientSettingAndLogging$0
      SEVERE: null
      java.util.NoSuchElementException
      at com.google.common.collect.AbstractIndexedListIterator.next(AbstractIndexedListIterator.java:75)
      at games.strategy.triplea.ui.mapdata.DefaultColors.nextColor(DefaultColors.java:30)
      at games.strategy.triplea.ui.mapdata.MapData.getPlayerColor(MapData.java:496)
      at games.strategy.triplea.ui.screen.drawable.BattleDrawable.draw(BattleDrawable.java:70)
      at games.strategy.triplea.ui.screen.Tile.draw(Tile.java:70)
      at games.strategy.triplea.ui.screen.Tile.drawImage(Tile.java:55)
      at games.strategy.triplea.ui.panels.map.MapPanel.lambda$paint$7(MapPanel.java:749)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at java.base/java.lang.Thread.run(Thread.java:834)

      redrum 1 Reply Last reply Reply Quote 0
      • redrum
        redrum Admin @RogerCooper last edited by redrum

        @RogerCooper It appears you have a map that is relying on default player colors where you have more than 8 players and there are only 8 defaults defined in TripleA. If you edit the map to define player colors for all players or all but 8 or less, it should work.

        R RoiEX 2 Replies Last reply Reply Quote 0
        • R
          RogerCooper @redrum last edited by

          @redrum Here is the map.properties file. Is there somewhere else I need to define the colors?

          #Color settings for the map, values must be in 6 digit hex form
          color.Uthgardian_Empire=ffff80
          color.Pirates_Of_Razor_Pass=808081
          color.Dragonfire_Coast_Federation=ff0001
          color.Gandar_Republic=004080
          color.Burusian_Empire=808001
          color.League_Of_Kahnbrek=008001

          units.scale=1.00
          map.showCapitolMarkers=false
          map.width=3500
          map.height= 2000
          map.scrollWrapX=false

          should we draw territory names

          map.showTerritoryNames=true
          map.showSeaZoneNames=true

          redrum 1 Reply Last reply Reply Quote 0
          • redrum
            redrum Admin @RogerCooper last edited by

            @RogerCooper That looks fine. Either it isn't reading your properties file or you have lots of other players with their colors defined. If you send me the map, I can take a look.

            R 1 Reply Last reply Reply Quote 0
            • R
              RogerCooper @redrum last edited by

              @redrum 6Kingdoms.zip
              Note that there are no other players at all.

              Hepps 1 Reply Last reply Reply Quote 0
              • Hepps
                Hepps Moderators @RogerCooper last edited by

                @RogerCooper Do the other errors that repeat equal all the players listed in the properties file?

                R 1 Reply Last reply Reply Quote 0
                • R
                  RogerCooper @Hepps last edited by

                  @Hepps The error repeats many times, far more than 6.

                  I was able to fix the problem with the other scenario (I was missing a player in map.properties).

                  Note that small portion of the map is displayed with colors.

                  6_Kingdoms.png

                  redrum 1 Reply Last reply Reply Quote 0
                  • redrum
                    redrum Admin @RogerCooper last edited by

                    @RogerCooper It loads fine for me. Can you double check that you don't have multiple versions of it in your maps folder?

                    R 1 Reply Last reply Reply Quote 0
                    • R
                      RogerCooper @redrum last edited by

                      @redrum Only 1 version. It does not work for me when zipped either.

                      redrum 1 Reply Last reply Reply Quote 0
                      • redrum
                        redrum Admin @RogerCooper last edited by redrum

                        @RogerCooper Hmm. And you are using 1.9.0.0.13066 or a pre-release version? I just tested with 1.9.0.0.13066 with the zipped map and see this:
                        14440d0c-2fb8-418a-aadd-eb65877867f0-image.png

                        R 1 Reply Last reply Reply Quote 0
                        • R
                          RogerCooper @redrum last edited by

                          @redrum I am using the prerelease (19049)

                          1 Reply Last reply Reply Quote 0
                          • RoiEX
                            RoiEX Admin @redrum last edited by

                            @redrum Nice to hear that the stacktraced seems to be cause by such a "simple" problem, but I found the stacktrace super confusing nevertheless.
                            Would it be easy to add some sort of pre-condition so we would fail to parse a map when the engine noticed there aren't enough default colors? I think a simpler error message would be desirable here.

                            1 Reply Last reply Reply Quote 0
                            • D
                              danelyoung last edited by

                              The NoSuchElementException in Java is thrown when one tries to access an iterable beyond its maximum limit. This means that, this exception is thrown by various accessor methods to indicate that the element being requested does not exist . The next() method in Java returns the next element in the iteration or NoSuchElementException if the iteration has no more elements.

                              As with most programming languages, the Iterator class includes a hasNext() method that returns a boolean indicating if the iteration has anymore elements. If hasNext() returns true, then the next() method will return the next element in the iteration otherwise raise exceptions if the iteration has no more elements.

                              if(input.hasNextInt() )
                                   number1 = input.nextInt(); // if there is another number  
                              else 
                                   number1 = 0; // nothing added in the input
                              
                              R 1 Reply Last reply Reply Quote 0
                              • R
                                RogerCooper @danelyoung last edited by

                                @danelyoung The scenario is still not working in pre-release, but works in the stable version.

                                1 Reply Last reply Reply Quote 0
                                • 1 / 1
                                • First post
                                  Last post
                                Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums