public void goToLocation(final String location) { GwtCommand command = new GwtCommand(GetLocationForStringRequest.COMMAND); GetLocationForStringRequest request = new GetLocationForStringRequest(); request.setCrs(map.getMapModel().getCrs()); request.setLocation(location); request.setServicePattern(servicePattern); if (GWT.isClient()) { // causes NPE when run as junit test String locale = LocaleInfo.getCurrentLocale().getLocaleName(); if (!"default".equals(locale)) { request.setLocale(locale); } } command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<GetLocationForStringResponse>() { public void execute(GetLocationForStringResponse response) { goToLocation(response, location); } }); }