Uploaded image for project: 'Lucee Development'
  1. LDEV-1158

for/in loop on java.util.LinkedHashMap empty

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.31
    • Fix Version/s: 5.1.3.0
    • Labels:
      None
    • Environment:

      OSX, Java 1.8, Lucee 5.1.0.31

    • Sprint:
      March 2017 Sprint

      Description

      Any attempt to loop a linked hashmap using for/in will not throw an error but treats the map as empty. A workaround is to pull a structKeyArray and loop those keys, however this bug would is incompatible with previous versions of Lucee and ACF.

      See line 50 on this file for example usage and workaround:
      https://github.com/coldbox-modules/cbSwagger/blob/0677708f62dbb5ae0eb30fe702a78f223a323c31/modules/cbswagger/models/RoutesParser.cfc

      To duplicate:

      var hashMap = createObject( "java", "java.util.LinkedHashMap" );
      
      hashMap[ "foo" ] = "bar";
      
      for( var key in hashMap ){
      	writeOutput( hashMap[ key ] );
      	abort;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              michaeloffner Michael Offner
              Reporter:
              siloweb Jon Clausen
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: