groovy

Problem With Stacked Cases In Switch Statements

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1-beta-1
  • Fix Version/s: 1.1-beta-2
  • Component/s: None
  • Labels:
    None
  • Environment:
    groovy console 1.1 beta
  • Testcase included:
    yes
  • Number of attachments :
    0

Description

MARC PALMER REPORTS:
--------------------------------------
Hi,

I found this funny behaviour yesterday, want to confirm it is incorrect behaviour before JIRA'ing.

Exhibit A, run in groovy console 1.1 beta:

def getServerURL(env) { 
        def serverURL 
        switch (env) { 
                case "remoteTestAnyware" : 
                        serverURL = "http://mail.anyware.co.uk:999" 
                        break; 
                case "testSeb" : 
                        serverURL = "http://192.168.1.64:8080" 
                        break; 
                case "testEnotions" : 
                default: 
                        serverURL = "http://localhost:8080" 
                        break; 
        } 
        return serverURL 
} 

assert getServerURL('remoteTestAnyware') == "http://mail.anyware.co.uk:999"
assert getServerURL('development') == "http://localhost:8080"

Activity

Hide
Paul King added a comment -

Should be fixed in HEAD

Show
Paul King added a comment - Should be fixed in HEAD
Hide
Paul King added a comment -

No further feedback, assuming fixed

Show
Paul King added a comment - No further feedback, assuming fixed

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: