auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private long insertRevision(SQLDatabase db,InsertRevisionOptions options) throws AttachmentException { long newSequence; ContentValues args = new ContentValues(); args.put("doc_id", options.docNumericId); args.put("revid", options.revId); if (options.parentSequence > 0) { args.put("parent", options.parentSequence); } args.put("current", options.current); args.put("deleted", options.deleted); args.put("available", options.available); args.put("json", options.data); logger.fine("New revision inserted: " + options.docNumericId + ", " + options.revId); newSequence = db.insert("revs", args); if (newSequence < 0) { <START> throw new IllegalStateException("Unknown error inserting new updated doc, please checking log"); END> } if (options.copyAttachments) { this.attachmentManager.copyAttachments(db,options.parentSequence, newSequence); } return newSequence; }</code><technical_language>newSequence < 0 means row inserted, is serious recoverable. opportunity clean grammar this error message</technical_language>

Target:
private long insertRevision(SQLDatabase db,InsertRevisionOptions options) { long newSequence; ContentValues args = new ContentValues(); args.put("doc_id", options.docNumericId); args.put("revid", options.revId); if (options.parentSequence > 0) { args.put("parent", options.parentSequence); } args.put("current", options.current); args.put("deleted", options.deleted); args.put("available", options.available); args.put("json", options.data); logger.fine("New revision inserted: " + options.docNumericId + ", " + options.revId); newSequence = db.insert("revs", args); if (newSequence < 0) { throw new IllegalStateException("Unknown error inserting new updated doc, please check log"); } return newSequence; }
Source:
<code>public void testBaseline() throws Exception { <START> assertBaseline(content(null, GridRestCommand.BASELINE_CURRENT_STATE), gridCount(), gridCount()); <END> stopGrid(gridCount() - 1); assertBaseline(content(null, GridRestCommand.BASELINE_CURRENT_STATE), gridCount(), gridCount() - 1); startGrid(gridCount() - 1); assertBaseline(content(null, GridRestCommand.BASELINE_CURRENT_STATE), gridCount(), gridCount()); }</code><technical_language>add local variable: sz = gridCount() ? for readability</technical_language>

Target:
public void testBaseline() throws Exception { int sz = gridCount(); assertBaseline(content(null, GridRestCommand.BASELINE_CURRENT_STATE), sz, sz); stopGrid(sz - 1); assertBaseline(content(null, GridRestCommand.BASELINE_CURRENT_STATE), sz, sz - 1); startGrid(sz - 1); assertBaseline(content(null, GridRestCommand.BASELINE_CURRENT_STATE), sz, sz); }
Source:
<code>private ModuleMeta(String name, Module module) { <START> this(name, module, new DefaultAttributeMap()); <END> }</code><technical_language>attributes defined for Modules? DefaultAttributeMap contain</technical_language>

Target:
private ModuleMeta(String name, Module module) { LOG.debug("Initializing as {}", name, module.getClass().getName()); this.name = name; this.module = module; this.attributes = new DefaultAttributeMap(); this.dag = new LogicalPlan(); }
Source:
<code>public String getEditorConfigId() { return <START> "XTEXT_ValueSpecification_Cell_Editor"; END> }</code><technical_language>Move a constant</technical_language>

Target:
public String getEditorConfigId() { return XTEXT_VALUE_SPECIFICATION_CELL_EDITOR_IDENTIFIER; }
Source:
<code>public void setMaximized(boolean maximized) { <START> getElement().setAttribute("maximized", "" + maximized); <END> }</code><technical_language>Boolean.toString()</technical_language>

Target:
public void setMaximized(boolean maximized) { getElement().setAttribute("maximized", Boolean.toString(maximized)); }
Source:
<code><START> private int translateToError(Throwable cause) { <END> if (cause instanceof CertificateRevokedException) { return CertificateVerifier.X509_V_ERR_CERT_REVOKED; } Throwable wrapped = cause.getCause(); while (wrapped != null) { if (wrapped instanceof CertPathValidatorException) { CertPathValidatorException ex = (CertPathValidatorException) wrapped; CertPathValidatorException.Reason reason = ex.getReason(); if (reason == CertPathValidatorException.BasicReason.EXPIRED) { return CertificateVerifier.X509_V_ERR_CERT_HAS_EXPIRED; } if (reason == CertPathValidatorException.BasicReason.NOT_YET_VALID) { return CertificateVerifier.X509_V_ERR_CERT_NOT_YET_VALID; } if (reason == CertPathValidatorException.BasicReason.REVOKED) { return CertificateVerifier.X509_V_ERR_CERT_REVOKED; } } wrapped = wrapped.getCause(); } return CertificateVerifier.X509_V_ERR_UNSPECIFIED; }</code><technical_language>static</technical_language>

Target:
private static int translateToError(Throwable cause) { if (cause instanceof CertificateRevokedException) { return CertificateVerifier.X509_V_ERR_CERT_REVOKED; } Throwable wrapped = cause.getCause(); while (wrapped != null) { if (wrapped instanceof CertPathValidatorException) { CertPathValidatorException ex = (CertPathValidatorException) wrapped; CertPathValidatorException.Reason reason = ex.getReason(); if (reason == CertPathValidatorException.BasicReason.EXPIRED) { return CertificateVerifier.X509_V_ERR_CERT_HAS_EXPIRED; } if (reason == CertPathValidatorException.BasicReason.NOT_YET_VALID) { return CertificateVerifier.X509_V_ERR_CERT_NOT_YET_VALID; } if (reason == CertPathValidatorException.BasicReason.REVOKED) { return CertificateVerifier.X509_V_ERR_CERT_REVOKED; } } wrapped = wrapped.getCause(); } return CertificateVerifier.X509_V_ERR_UNSPECIFIED; }
Source:
<code>private Map<String, IPath> importAsBinaryWithLinks(IProject project, IPluginModelBase model, IProgressMonitor monitor) throws CoreException { <START> SubMonitor subMonitor = SubMonitor.convert(monitor, "", 3); END> File srcFile = new File(model.getInstallLocation()); if (srcFile.isFile()) { IFile dstFile = project.getFile(new Path(srcFile.getName())); dstFile.createLink(srcFile.toURI(), IResource.NONE, subMonitor.newChild(1)); } else { IFolder dstFile = project.getFolder(new Path(srcFile.getName())); dstFile.createLink(srcFile.toURI(), IResource.NONE, subMonitor.newChild(1)); } Map<String, IPath> sourceMap = importSourceArchives(project, model, IMPORT_BINARY_WITH_LINKS, subMonitor.newChild(1)); importAdditionalSourceFiles(project, model, subMonitor.newChild(1)); importRequiredPluginFiles(project, model, subMonitor.newChild(1)); modifyBundleClasspathHeader(project, model); RepositoryProvider.map(project, PDECore.BINARY_REPOSITORY_PROVIDER); project.setPersistentProperty(PDECore.EXTERNAL_PROJECT_PROPERTY, PDECore.BINARY_PROJECT_VALUE); return sourceMap; }</code><technical_language>Ticks line up. allocate 4 here. 2-argument constructor</technical_language>

Target:
private Map<String, IPath> importAsBinaryWithLinks(IProject project, IPluginModelBase model, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 4); File srcFile = new File(model.getInstallLocation()); if (srcFile.isFile()) { IFile dstFile = project.getFile(new Path(srcFile.getName())); dstFile.createLink(srcFile.toURI(), IResource.NONE, subMonitor.newChild(1)); } else { IFolder dstFile = project.getFolder(new Path(srcFile.getName())); dstFile.createLink(srcFile.toURI(), IResource.NONE, subMonitor.newChild(1)); } Map<String, IPath> sourceMap = importSourceArchives(project, model, IMPORT_BINARY_WITH_LINKS, subMonitor.newChild(1)); importAdditionalSourceFiles(project, model, subMonitor.newChild(1)); importRequiredPluginFiles(project, model, subMonitor.newChild(1)); modifyBundleClasspathHeader(project, model); RepositoryProvider.map(project, PDECore.BINARY_REPOSITORY_PROVIDER); project.setPersistentProperty(PDECore.EXTERNAL_PROJECT_PROPERTY, PDECore.BINARY_PROJECT_VALUE); return sourceMap; }
Source:
<code>public static synchronized void startUp() throws InterruptedException, IOException { RandomConfigurationSupport randomConfigSupport = new RandomConfigurationSupport(); if (application == null) { application = new SingleNodeApplication().run("--transport", "local", "--analytics", "redis"); <START> integrationTestSupport = new SingleNodeIntegrationTestSupport(application, "classpath:/spring-xd/xd/modules"); <END> Bootstrap bootstrap = new Bootstrap(new String[] { "--port", randomConfigSupport.getAdminServerPort() }); shell = bootstrap.getJLineShellComponent(); } if (!shell.isRunning()) { shell.start(); } }</code><technical_language>Ah, I now. is this 1arg constructor (reviewing github web for now, bear me)</technical_language>

Target:
public static synchronized void startUp() throws InterruptedException, IOException { RandomConfigurationSupport randomConfigSupport = new RandomConfigurationSupport(); if (application == null) { application = new SingleNodeApplication().run("--transport", "local", "--analytics", "redis"); integrationTestSupport = new SingleNodeIntegrationTestSupport(application); integrationTestSupport.addModuleRegistry(new ArchiveModuleRegistry("classpath:/spring-xd/xd/modules")); Bootstrap bootstrap = new Bootstrap(new String[] { "--port", randomConfigSupport.getAdminServerPort() }); shell = bootstrap.getJLineShellComponent(); } if (!shell.isRunning()) { shell.start(); } }
Source:
<code><START> public SortedMap<String, SortedMap<Integer, String>> getProperties() { <END> return properties; }</code><technical_language>returning generic Map interface</technical_language>

Target:
public Map<String, SortedMap<Integer, String>> getProperties() { return properties; }
Source:
<code><START> public long commitTimestamp(long transaction, long startTimestamp) throws IOException { <END> if (aborted.contains(transaction)) return -2; long commitTimestamp = committed.getCommit(transaction); if (commitTimestamp != -1 && commitTimestamp > startTimestamp) return -2; if (commitTimestamp != -1 && commitTimestamp <= startTimestamp) return commitTimestamp; if (hasConnectionTimestamp && transaction > connectionTimestamp) return transaction <= largestDeletedTimestamp ? -1 : -2; if (transaction <= largestDeletedTimestamp) return -1; Statistics.partialReport(Statistics.Tag.ASKTSO, 1); askedTSO++; SyncCommitQueryCallback cb = new SyncCommitQueryCallback(); isCommitted(startTimestamp, transaction, cb); try { cb.await(); } catch (InterruptedException e) { throw new IOException("Commit query didn't complete", e); } if (!cb.isAClearAnswer()) throw new IOException("Either abort or retry the transaction"); return cb.isCommitted() ? cb.commitTimestamp() : -2; }</code><technical_language>If replaces validRead() remove it. validRead() is tested TestReadAlgorithm, adapt test this new function</technical_language>

Target:
public long commitTimestamp(long transaction, long startTimestamp) throws IOException { if (aborted.contains(transaction)) return INVALID_READ; long commitTimestamp = committed.getCommit(transaction); if (commitTimestamp != -1 && commitTimestamp > startTimestamp) return INVALID_READ; if (commitTimestamp != -1 && commitTimestamp <= startTimestamp) return commitTimestamp; if (hasConnectionTimestamp && transaction > connectionTimestamp) return transaction <= largestDeletedTimestamp ? LOST_TC : INVALID_READ; if (transaction <= largestDeletedTimestamp) return LOST_TC; Statistics.partialReport(Statistics.Tag.ASKTSO, 1); askedTSO++; SyncCommitQueryCallback cb = new SyncCommitQueryCallback(); isCommitted(startTimestamp, transaction, cb); try { cb.await(); } catch (InterruptedException e) { throw new IOException("Commit query didn't complete", e); } if (!cb.isAClearAnswer()) throw new IOException("Either abort or retry the transaction"); return cb.isCommitted() ? cb.commitTimestamp() : INVALID_READ; }
Source:
<code>protected static Map<String, String> getQueryParameters(BusinessTransactionCriteria criteria) { Map<String, String> ret = new HashMap<String, String>(); if (criteria.getStartTime() > 0) { ret.put("startTime", "" + criteria.getStartTime()); } if (criteria.getEndTime() > 0) { ret.put("endTime", "" + criteria.getEndTime()); } if (!criteria.getProperties().isEmpty()) { boolean first = true; StringBuffer buf = new StringBuffer(); for (String key : criteria.getProperties().keySet()) { if (first) { first = false; } else { buf.append(','); } buf.append(key); buf.append('|'); buf.append(criteria.getProperties().get(key)); } ret.put("properties", buf.toString()); } if (!criteria.getCorrelationIds().isEmpty()) { boolean first = true; <START> StringBuffer buf = new StringBuffer(); <END> for (CorrelationIdentifier cid : criteria.getCorrelationIds()) { if (first) { first = false; } else { buf.append(','); } buf.append(cid.getScope().name()); buf.append('|'); buf.append(cid.getValue()); } ret.put("correlations", buf.toString()); } return ret; }</code><technical_language>need a StringBuffer, instead of StringBuilder</technical_language>

