Buggy code:
protected String getUrl ( String path ) { } protected void configureCloudFoundryRequestFactory ( RestTemplate restTemplate ) { } private class CloudFoundryClientHttpRequestFactory implements ClientHttpRequestFactory { private ClientHttpRequestFactory delegate ; private Integer defaultSocketTimeout = 0 ; public CloudFoundryClientHttpRequestFactory ( ClientHttpRequestFactory delegate ) { } @ Override public ClientHttpRequest createRequest ( URI uri , HttpMethod httpMethod ) throws IOException { } private void captureDefaultReadTimeout ( ) { } public void increaseReadTimeoutForStreamedTailedLogs ( int timeout ) { } } protected Map < String , String > doGetLogs ( String urlPath , String appName , String instance ) { } @ SuppressWarnings ( "unchecked" ) protected void doOpenFile ( String urlPath , Object app , int instanceIndex , String filePath , ClientHttpResponseCallback callback ) { } protected String doGetFile ( String urlPath , Object app , int instanceIndex , String filePath , int startPosition , int endPosition ) { } protected String doGetFile ( String urlPath , Object app , String instance , String filePath , int startPosition , int endPosition ) { } private String doGetFileByRange ( String urlPath , Object app , String instance , String filePath , int start , int end , String range ) { } @ SuppressWarnings ( "unchecked" ) @ Override public CloudInfo getInfo ( ) { } @ Override public void createSpace ( String spaceName ) { } @ Override public CloudSpace getSpace ( String spaceName ) { } @ Override public CloudSpace getSpace ( UUID guid ) { } @ Override public void deleteSpace ( String spaceName ) { } private UUID doCreateSpace ( String spaceName , UUID orgGuid ) { } private UUID getSpaceGuid ( String spaceName , UUID orgGuid ) { } private UUID getSpaceGuid ( String orgName , String spaceName ) { } private void doDeleteSpace ( UUID spaceGuid ) { } @ Override public List < CloudSpace > getSpaces ( ) { } @ Override public List < UUID > getSpaceManagers ( String orgName , String spaceName ) { } @ Override public List < UUID > getSpaceDevelopers ( String orgName , String spaceName ) { } @ Override public List < UUID > getSpaceAuditors ( String orgName , String spaceName ) { } private List < UUID > getSpaceUserGuids ( String orgName , String spaceName , String urlPath ) { } @ Override public void associateManagerWithSpace ( String orgName , String spaceName ) { } @ Override public void associateDeveloperWithSpace ( String orgName , String spaceName ) { } @ Override public void associateAuditorWithSpace ( String orgName , String spaceName ) { } private void associateRoleWithSpace ( String orgName , String spaceName , String urlPath ) { } private String getCurrentUserId ( ) { } @ Override public List < CloudOrganization > getOrganizations ( ) { } @ Override public OAuth2AccessToken login ( ) { } @ Override public void logout ( ) { } @ Override public void register ( String email , String password ) { } @ Override public void updatePassword ( CloudCredentials credentials , String newPassword ) { } @ Override public void unregister ( ) { } @ Override public List < CloudService > getServices ( ) { } @ Override public List < CloudService > getServices ( CloudSpace space ) { } @ Override public void createService ( CloudService service ) { } private CloudServicePlan findPlanForService ( CloudService service ) { } @ Override public void createUserProvidedService ( CloudService service , Map < String , Object > credentials ) { } @ Override public void createUserProvidedService ( CloudService service , Map < String , Object > credentials , String syslogDrainUrl ) { } private void createUserProvidedServiceDelegate ( CloudService service , Map < String , Object > credentials , String syslogDrainUrl ) { } @ Override public CloudService getService ( String serviceName ) { } @ Override public CloudService getService ( UUID serviceId ) { } @ Override public CloudService getService ( CloudSpace space , String serviceName ) { } @ Override public CloudServiceInstance getServiceInstance ( String serviceName ) { } @ Override public CloudServiceInstance getServiceInstance ( CloudSpace space , String serviceName ) { <START_BUG> Map < String , Object > resource = doGetServiceInstance ( sessionSpace , serviceName , 1 ) ; <END_BUG> if ( resource == null ) { return null ; } return resourceMapper . mapResource ( resource , CloudServiceInstance . class ) ; } private Map < String , Object > doGetServiceInstance ( UUID serviceId , int inlineDepth ) { } private Map < String , Object > doGetServiceInstance ( CloudSpace space , String serviceName , int inlineDepth ) { } @ Override public List < CloudServiceInstance > getServiceInstances ( CloudSpace space ) { } @ Override public CloudServiceInstance getServiceInstance ( UUID serviceId ) { } @ Override public void deleteService ( String serviceName ) { } @ Override public void deleteAllServices ( ) { } @ Override public List < CloudServiceOffering > getServiceOfferings ( ) { } @ Override public List < CloudServiceBroker > getServiceBrokers ( ) { } @ Override public CloudServiceBroker getServiceBroker ( String name ) { } @ Override public void createServiceBroker ( CloudServiceBroker serviceBroker ) { } @ Override public void updateServiceBroker ( CloudServiceBroker serviceBroker ) { } @ Override public void deleteServiceBroker ( String name ) { } @ Override public void updateServicePlanVisibilityForBroker ( String name , boolean visibility ) { } @ Override public List < CloudApplication > getApplications ( ) { } @ Override public List < CloudApplication > getApplications ( CloudSpace space ) { } @ Override public CloudApplication getApplication ( String appName ) { } @ Override public CloudApplication getApplication ( CloudSpace space , String appName ) { } @ Override public CloudApplication getApplication ( UUID appGuid ) { } @ Override public Map < String , Object > getApplicationEnvironment ( UUID appGuid ) { } @ Override public Map < String , Object > getApplicationEnvironment ( String appName ) { } @ Override public Map < String , Object > getApplicationEnvironment ( CloudSpace space , String appName ) { }

Fix:
Map < String , Object > resource = doGetServiceInstance ( space , serviceName , 1 ) ;