Source:
public List<Tag> getTagsDockerHub(Tool tool) { final String repo = tool.getNamespace() + '/' + tool.getName(); LOG.info(" ======================= Getting tags for: {}================================", tool.getPath()); final List<Tag> tags = new ArrayList<>(); Optional<String> dockerHubResponse = getDockerHubToolAsString(tool); Map<String, String> error = new HashMap<>(); DockerHubTag dockerHubTag; if (dockerHubResponse.isPresent()) { Gson gson = new Gson(); final String errorJSON = dockerHubResponse.get(); final String manifestJSON = dockerHubResponse.get(); error = (Map<String, String>)gson.fromJson(errorJSON, error.getClass()); if (error.get("message") != null) { LOG.info("Error response from DockerHub: " + error.get("message")); return new ArrayList<>(); } dockerHubTag = gson.fromJson(manifestJSON, DockerHubTag.class); List<Results> results = Arrays.asList(dockerHubTag.getResults()); try { for (Results r : results) { final Tag tag = new Tag(); tag.setName(r.getName()); List<DockerHubImage> dockerHubImages = Arrays.asList(r.getImages()); List<Checksum> checksums = new ArrayList<>(); for (DockerHubImage i : dockerHubImages) { final String manifestDigest = i.getDigest(); checksums.add(new Checksum(manifestDigest.split(":")[0], manifestDigest.split(":")[1])); } Set<Image> images = Collections.singleton(new Image(checksums, repo, tag.getName(), r.getImageID(), tool.getRegistry())); tag.getImages().addAll(images); tags.add(tag); } } catch (IndexOutOfBoundsException ex) { LOG.info("Unable to grab image and checksum information for" + tool.getNamespace() + '/' + tool.getName()); } return tags; } else { LOG.info("Could not get response from DockerHub"); return new ArrayList<>(); } }

Target:
public List<Tag> getTagsDockerHub(Tool tool) { final String repo = tool.getNamespace() + '/' + tool.getName(); LOG.info(" ======================= Getting tags for: {}================================", tool.getPath()); final List<Tag> tags = new ArrayList<>(); Optional<String> dockerHubResponse = getDockerHubToolAsString(tool); Map<String, String> error = new HashMap<>(); DockerHubTag dockerHubTag; if (dockerHubResponse.isPresent()) { Gson gson = new Gson(); final String errorJSON = dockerHubResponse.get(); final String manifestJSON = dockerHubResponse.get(); error = (Map<String, String>)gson.fromJson(errorJSON, error.getClass()); if (error.get("message") != null) { LOG.info("Error response from DockerHub: " + error.get("message")); return new ArrayList<>(); } dockerHubTag = gson.fromJson(manifestJSON, DockerHubTag.class); List<Results> results = Arrays.asList(dockerHubTag.getResults()); try { for (Results r : results) { final Tag tag = new Tag(); tag.setName(r.getName()); List<DockerHubImage> dockerHubImages = Arrays.asList(r.getImages()); List<Checksum> checksums = new ArrayList<>(); for (DockerHubImage i : dockerHubImages) { final String manifestDigest = i.getDigest(); checksums.add(new Checksum(manifestDigest.split(":")[0], manifestDigest.split(":")[1])); } tag.getImages().add(new Image(checksums, repo, tag.getName(), r.getImageID(), Registry.DOCKER_HUB)); tags.add(tag); } } catch (IndexOutOfBoundsException ex) { LOG.info("Unable to grab image and checksum information for" + tool.getNamespace() + '/' + tool.getName()); } return tags; } else { LOG.info("Could not get response from DockerHub"); return new ArrayList<>(); } }