Target:
protected static Map<String, String> getQueryParameters(BusinessTransactionCriteria criteria) { Map<String, String> ret = new HashMap<String, String>(); if (criteria.getStartTime() > 0) { ret.put("startTime", "" + criteria.getStartTime()); } if (criteria.getEndTime() > 0) { ret.put("endTime", "" + criteria.getEndTime()); } if (!criteria.getProperties().isEmpty()) { boolean first = true; StringBuilder buf = new StringBuilder(); for (String key : criteria.getProperties().keySet()) { if (first) { first = false; } else { buf.append(','); } buf.append(key); buf.append('|'); buf.append(criteria.getProperties().get(key)); } ret.put("properties", buf.toString()); } if (!criteria.getCorrelationIds().isEmpty()) { boolean first = true; StringBuilder buf = new StringBuilder(); for (CorrelationIdentifier cid : criteria.getCorrelationIds()) { if (first) { first = false; } else { buf.append(','); } buf.append(cid.getScope().name()); buf.append('|'); buf.append(cid.getValue()); } ret.put("correlations", buf.toString()); } return ret; }
Source:
<code>void visitConditionalSchema(ConditionalSchema conditionalSchema) { if (!conditionalSchema.getIfSchema().isPresent() || (!conditionalSchema.getThenSchema().isPresent() && !conditionalSchema.getElseSchema().isPresent())) { return; } try { conditionalSchema.getIfSchema().get().validate(subject); <START> } catch (ValidationException ifSchemaValidationException) { <END> Schema elseSchema = conditionalSchema.getElseSchema().orElseThrow(() -> ifSchemaValidationException); elseSchema.validate(subject); return; } conditionalSchema.getThenSchema().ifPresent(schema -> schema.validate(subject)); }</code><technical_language>Instead of try-catch please ValidatingVisitor#getFailureOfSchema(Schema, Object) method. a bit faster, returns throw exception, stacktrace generation time</technical_language>

Target:
void visitConditionalSchema(ConditionalSchema conditionalSchema) { conditionalSchema.accept(new ConditionalSchemaValidatingVisitor(subject, this)); }
Source:
<code>public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { IdentifierTree identifier = null; ExpressionTree expression = tree.expression(); if (expression.is(Kind.IDENTIFIER)) { identifier = (IdentifierTree) expression; } else if (expression.is(Kind.PARENTHESIZED_EXPRESSION) && ((ParenthesizedTree) expression).expression().is(Kind.IDENTIFIER)) { identifier = (IdentifierTree) ((ParenthesizedTree) expression).expression(); } if (!usageStatusStack.isEmpty() && identifier != null) { <START> Iterator<UsageStatus> iterator = usageStatusStack.iterator(); <END> while (iterator.hasNext()) { iterator.next().addInvalidUsage(identifier); } } super.visitMemberSelectExpression(tree); }</code><technical_language>making of forEach method</technical_language>

Target:
public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { final IdentifierTree identifier; ExpressionTree expression = tree.expression(); if (expression.is(Kind.IDENTIFIER)) { identifier = (IdentifierTree) expression; } else if (expression.is(Kind.PARENTHESIZED_EXPRESSION) && ((ParenthesizedTree) expression).expression().is(Kind.IDENTIFIER)) { identifier = (IdentifierTree) ((ParenthesizedTree) expression).expression(); } else { identifier = null; } if (!usageStatusStack.isEmpty() && identifier != null) { usageStatusStack.forEach(usageStatus -> usageStatus.addInvalidUsage(identifier)); } super.visitMemberSelectExpression(tree); }
Source:
<code>public void scenario1() throws IOException { final String testObj = ingestObj("/rest/webacl_box1"); final String acl1 = ingestAcl("fedoraAdmin", "/acls/01/acl.ttl", "/acls/01/authorization.ttl"); linkToAcl(testObj, acl1); final String aclLink = acl1 + "; rel=\"acl\""; logger.debug("Anonymous can't read"); final HttpGet request = getObjMethod(testObj.replace(serverAddress, "")); try (final CloseableHttpResponse response = execute(request)) { assertEquals(HttpStatus.SC_FORBIDDEN, getStatus(response)); } logger.debug("Can username 'smith123' read " + testObj); setAuth(request, "smith123"); try (final CloseableHttpResponse response = execute(request)) { assertEquals(HttpStatus.SC_OK, getStatus(response)); for (final Header header : response.getHeaders("Link")) { logger.debug("Link header: {}", header.getValue()); if (header.getValue().equals(aclLink)) { return; } } <START> assertEquals("Missing Link Header " + aclLink.toString(), 1, 0); <END> } }</code><technical_language>@whikloj in this case, roll change this line #47 get: try (final CloseableHttpResponse response = execute(request)) { assertEquals(HttpStatus.SC_OK, getStatus(response)); // rest of code PR } fine try block if need inspect response. For checking status code unnecessary</technical_language>

