Source:
public static Definition getDefinition(String swaggerUrl, String userName, String password) throws TranslationException { if (swaggerUrl == null) { throw new TranslationException("url", "You did not provide any URL"); } Pattern p = Pattern .compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); boolean remote = p.matcher(swaggerUrl).matches(); ResourceListing resourceListing; resourceListing = getAndDeserialize(swaggerUrl, userName, password, ResourceListing.class); Map<String, ApiDeclaration> apis = new HashMap<String, ApiDeclaration>(); if (remote) { LOGGER.log(Level.FINE, "Reading file: " + swaggerUrl); resourceListing = getAndDeserialize(swaggerUrl, userName, password, ResourceListing.class); for (ResourceListingApi api : resourceListing.getApis()) { LOGGER.log(Level.FINE, "Reading file: " + swaggerUrl + api.getPath()); apis.put( api.getPath(), getAndDeserialize(swaggerUrl + api.getPath(), userName, password, ApiDeclaration.class)); } try { client.stop(); } catch (Exception e) { LOGGER.warning("Connection to " + swaggerUrl + "was not closed."); } } else { File resourceListingFile = new File(swaggerUrl); ObjectMapper om = new ObjectMapper(); try { resourceListing = om.readValue(resourceListingFile, ResourceListing.class); String basePath = resourceListingFile.getParent(); LOGGER.log(Level.FINE, "Base path: " + basePath); for (ResourceListingApi api : resourceListing.getApis()) { LOGGER.log(Level.FINE, "Reading file " + basePath + api.getPath()); apis.put(api.getPath(), om.readValue(new File(basePath + api.getPath()), ApiDeclaration.class)); } } catch (Exception e) { throw new TranslationException("file", e.getMessage()); } } return SwaggerTranslator.translate(resourceListing, apis); }

Target:
public static Definition getDefinition(String swaggerUrl, String userName, String password) throws TranslationException { if (swaggerUrl == null) { throw new TranslationException("url", "You did not provide any URL"); } Pattern p = Pattern .compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); boolean remote = p.matcher(swaggerUrl).matches(); ResourceListing resourceListing; Map<String, ApiDeclaration> apis = new HashMap<String, ApiDeclaration>(); if (remote) { LOGGER.log(Level.FINE, "Reading file: " + swaggerUrl); resourceListing = getAndDeserialize(swaggerUrl, userName, password, ResourceListing.class); for (ResourceListingApi api : resourceListing.getApis()) { LOGGER.log(Level.FINE, "Reading file: " + swaggerUrl + api.getPath()); apis.put( api.getPath(), getAndDeserialize(swaggerUrl + api.getPath(), userName, password, ApiDeclaration.class)); } try { client.stop(); } catch (Exception e) { LOGGER.warning("Connection to " + swaggerUrl + "was not closed."); } } else { File resourceListingFile = new File(swaggerUrl); ObjectMapper om = new ObjectMapper(); try { resourceListing = om.readValue(resourceListingFile, ResourceListing.class); String basePath = resourceListingFile.getParent(); LOGGER.log(Level.FINE, "Base path: " + basePath); for (ResourceListingApi api : resourceListing.getApis()) { LOGGER.log(Level.FINE, "Reading file " + basePath + api.getPath()); apis.put(api.getPath(), om.readValue(new File(basePath + api.getPath()), ApiDeclaration.class)); } } catch (Exception e) { throw new TranslationException("file", e.getMessage()); } } return SwaggerTranslator.translate(resourceListing, apis); }