@Override public InputStream locate(final String uri) throws IOException {
  validState(standaloneContext != null,"Locator was not initialized properly. StandaloneContext missing.");
  Exception lastException=null;
  final String[] contextFolders=standaloneContext.getContextFolders();
  for (  final String contextFolder : contextFolders) {
    try {
      return locateStreamWithContextFolder(uri,contextFolder);
    }
 catch (    final IOException e) {
      lastException=e;
      LOG.debug("Could not locate: {} using contextFolder: {}",uri,contextFolder);
    }
  }
  final String exceptionMessage=String.format("No valid resource '%s' found inside any of contextFolders: %s",uri,Arrays.toString(standaloneContext.getContextFolders()));
  throw new IOException(exceptionMessage,lastException);
}

@ Override public InputStream locate ( final String uri ) throws IOException { validState ( standaloneContext != null , "Locator was not initialized properly. StandaloneContext missing." ) ; Exception lastException = null ; final String [ ] contextFolders = standaloneContext . getContextFolders ( ) ; for ( final String contextFolder : contextFolders ) { try { return locateStreamWithContextFolder ( uri , contextFolder ) ; } catch ( final IOException e ) { lastException = e ; LOG . debug ( "Could not locate: {} using contextFolder: {}" , uri , contextFolder ) ; } } final String exceptionMessage = String . format ( "No valid resource '%s' found inside any of contextFolders: %s" , uri , Arrays . toString ( standaloneContext . getContextFolders ( ) ) ) ; throw new IOException ( exceptionMessage , lastException ) ; }
this implementation will try to locate the provided resource inside contextfolder configured by standalonecontext . if a resource cannot be located , the next contextfolder from the list will be tried . the first successful result will be returned .