Target:
public void scenario1() throws IOException { final String testObj = ingestObj("/rest/webacl_box1"); final String acl1 = ingestAcl("fedoraAdmin", "/acls/01/acl.ttl", "/acls/01/authorization.ttl"); linkToAcl(testObj, acl1); final String aclLink = Link.fromUri(acl1).rel("acl").build().toString(); logger.debug("Anonymous can't read"); final HttpGet request = getObjMethod(testObj.replace(serverAddress, "")); assertEquals(HttpStatus.SC_FORBIDDEN, getStatus(request)); logger.debug("Can username 'smith123' read " + testObj); setAuth(request, "smith123"); try (final CloseableHttpResponse response = execute(request)) { assertEquals(HttpStatus.SC_OK, getStatus(response)); final Optional<String> header = Arrays.asList(response.getHeaders("Link")).stream().map(Header::getValue) .filter(aclLink::equals).findFirst(); assertTrue("Missing Link header", header.isPresent()); } }
Source:
<code>public AssertionError failure(String message, Throwable cause) { <START> return prettyPrintedWithoutAssertJRelatedElementsFromStackTraceIfNeeded(new AssertionFailedError(message, cause)); <END> }</code><technical_language>want a direct reference AssertionFailedError opentest4j is a required dependency for AssertJ (the policy is hard dependency). idea of AssertionErrorCreator is able build AssertionFailedError if opentest4j is in classpath fallback standard AssertionError instead. This means assertionErrorCreator.assertionError(... called</technical_language>

Target:
public AssertionError failure(String message, Throwable cause) { return prettyPrintedWithoutAssertJRelatedElementsFromStackTraceIfNeeded(assertionErrorCreator.assertionError(message, cause)); }
Source:
<code>private DbUser buildUser(T params, String authzName) { DbUser dbUser = dbUserDao.getByExternalId(authzName, params.getPrincipalId()); <START> DbUser user = dbUser != null ? new DbUser(dbUser) : new DbUser(); <END> user.setId(dbUser == null ? Guid.newGuid() : dbUser.getId()); user.setExternalId(params.getPrincipalId()); user.setDomain(authzName); user.setEmail(params.getEmail()); user.setFirstName(params.getFirstName()); user.setLastName(params.getLastName()); user.setNamespace(params.getNamespace()); user.setLoginName(params.getPrincipalName()); List<Guid> groupIds = new ArrayList<>(); List<String> groupRecordIds = new ArrayList<>(); flatGroups((Collection<ExtMap>) params.getGroupIds(), groupRecordIds); for (String groupId : groupRecordIds) { DbGroup dbGroup = dbGroupDao.getByExternalId(authzName, groupId); if (dbGroup != null) { groupIds.add(dbGroup.getId()); } } user.setGroupIds(groupIds); boolean isAdmin = !roleDao.getAnyAdminRoleForUserAndGroups(user.getId(), StringUtils.join(user.getGroupIds(), ",")).isEmpty(); user.setAdmin(isAdmin); if (dbUser == null) { dbUserDao.save(user); } else if (!dbUser.equals(user)) { dbUserDao.update(user); } return user; }</code><technical_language>fix condition copy constructor</technical_language>

Target:
private DbUser buildUser(T params, String authzName) { DbUser dbUser = dbUserDao.getByExternalId(authzName, params.getPrincipalId()); DbUser user = new DbUser(dbUser); user.setId(dbUser == null ? Guid.newGuid() : dbUser.getId()); user.setExternalId(params.getPrincipalId()); user.setDomain(authzName); user.setEmail(params.getEmail()); user.setFirstName(params.getFirstName()); user.setLastName(params.getLastName()); user.setNamespace(params.getNamespace()); user.setLoginName(params.getPrincipalName()); List<Guid> groupIds = new ArrayList<>(); List<String> groupRecordIds = new ArrayList<>(); flatGroups((Collection<ExtMap>) params.getGroupIds(), groupRecordIds); for (String groupId : groupRecordIds) { DbGroup dbGroup = dbGroupDao.getByExternalId(authzName, groupId); if (dbGroup != null) { groupIds.add(dbGroup.getId()); } } user.setGroupIds(groupIds); user.setAdmin( !roleDao.getAnyAdminRoleForUserAndGroups( user.getId(), StringUtils.join(user.getGroupIds(), ",") ).isEmpty() ); if (dbUser == null) { dbUserDao.save(user); } else if (!dbUser.equals(user)) { dbUserDao.update(user); } return user; }
Source:
<code>public void testSendSerialDataAsyncOtherProtocolsIOError() throws XBeeException, IOException { Mockito.when(xbeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.ZIGBEE); Mockito.doThrow(new IOException()).when(xbeeDevice).sendXBeePacketAsync(transmitPacket); try { xbeeDevice.sendSerialDataAsync(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { <START> assertEquals(XBeeException.class, e.getClass()); <END> } try { xbeeDevice.sendSerialDataAsync(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } try { xbeeDevice.sendSerialDataAsync(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } }</code><technical_language>Verify failure is I/O. java e.getCause() Repeat for others</technical_language>

Target:
public void testSendSerialDataAsyncOtherProtocolsIOError() throws XBeeException, IOException { Mockito.when(xbeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.ZIGBEE); Mockito.doThrow(new IOException()).when(xbeeDevice).sendXBeePacketAsync(transmitPacket); try { xbeeDevice.sendSerialDataAsync(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } try { xbeeDevice.sendSerialDataAsync(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } try { xbeeDevice.sendSerialDataAsync(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } }
Source:
<code>public String getDescription() { <START> return "Returns a qdigest from the set of doubles"; <END> }</code><technical_language>real bigint applies for qdigest right</technical_language>

Target:
public String getDescription() { return "Returns a qdigest from the set of reals, bigints, doubles"; }
Source:
<code><START> public synchronized IPieChartViewerState getCurrentState() { <END> return fCurrentState; }</code><technical_language>For this method package visible</technical_language>

Target:
synchronized IPieChartViewerState getCurrentState() { return fCurrentState; }
Source:
<code>public void openEditModal() { ItemObjectModel itemObjectModel = new ItemObjectModel(); itemObjectModel.setParameters(model.getParameters()); itemObjectModel.setResolver(model.getResolver()); <START> singleValueModal.show((v) ->{ <END> super.remove(); itemObjectModel.setValue(v); this.getListPresenter().add(itemObjectModel); fireChangeEvent(); }, model.getValue()); }</code><technical_language>please review code formatting</technical_language>

Target:
public void openEditModal() { singleValueModal.show(v -> { model.setValue(v); view.setValue(v); fireChangeEvent(); }, model.getValue()); }
Source:
<code>public VdsStatic() { serverSslEnabled = false; vdsStrength = 100; vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; sshPort = DEFAULT_SSH_PORT; sshUsername = DEFAULT_SSH_USERNAME; name = ""; comment = ""; vdsType = VDSType.VDS; autoRecoverable = true; disablePowerManagementPolicy = false; pmKdumpDetection = true; hostProviderId = null; currentKernelCmdline = null; <START> lastStoredKernelCmdline = null; <END> }</code><technical_language>do need explicitly initialize null</technical_language>

Target:
public VdsStatic() { serverSslEnabled = false; vdsStrength = 100; vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; sshPort = DEFAULT_SSH_PORT; sshUsername = DEFAULT_SSH_USERNAME; name = ""; comment = ""; vdsType = VDSType.VDS; autoRecoverable = true; disablePowerManagementPolicy = false; pmKdumpDetection = true; hostProviderId = null; }
Source:
<code>public boolean status() { if (status.equals("ON")) { return true; } <START> return false; <END> }</code><technical_language>return status != null && status.equals("ON"); is correct sufficient</technical_language>

Target:
public boolean status() { return status != null && status.equals("ON"); }
Source:
<code>public static List<BrooklynTypePlanTransformer> forType(ManagementContext mgmt, RegisteredType type, RegisteredTypeLoadingContext constraint) { Multimap<Double,BrooklynTypePlanTransformer> byScoreMulti = ArrayListMultimap.create(); Collection<BrooklynTypePlanTransformer> transformers = all(mgmt); for (BrooklynTypePlanTransformer transformer : transformers) { double score = transformer.scoreForType(type, constraint); if (score>0) byScoreMulti.put(score, transformer); } Map<Double, Collection<BrooklynTypePlanTransformer>> tree = new TreeMap<Double, Collection<BrooklynTypePlanTransformer>>(byScoreMulti.asMap()); List<Collection<BrooklynTypePlanTransformer>> highestFirst = new ArrayList<Collection<BrooklynTypePlanTransformer>>(tree.values()); <START> Collections.reverse(highestFirst); <END> return MutableList.copyOf(Iterables.concat(highestFirst)).asUnmodifiable(); }</code><technical_language>pass Collections.reverseOrder() TreeMap instead</technical_language>

Target:
public static List<BrooklynTypePlanTransformer> forType(ManagementContext mgmt, RegisteredType type, RegisteredTypeLoadingContext constraint) { Multimap<Double,BrooklynTypePlanTransformer> byScoreMulti = ArrayListMultimap.create(); Collection<BrooklynTypePlanTransformer> transformers = all(mgmt); for (BrooklynTypePlanTransformer transformer : transformers) { double score = transformer.scoreForType(type, constraint); if (score>0) byScoreMulti.put(score, transformer); } Map<Double, Collection<BrooklynTypePlanTransformer>> tree = new TreeMap<Double, Collection<BrooklynTypePlanTransformer>>(byScoreMulti.asMap()); List<Collection<BrooklynTypePlanTransformer>> highestFirst = new ArrayList<Collection<BrooklynTypePlanTransformer>>(tree.values()); Collections.reverse(highestFirst); return ImmutableList.copyOf(Iterables.concat(highestFirst)); }
Source:
<code>public static UnresolvedCallExpression ifThenElse(Expression condition, Expression ifTrue, Expression ifFalse) { <START> return call(IF, call(IS_TRUE, condition), ifTrue, ifFalse); <END> }</code><technical_language>elaborate this change? if condition is NULL execute false branch</technical_language>

Target:
public static UnresolvedCallExpression ifThenElse(Expression condition, Expression ifTrue, Expression ifFalse) { return call(IF, condition, ifTrue, ifFalse); }
Source:
<code>private String getSnitch() { try { return getRandomGoodHost().runWithPooledResource( (FunctionCheckedException<CassandraClient, String, Exception>) CassandraClient::describe_snitch); } catch (Exception e) { <START> log.warn("Failed to retrieve snitch description", e); <END> throw new RuntimeException(e); } }</code><technical_language>avoid log.warn, throwing exception</technical_language>

Target:
private String getSnitch() { try { return getRandomGoodHost().runWithPooledResource( (FunctionCheckedException<CassandraClient, String, Exception>) CassandraClient::describe_snitch); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public void setProjects(Map<String,Project> projects) { <START> this.projects = (HashMap<String, Project>) projects; <END> }</code><technical_language>if do [here](<LINK_0> this cast is necessary</technical_language>

Target:
public void setProjects(Map<String,Project> projects) { this.projects = projects; }
Source:
<code>private void dropItem(TravelingItem item) { PipeEventItem.DropItem event = new PipeEventItem.DropItem(item, item.toEntityItem()); container.pipe.handlePipeEvent(event); <START> if (container.getWorldObj().isRemote) { <END> return; } if (travelHook != null) { travelHook.drop(this, item); } if (event.entity == null) { return; } final EntityItem entity = event.entity; ForgeDirection direction = item.input; entity.setPosition(entity.posX + direction.offsetX * 0.5d, entity.posY + direction.offsetY * 0.5d, entity.posZ + direction.offsetZ * 0.5d); entity.motionX = direction.offsetX * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; entity.motionY = direction.offsetY * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; entity.motionZ = direction.offsetZ * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; container.getWorldObj().spawnEntityInWorld(entity); }</code><technical_language>This wrong me. source of of identified bugs. This change cancelled</technical_language>

Target:
private void dropItem(TravelingItem item) { if (container.getWorldObj().isRemote) { return; } PipeEventItem.DropItem event = new PipeEventItem.DropItem(item, item.toEntityItem()); container.pipe.handlePipeEvent(event); if (event.entity == null) { return; } final EntityItem entity = event.entity; ForgeDirection direction = item.input; entity.setPosition(entity.posX + direction.offsetX * 0.5d, entity.posY + direction.offsetY * 0.5d, entity.posZ + direction.offsetZ * 0.5d); entity.motionX = direction.offsetX * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; entity.motionY = direction.offsetY * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; entity.motionZ = direction.offsetZ * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; container.getWorldObj().spawnEntityInWorld(entity); }
Source:
<code>public JdbcSinkConfig(Map<?, ?> props) { super(CONFIG_DEF, props); <START> connectorName = ConfigUtils.connectorName(this); <END> connectionUrl = getString(CONNECTION_URL); connectionUser = getString(CONNECTION_USER); connectionPassword = getPasswordValue(CONNECTION_PASSWORD); tableNameFormat = getString(TABLE_NAME_FORMAT).trim(); batchSize = getInt(BATCH_SIZE); deleteEnabled = getBoolean(DELETE_ENABLED); maxRetries = getInt(MAX_RETRIES); retryBackoffMs = getInt(RETRY_BACKOFF_MS); autoCreate = getBoolean(AUTO_CREATE); autoEvolve = getBoolean(AUTO_EVOLVE); insertMode = InsertMode.valueOf(getString(INSERT_MODE).toUpperCase()); pkMode = PrimaryKeyMode.valueOf(getString(PK_MODE).toUpperCase()); pkFields = getList(PK_FIELDS); dialectName = getString(DIALECT_NAME_CONFIG); fieldsWhitelist = new HashSet<>(getList(FIELDS_WHITELIST)); String dbTimeZone = getString(DB_TIMEZONE_CONFIG); timeZone = TimeZone.getTimeZone(ZoneId.of(dbTimeZone)); if (deleteEnabled && pkMode != PrimaryKeyMode.RECORD_KEY) { throw new ConfigException( "Primary key mode must be 'record_key' when delete support is enabled"); } tableTypes = TableType.parse(getList(TABLE_TYPES_CONFIG)); }</code><technical_language>This leaks this constructor is complete, in general this is unsafe. I extra class is worth adding for a single call-site</technical_language>

Target:
public JdbcSinkConfig(Map<?, ?> props) { super(CONFIG_DEF, props); connectorName = ConfigUtils.connectorName(props); connectionUrl = getString(CONNECTION_URL); connectionUser = getString(CONNECTION_USER); connectionPassword = getPasswordValue(CONNECTION_PASSWORD); tableNameFormat = getString(TABLE_NAME_FORMAT).trim(); batchSize = getInt(BATCH_SIZE); deleteEnabled = getBoolean(DELETE_ENABLED); maxRetries = getInt(MAX_RETRIES); retryBackoffMs = getInt(RETRY_BACKOFF_MS); autoCreate = getBoolean(AUTO_CREATE); autoEvolve = getBoolean(AUTO_EVOLVE); insertMode = InsertMode.valueOf(getString(INSERT_MODE).toUpperCase()); pkMode = PrimaryKeyMode.valueOf(getString(PK_MODE).toUpperCase()); pkFields = getList(PK_FIELDS); dialectName = getString(DIALECT_NAME_CONFIG); fieldsWhitelist = new HashSet<>(getList(FIELDS_WHITELIST)); String dbTimeZone = getString(DB_TIMEZONE_CONFIG); timeZone = TimeZone.getTimeZone(ZoneId.of(dbTimeZone)); if (deleteEnabled && pkMode != PrimaryKeyMode.RECORD_KEY) { throw new ConfigException( "Primary key mode must be 'record_key' when delete support is enabled"); } tableTypes = TableType.parse(getList(TABLE_TYPES_CONFIG)); }
Source:
<code>private MemorySchemaRegistryTuple loadSchema(String name, String id) { final Schema schema; InputStream is = this.getClass().getResourceAsStream(AVRO_SCHEMA_REPO_DEFAULT_PATH + "/" + name + "/" + id + ".avsc"); <START> try { <END> if( is == null ) { is = this.getClass().getResourceAsStream(AVRO_SCHEMA_REPO_DEFAULT_PATH + "/" + name + "/" + id + ".avpr"); if (is == null) { throw new RuntimeException("Unknown schema:" + name + " with rev_id:" + id); } Protocol protocol = Protocol.parse(is); schema = protocol.getType(SCHEMA_NAMESPACE + '.' + name); } else { Schema.Parser parser = new Schema.Parser(); schema = parser.parse(is); if (schema == null) { throw new RuntimeException("Schema not contained in parsed protocol:" + name + " with rev_id:" + id + " "); } } } catch (IOException e) { throw new RuntimeException("Cannot parser schema:" + name + " with rev_id:" + id + " ", e); } MemorySchemaRegistryTuple tuple = new MemorySchemaRegistryTuple(schema, Long.parseLong(id)); return tuple; }</code><technical_language>logic of "get schema", if exists throw exception is duplicated here. I is fine refactoring this a factor-ish pattern a bit overkill. ood namespace is important in avro a protocol based schema. tested do need it</technical_language>

Target:
private MemorySchemaRegistryTuple loadSchema(String name, String id) { final Schema schema; final String prefix = AVRO_SCHEMA_REPO_DEFAULT_PATH + "/" + name + "/" + id; InputStream is = this.getClass().getResourceAsStream(prefix + ".avsc"); try { if( is == null ) { is = this.getClass().getResourceAsStream(prefix + ".avpr"); if (is == null) { throw new RuntimeException("Unknown schema:" + name + " with rev_id:" + id); } Protocol protocol = Protocol.parse(is); schema = protocol.getType(SCHEMA_NAMESPACE + '.' + name); if (schema == null) { throw new RuntimeException("Schema not contained in parsed protocol:" + name + " with rev_id:" + id + " "); } } else { Schema.Parser parser = new Schema.Parser(); schema = parser.parse(is); } } catch (IOException e) { throw new RuntimeException("Cannot parser schema:" + name + " with rev_id:" + id + " ", e); } MemorySchemaRegistryTuple tuple = new MemorySchemaRegistryTuple(schema, Long.parseLong(id)); return tuple; }
Source:
<code>private TreeSet<Entry<String, Path>> jarsFirstSortedPluginsSet( Map<String, Path> activePlugins) { <START> final PathMatcher <END> jarMatcher = FileSystems.getDefault().getPathMatcher("glob:*.jar"); TreeSet<Entry<String, Path>> sortedPlugins = Sets.newTreeSet(new Comparator<Entry<String, Path>>() { @Override public int compare(Entry<String, Path> e1, Entry<String, Path> e2) { Path n1 = e1.getValue().getFileName(); Path n2 = e2.getValue().getFileName(); return ComparisonChain.start() .compareTrueFirst(jarMatcher.matches(n1), jarMatcher.matches(n2)) .compare(n1, n2) .result(); } }); addAllEntries(activePlugins, sortedPlugins); return sortedPlugins; }</code><technical_language>nit: finals in new code</technical_language>

Target:
private TreeSet<Entry<String, Path>> jarsFirstSortedPluginsSet( Map<String, Path> activePlugins) { TreeSet<Entry<String, Path>> sortedPlugins = Sets.newTreeSet(new Comparator<Entry<String, Path>>() { PathMatcher jarMatcher = FileSystems.getDefault() .getPathMatcher("glob:*.jar"); @Override public int compare(Entry<String, Path> e1, Entry<String, Path> e2) { Path n1 = e1.getValue().getFileName(); Path n2 = e2.getValue().getFileName(); return ComparisonChain.start() .compareTrueFirst(jarMatcher.matches(n1), jarMatcher.matches(n2)) .compare(n1, n2) .result(); } }); addAllEntries(activePlugins, sortedPlugins); return sortedPlugins; }
Source:
<code>public BoBIQ parse(XmlPullParser parser, int initialDepth) throws Exception { BoBHash bobHash = null; BoBData bobData = null; parser.next(); if (parser.getName().equals(BoBIQ.ELEMENT)) { String cid = parser.getAttributeValue("", "cid"); bobHash = BoBHash.fromCid(cid); String dataType = parser.getAttributeValue("", "type"); String maxAgeString = parser.getAttributeValue("", "max-age"); long maxAge = 0; if (maxAgeString != null) { maxAge = Long.parseLong(maxAgeString); } String data = null; try { <START> data = parser.nextText(); <END> } catch (Exception e) { } if (data != null && dataType != null) { bobData = new BoBData(maxAge, dataType, data.getBytes()); } } return new BoBIQ(bobHash, bobData); }</code><technical_language>Consider renaming data base64EncodedData, base64 encoded representation of a byte array</technical_language>

Target:
public BoBIQ parse(XmlPullParser parser, int initialDepth) throws Exception { BoBHash bobHash = null; BoBData bobData = null; parser.next(); if (parser.getName().equals(BoBIQ.ELEMENT)) { String cid = parser.getAttributeValue("", "cid"); bobHash = BoBHash.fromCid(cid); String dataType = parser.getAttributeValue("", "type"); String maxAgeString = parser.getAttributeValue("", "max-age"); long maxAge = 0; if (maxAgeString != null) { maxAge = Long.parseLong(maxAgeString); } String base64EncodedData = null; try { base64EncodedData = parser.nextText(); } catch (Exception e) { } if (base64EncodedData != null && dataType != null) { byte[] base64EncodedDataBytes = base64EncodedData.getBytes(); bobData = new BoBData(maxAge, dataType, Base64.decode(base64EncodedDataBytes)); } } return new BoBIQ(bobHash, bobData); }
Source:
<code>private static void setup() { BeanUtilsBean.setInstance(new BeanUtilsBean(new ConvertUtilsBean() { { register(true, false, 0); register(TO_UUID_CONVERTER, UUID.class); register(EPOCH_TO_DATE_CONVERTER, Date.class); } @Override public Converter lookup(Class<?> sourceType, Class<?> targetType) { if (targetType.isEnum()) { return TO_ENUM_CONVERTER; } else if (Map.class.isAssignableFrom(sourceType)) { return FROM_MAP_CONVERTER; } else if ((String.class.isAssignableFrom(sourceType) || Number.class.isAssignableFrom(sourceType)) <START> && ClassUtils.isAssignable(targetType, Date.class) <END> && super.lookup(Date.class).equals(EPOCH_TO_DATE_CONVERTER)) { return EPOCH_TO_DATE_CONVERTER; } else { return super.lookup(sourceType, targetType); } } })); }</code><technical_language>able handle this in lookup. lookup map keyed a '(source, target)' tuple (null target imply a default mapping)? This smart user define mapping 'String -> Date' (ideally) 'X -> Y'. This a larger refactor for in here, about</technical_language>

Target:
private static void setup() { BeanUtilsBean.setInstance(new BeanUtilsBean(new BidirectionalConvertUtilBean() { { register(true, false, 0); register(TO_UUID_CONVERTER, UUID.class); } @Override public Converter lookup(Class<?> sourceType, Class<?> targetType) { if (targetType.isEnum()) { return TO_ENUM_CONVERTER; } else if (Map.class.isAssignableFrom(sourceType)) { return FROM_MAP_CONVERTER; } else { return super.lookup(sourceType, targetType); } } })); }
Source:
<code>private boolean validateLine(byte[] line, int lineStart, int lineEnd) <START> { <END> for (; lineStart < lineEnd; lineStart++) if ((line[lineStart] & 128) > 0) { int utf8Index = lineStart++; int utf8Bit = 64; if ((line[utf8Index] & utf8Bit) == 0) return false; for (; (lineStart - utf8Index) < 4 && (line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) > 0 && (line[lineStart] & 64) == 0 ; lineStart++, utf8Bit >>= 1); utf8Bit <<= 1; lineStart--; if ((lineStart - utf8Index) == 0) return false; if ((line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) == 0) return false; } return true; }</code><technical_language>nit: put this previous line</technical_language>

Target:
private boolean validateLine(byte[] line, int lineStart, int lineEnd) { for (; lineStart < lineEnd; lineStart++) if ((line[lineStart] & 128) > 0) { int utf8Index = lineStart++; int utf8Bit = 64; if ((line[utf8Index] & utf8Bit) == 0) return false; for (; (lineStart - utf8Index) < 4 && (line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) > 0 && (line[lineStart] & 64) == 0 ; lineStart++, utf8Bit >>= 1); utf8Bit <<= 1; lineStart--; if ((lineStart - utf8Index) == 0) { return false; } if ((line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) == 0) return false; } return true; }
Source:
<code>public void run(Configuration config, final Environment env) throws Exception { env.jersey().register(new TestEchoResource()); ServerTracer serverTracer = ServerTracer.builder() .traceSampler(Sampler.ALWAYS_SAMPLE) .randomGenerator(new Random()) <START> .state(new ThreadLocalServerClientAndLocalSpanState(0, 1, "server")) <END> .spanCollector(new LoggingSpanCollector()) .build(); env.jersey().register(new BraveContainerRequestFilter( new ServerRequestInterceptor(serverTracer), new DefaultSpanNameProvider() )); env.jersey().register(new BraveContainerResponseFilter( new ServerResponseInterceptor(serverTracer) )); }</code><technical_language>kind of curious magic numbers</technical_language>

Target:
public void run(Configuration config, final Environment env) throws Exception { env.jersey().register(new TestEchoResource()); }
Source:
<code>private static void connect(final Client client, String servers) throws InterruptedException { <START> System.out.println("Connecting to VoltDB..."); <END> String[] serverArray = servers.split(","); final CountDownLatch connections = new CountDownLatch(serverArray.length); for (final String server : serverArray) { new Thread(new Runnable() { @Override public void run() { connectToOneServerWithRetry(client, server); connections.countDown(); } }).start(); } connections.await(); }</code><technical_language>a logging framework instead of System.out/System.err? slf4j if another preference</technical_language>

Target:
private static void connect(final Client client, String servers) throws InterruptedException { Logger logger = LoggerFactory.getLogger(ConnectionHelper.class); logger.info("Connecting to VoltDB..."); String[] serverArray = servers.split(","); final CountDownLatch connections = new CountDownLatch(serverArray.length); for (final String server : serverArray) { new Thread(new Runnable() { @Override public void run() { connectToOneServerWithRetry(client, server); connections.countDown(); } }).start(); } connections.await(); }
Source:
<code>public int getStateTableIndex(ITimeEvent event) { if (event instanceof NullTimeEvent) { return INVISIBLE; } if(event instanceof TimeEvent) { ITimeGraphState model = ((TimeEvent) event).getStateModel(); <START> OutputElementStyle eventStyle = model.getStyle(); <END> if(eventStyle != null) { String styleKey = eventStyle.getParentKey(); if(styleKey != null) { Integer index = fLabelToIndex.get(styleKey); return index != null ? index: TRANSPARENT; } } } return TRANSPARENT; }</code><technical_language>If event a style, try default style entry. This for entries want a specific style for gaps</technical_language>

Target:
public int getStateTableIndex(ITimeEvent event) { if (event instanceof NullTimeEvent) { return INVISIBLE; } if (event instanceof TimeEvent) { ITimeGraphState model = ((TimeEvent) event).getStateModel(); OutputElementStyle eventStyle = model.getStyle(); if (eventStyle == null && event.getEntry() instanceof TimeGraphEntry) { eventStyle = ((TimeGraphEntry) event.getEntry()).getEntryModel().getStyle(); } if (eventStyle != null) { String styleKey = eventStyle.getParentKey(); if (styleKey != null) { Integer index = fLabelToIndex.get(styleKey); return index != null ? index : Integer.MAX_VALUE; } } } return TRANSPARENT; }
Source:
<code>public Map<ConfigKey<?>,Object> getLocalConfig() { <START> Map<ConfigKey<?>,Object> result = new LinkedHashMap<ConfigKey<?>,Object>(inheritedConfig.size()+ownConfig.size()); <END> result.putAll(ownConfig); return Collections.unmodifiableMap(result); }</code><technical_language>Initial size ownConfig.size() +inheritedConfig.size(). create copy return Collections.unmodifiableMap(Maps.newLinkedHashMap(ownConfig))</technical_language>

Target:
public Map<ConfigKey<?>,Object> getLocalConfig() { Map<ConfigKey<?>,Object> result = new LinkedHashMap<ConfigKey<?>,Object>(ownConfig.size()); result.putAll(ownConfig); return Collections.unmodifiableMap(result); }
Source:
<code>public static Timeline create(@JsonProperty("score") final Integer score, @JsonProperty("message") final String message, @JsonProperty("date") final String date, @JsonProperty("segments") final List<SleepSegment> events, @JsonProperty("insights") final List<Insight> insights, @JsonProperty("statistics") final SleepStats sleepStats, @JsonProperty("locked_down") final boolean lockedDown) { return new Timeline(score, message, date, Lists.newArrayList(Period.NIGHT), events, insights, <START> (sleepStats == null || sleepStats.isFromNull()) ? null : sleepStats, lockedDown); <END> }</code><technical_language>for readability, assign (sleepStats == null || sleepStats.isFromNull()) ? null : sleepStats a variable pass constructor</technical_language>

Target:
public static Timeline create(@JsonProperty("score") final Integer score, @JsonProperty("message") final String message, @JsonProperty("date") final String date, @JsonProperty("segments") final List<SleepSegment> events, @JsonProperty("insights") final List<Insight> insights, @JsonProperty("statistics") final SleepStats sleepStats, @JsonProperty("locked_down") final boolean lockedDown) { final SleepStats timelineSleepStats; if (sleepStats.isFromNull()){ timelineSleepStats = null; } else{ timelineSleepStats = sleepStats; } return new Timeline(score, message, date, Lists.newArrayList(Period.NIGHT), events, insights, timelineSleepStats, lockedDown); }
Source:
<code>public CompletableFuture<ArchivedExecutionGraph> requestJob(Time timeout) { synchronized (lock) { if (isInitialized()) { if (jobResultFuture.isDone()) { return jobResultFuture; } return getJobMasterGateway().thenCompose(jobMasterGateway -> jobMasterGateway.requestJob( timeout)); } else { Preconditions.checkState(jobStatus == DispatcherJobStatus.INITIALIZING || jobStatus == DispatcherJobStatus.CANCELLING); <START> return CompletableFuture.supplyAsync(() -> { synchronized (lock) { return ArchivedExecutionGraph.createFromInitializingJob( jobId, jobName, jobStatus.asJobStatus(), null, initializationTimestamp); } }); <END> } } }</code><technical_language>supplyAsync here? createFromInitializingJob non-blocking</technical_language>

Target:
public CompletableFuture<ArchivedExecutionGraph> requestJob(Time timeout) { synchronized (lock) { if (isInitialized()) { if (jobResultFuture.isDone()) { return jobResultFuture.thenApply(DispatcherJobResult::getArchivedExecutionGraph); } return getJobMasterGateway().thenCompose(jobMasterGateway -> jobMasterGateway.requestJob( timeout)); } else { Preconditions.checkState(this.jobStatus == DispatcherJobStatus.INITIALIZING || jobStatus == DispatcherJobStatus.CANCELLING); return CompletableFuture.completedFuture( ArchivedExecutionGraph.createFromInitializingJob( jobId, jobName, jobStatus.asJobStatus(), null, initializationTimestamp)); } } }