Source:
<code><START> public Task<Tuple2<Integer, String>> build(final String hash, final InputStream body) <END> throws IOException { if (hash == null) { String content = "Missing hash."; LOG.info(content); return Task.value(new Tuple2<>(HttpServletResponse.SC_BAD_REQUEST, content)); } else { if (_hashManager.contains(hash)) { LOG.info("hash found in cache: " + hash); return Task.value(new Tuple2<>(HttpServletResponse.SC_OK, "")); } else { if (body == null) { String content = "Missing body."; LOG.info(content); return Task.value(new Tuple2<>(HttpServletResponse.SC_BAD_REQUEST, content)); } else if (_dotLocation == null) { String content = "Missing dot."; LOG.info(content); return Task.value(new Tuple2<>(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, content)); } else { final Task<Exec.Result> buildTask = getBuildTask(hash, body); return buildTask.transform("result", result -> { Integer status = null; String content = null; if (result.isFailed()) { status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; content = result.getError().toString(); } else { switch (result.get().getStatus()) { case 0: _hashManager.add(hash); status = HttpServletResponse.SC_OK; content = ""; break; case 137: status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; content = "graphviz process was killed because it did not finish within " + _timeoutMs + "ms"; break; default: status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; content = writeGenericFailureInfo(result.get()); break; } } _inFlightBuildTasks.remove(hash, buildTask); return Success.of(new Tuple2<>(status, content)); }); } } } }</code><technical_language>a class fields: status body instead of Tuple</technical_language>

Target:
public Task<GraphvizResponse> build(final String hash, final InputStream body) throws IOException { if (hash == null) { String content = "Missing hash."; LOG.info(content); return Task.value(new GraphvizResponse(HttpServletResponse.SC_BAD_REQUEST, content)); } else { if (_hashManager.contains(hash)) { LOG.info("hash found in cache: " + hash); return Task.value(new GraphvizResponse(HttpServletResponse.SC_OK, "")); } else { if (body == null) { String content = "Missing body."; LOG.info(content); return Task.value(new GraphvizResponse(HttpServletResponse.SC_BAD_REQUEST, content)); } else if (_dotLocation == null) { String content = "Missing dot."; LOG.info(content); return Task.value(new GraphvizResponse(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, content)); } else { final Task<Exec.Result> buildTask = getBuildTask(hash, body); return buildTask.transform("result", result -> { Integer status = null; String content = null; if (result.isFailed()) { status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; content = result.getError().toString(); } else { switch (result.get().getStatus()) { case 0: _hashManager.add(hash); status = HttpServletResponse.SC_OK; content = ""; break; case 137: status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; content = "graphviz process was killed because it did not finish within " + _timeoutMs + "ms"; break; default: status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; content = writeGenericFailureInfo(result.get()); break; } } _inFlightBuildTasks.remove(hash, buildTask); return Success.of(new GraphvizResponse(status, content)); }); } } } }