tag on command line doesn't work (2.0.1)

seems that
protected Set commandParams = new HashSet();
needs to be a LinkedHashSet instead

Currently it fails with
Liquibase Update Failed: Unknown Reason
SEVERE 3/13/11 11:23 AM:liquibase: Unknown Reason
java.util.NoSuchElementException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:796)
        at java.util.HashMap$KeyIterator.next(HashMap.java:828)
        at liquibase.integration.commandline.Main.doMigration(Main.java:643)
        at liquibase.integration.commandline.Main.main(Main.java:116)

Why would LinkedHashSet help?  It looks like it is not seeing any elements commandParams, which looks like you aren’t passing a parameter to the tag command.  It takes the tag name, like liquibase tag v1


Nathan

I don’t see the code right now, but as far as I remember the code does this:
if currentPartOfCmdLine == “tag”
then
  tagName = nextChunkOfCmdLine (like iterator.next, or smth)
fi

but in case of a HashSet the order of arguments is not preserved, so iterator.next will not return you the name of the tag, it will return smth completely random instead. To preserve the order you need to use LinkedHashSet

Makes sense, I made the change. The order of the attributes generally doesn’t matter, but it does in the case of getting the tag name since it is the attribute right after command.


Nathan