auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public StudentProfileAttributes() { <END> this.googleId = ""; this.shortName = ""; this.email = ""; this.institute = ""; this.nationality = ""; this.gender = "other"; this.moreInfo = ""; this.pictureKey = ""; this.modifiedDate = null; }</code><technical_language>this private, is another case for default attribute builder's call</technical_language>

Target:
StudentProfileAttributes() { this.googleId = ""; this.shortName = ""; this.email = ""; this.institute = ""; this.nationality = ""; this.gender = "other"; this.moreInfo = ""; this.pictureKey = ""; this.modifiedDate = new Date(); }
Source:
<code>private List<SqlStageExecution> getStagesReadyForExecution() { long runningPlanSections = stream(forTree(StreamingPlanSection::getChildren).depthFirstPreOrder(sectionedPlan)) <START> .filter(section -> { <END> StageState state = getStageExecution(section.getPlan().getFragment().getId()).getState(); return !state.isDone() && state != PLANNED; }) .count(); return stream(forTree(StreamingPlanSection::getChildren).depthFirstPreOrder(sectionedPlan)) .filter(this::isReadyForExecution) .limit(getMaxConcurrentMaterializations(session) - runningPlanSections) .flatMap(section -> stream(forTree(StreamingSubPlan::getChildren).depthFirstPreOrder(section.getPlan()))) .map(StreamingSubPlan::getFragment) .map(PlanFragment::getId) .map(this::getStageExecution) .collect(toImmutableList()); }</code><technical_language>map get StageState, do filter. ... .map(section -> getStageExecution(section.getPlan().getFragment().getId()).getState()) .filter(state -> !state.isDone() && state != PLANNED) .count()</technical_language>

Target:
private List<SqlStageExecution> getStagesReadyForExecution() { long runningPlanSections = stream(forTree(StreamingPlanSection::getChildren).depthFirstPreOrder(sectionedPlan)) .map(section -> getStageExecution(section.getPlan().getFragment().getId()).getState()) .filter(state -> !state.isDone() && state != PLANNED) .count(); return stream(forTree(StreamingPlanSection::getChildren).depthFirstPreOrder(sectionedPlan)) .filter(this::isReadyForExecution) .limit(maxConcurrentMaterializations - runningPlanSections) .flatMap(section -> stream(forTree(StreamingSubPlan::getChildren).depthFirstPreOrder(section.getPlan()))) .map(StreamingSubPlan::getFragment) .map(PlanFragment::getId) .map(this::getStageExecution) .collect(toImmutableList()); }
Source:
<code>public void postCommit() { switch (state()) { case RESTORING: case RUNNING: case SUSPENDED: commitRequested = false; commitNeeded = false; if (state() == State.RESTORING) { writeCheckpointIfNeed(); <START> } else if (!eosEnabled) { END> writeCheckpointIfNeed(); } if (state() == State.SUSPENDED) { partitionGroup.clear(); } log.debug("Committed"); break; case CREATED: case CLOSED: throw new IllegalStateException("Illegal state " + state() + " while post committing active task " + id); default: throw new IllegalStateException("Unknown state " + state() + " while post committing active task " + id); } }</code><technical_language>applied RUNNING SUSPENDED</technical_language>

Target:
public void postCommit() { commitRequested = false; commitNeeded = false; switch (state()) { case RESTORING: writeCheckpointIfNeed(); break; case RUNNING: if (!eosEnabled) { writeCheckpointIfNeed(); } break; case SUSPENDED: writeCheckpointIfNeed(); partitionGroup.clear(); break; case CREATED: case CLOSED: throw new IllegalStateException("Illegal state " + state() + " while post committing active task " + id); default: throw new IllegalStateException("Unknown state " + state() + " while post committing active task " + id); } log.debug("Committed"); }
Source:
<code>public User addUser(User user) { <START> user = userRepository.saveAndFlush(user); <END> return user; }</code><technical_language>do assing parameter! nowhere</technical_language>

Target:
public User addUser(User user) { return userRepository.saveAndFlush(user); }
Source:
<code>public void listWithMultipleLabels() { String key = getKey(); String label = getLabel(); String label2 = getLabel(); listWithMultipleLabelsRunner(key, label, label2, (setting, setting2) -> { <START> logger.info("$$$$ listWithMultipleLabels adding setting"); <END> assertConfigurationEquals(setting, client.addSetting(setting)); assertConfigurationEquals(setting2, client.addSetting(setting2)); logger.info("$$$$ listWithMultipleLabels listSettings"); return client.listSettings(new SettingSelector().keys(key).labels(label, label2)); }); }</code><technical_language>Do need logs</technical_language>

Target:
public void listWithMultipleLabels() { String key = getKey(); String label = getLabel(); String label2 = getLabel(); listWithMultipleLabelsRunner(key, label, label2, (setting, setting2) -> { assertConfigurationEquals(setting, client.addSetting(setting)); assertConfigurationEquals(setting2, client.addSetting(setting2)); return client.listSettings(new SettingSelector().keys(key).labels(label, label2)); }); }
Source:
<code>private synchronized void connected(ClientConnection conn) { conn.setCurrentRequest(this); this.conn = conn; if (pendingMaxSize != -1) { conn.doSetWriteQueueMaxSize(pendingMaxSize); } if (pendingChunks != null) { ByteBuf pending = pendingChunks; pendingChunks = null; if (completed) { writeHeadWithContent(pending, true); <START> conn.metrics.bytesWritten(conn.remoteAddress(), written); <END> conn.endRequest(); } else { writeHeadWithContent(pending, false); } } else { if (completed) { writeHeadWithContent(Unpooled.EMPTY_BUFFER, true); conn.metrics.bytesWritten(conn.remoteAddress(), written); conn.endRequest(); } else { if (writeHead) { writeHead(); } } } }</code><technical_language>invoking conn.remoteAddress() costly</technical_language>

Target:
private synchronized void connected(ClientConnection conn) { conn.setCurrentRequest(this); this.conn = conn; if (pendingMaxSize != -1) { conn.doSetWriteQueueMaxSize(pendingMaxSize); } if (pendingChunks != null) { ByteBuf pending = pendingChunks; pendingChunks = null; if (completed) { writeHeadWithContent(pending, true); if (conn.metrics.isEnabled()) conn.metrics.bytesWritten(conn.remoteAddress(), written); conn.endRequest(); } else { writeHeadWithContent(pending, false); } } else { if (completed) { writeHeadWithContent(Unpooled.EMPTY_BUFFER, true); if (conn.metrics.isEnabled()) conn.metrics.bytesWritten(conn.remoteAddress(), written); conn.endRequest(); } else { if (writeHead) { writeHead(); } } } }
Source:
<code>protected boolean hasTextTransform(CSSValue value) { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value; String textTransform = primitiveValue.getStringValue(); <START> if ("capitalize".equals(textTransform)) { <END> return true; } if ("uppercase".equals(textTransform)) { return true; } if ("lowercase".equals(textTransform)) { return true; } } return false; }</code><technical_language>switch</technical_language>

Target:
protected boolean hasTextTransform(CSSValue value) { if (value.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE || ((CSSPrimitiveValue) value).getStringValue() == null) { return false; } String textTransform = ((CSSPrimitiveValue) value).getStringValue(); switch (textTransform) { case "capitalize": case "uppercase": case "lowercase": return true; } return false; }
Source:
<code>public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException { TracingTags.WORKSPACE_ID.set(identity::getWorkspaceId); StringBuilder sshConfig = new StringBuilder(); Map<String, String> map = new HashMap<>(); try { List<SshPairImpl> sshPairs = sshManager.getPairs(identity.getOwnerId(), "vcs"); if (!sshPairs.isEmpty()) { for (SshPair sshPair : sshPairs) { if (isNullOrEmpty(sshPair.getName()) || isNullOrEmpty(sshPair.getPrivateKey())) { continue; } Secret secret = new SecretBuilder() .addToData( SSH_PRIVATE_KEY, Base64.getEncoder().encodeToString(sshPair.getPrivateKey().getBytes())) .withType(SECRET_TYPE_SSH) .withNewMetadata() .withName(getValidNameForSecret(sshPair.getName())) .endMetadata() .build(); k8sEnv.getSecrets().put(secret.getMetadata().getName(), secret); <START> if (!sshPairs.isEmpty()) { <END> k8sEnv .getPodsData() .values() .forEach(p -> addSshKeySecret(secret.getMetadata().getName(), p.getSpec())); } sshConfig.append(buildConfig(sshPair.getName())); } map.put(SSH_CONFIG, sshConfig.toString()); ConfigMap configMap = new ConfigMapBuilder() .withNewMetadata() .withName("sshconfigmap") .endMetadata() .withData(map) .build(); k8sEnv.getConfigMaps().put(configMap.getMetadata().getName(), configMap); k8sEnv.getPodsData().values().forEach(p -> addConfigFile(p.getSpec())); } } catch (ServerException e) { LOG.warn("Unable get SSH Keys ", e); } }</code><technical_language>This check redundant for me, checked this in line 96</technical_language>

Target:
public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException { TracingTags.WORKSPACE_ID.set(identity::getWorkspaceId); try { List<SshPairImpl> sshPairs = sshManager.getPairs(identity.getOwnerId(), "vcs"); if (sshPairs.isEmpty()) { return; } StringBuilder sshConfigData = new StringBuilder(); for (SshPair sshPair : sshPairs) { doProvisionSshKey(sshPair, k8sEnv); sshConfigData.append(buildConfig(sshPair.getName())); } doProvisionSshConfig(sshConfigData.toString(), k8sEnv); } catch (ServerException e) { LOG.warn("Unable get SSH Keys. Cause: %s", e.getMessage(), e); } }
Source:
<code>synchronized void retry() { try (final TraceScope retryScope = Trace.startSpan(String.format("pull_retry." + <START> " key: %s, request_id: %d, retry_count: %d", encodedKey.getKey(), requestId, retryCount + 1), <END> pullRequestScope.getSpan())) { if (retryCount++ >= MAX_PULL_RETRY_COUNT) { throw new RuntimeException("Fail to load a value for pull"); } LOG.log(Level.WARNING, "Retry pull request for key {0}. This is {1}-th retry", new Object[]{encodedKey.getKey(), retryCount}); final int numSentBytes = sendPullMsg(encodedKey, requestId, TraceInfo.fromSpan(retryScope.getSpan())); workerThread.sentBytesStat.put(numSentBytes); state = INIT_STATE; } }</code><technical_language>Nit: needed</technical_language>

Target:
synchronized void retry() { try (final TraceScope retryScope = Trace.startSpan("pull_retry.", pullRequestScope.getSpan())) { if (retryCount++ >= MAX_PULL_RETRY_COUNT) { throw new RuntimeException("Fail to load a value for pull"); } LOG.log(Level.WARNING, "Retry pull request for key {0}. This is {1}-th retry", new Object[]{encodedKey.getKey(), retryCount}); final int numSentBytes = sendPullMsg(encodedKey, requestId, TraceInfo.fromSpan(retryScope.getSpan())); workerThread.sentBytesStat.put(numSentBytes); state = INIT_STATE; } }
Source:
<code><START> public void validate() { <END> if (feedbackSessionName != null) { assertTrue(sectionName != null, "session must comes with a section"); } }</code><technical_language>I validate hierarchy here. 1. If section == null && session == null, general privileges present. 2. If xxx xxx ..</technical_language>

Target:
public void validate() { if (feedbackSessionName != null) { assertTrue(sectionName != null, "session must comes with a section"); } if (sectionName != null) { boolean isNoneCourseLevelPrivilegesPresent = this.canModifyCourse == null && this.canModifySession == null && this.canModifyStudent == null && this.canModifyInstructor == null; assertTrue(isNoneCourseLevelPrivilegesPresent, "only section and session level privileges."); if (feedbackSessionName != null) { boolean isNoneSectionLevelPrivilegePresent = this.canViewStudentInSections == null; assertTrue(isNoneSectionLevelPrivilegePresent, "only session level privileges."); } } boolean isAnyPrivilegesToUpdate = this.canModifyCourse != null || this.canModifyStudent != null || this.canModifyInstructor != null || this.canModifySession != null || this.canViewStudentInSections != null || this.canSubmitSessionInSections != null || this.canViewSessionInSections != null || this.canModifySessionCommentsInSections != null; assertTrue(isAnyPrivilegesToUpdate, "should have at least one privileges present to update"); }
Source:
<code>public Iterator<Map.Entry<UK, UV>> iterator() { Map<UK, UV> userMap = stateTable.get(currentNamespace); <START> return userMap == null ? Collections.<UK, UV>emptyMap().entrySet().iterator() : userMap.entrySet().iterator(); <END> }</code><technical_language>Besides walking in NullAwareMapIterator, I a discussion is worthwhile launched a [thread](<LINK_0> discuss this. Hope a look</technical_language>

Target:
public Iterator<Map.Entry<UK, UV>> iterator() { Map<UK, UV> userMap = stateTable.get(currentNamespace); return userMap == null ? null : userMap.entrySet().iterator(); }
Source:
<code>protected int computeNewLength(int[] dimValSelector, int numProcessed, int numToProcess) { int valid = 0; int length = 0; for (int i = numProcessed; i < dimValSelector.length; i++) { length++; if (SKIP_POSITION_VALUE != dimValSelector[i]) { valid++; } <START> if (valid == numToProcess) { <END> break; } } return length; }</code><technical_language>this condition incorporated for loop</technical_language>

Target:
protected int computeNewLength(int[] dimValSelector, int numProcessed, int numToProcess) { int valid = 0; int length = 0; for (int i = numProcessed; i < dimValSelector.length && valid < numToProcess; i++) { length++; if (SKIP_POSITION_VALUE != dimValSelector[i]) { valid++; } } return length; }
Source:
<code>public Boolean call() throws Exception { mergeabilityCheckQueue.updatingMergeabilityFlag(change, force); RequestContext context = new RequestContext() { @Override public CurrentUser getCurrentUser() { return identifiedUserFactory.create(change.getOwner()); } @Override public Provider<ReviewDb> getReviewDbProvider() { return new Provider<ReviewDb>() { @Override public ReviewDb get() { if (reviewDb == null) { try { reviewDb = schemaFactory.open(); } catch (OrmException e) { throw new ProvisionException("Cannot open ReviewDb", e); } } return reviewDb; } }; } }; RequestContext old = tl.setContext(context); ReviewDb db = context.getReviewDbProvider().get(); try { PatchSet ps = db.patchSets().get(change.currentPatchSetId()); Mergeable m = mergeable.get(); m.setForce(force); ChangeControl control = changeControlFactory.controlFor(change.getId(), identifiedUserFactory.create(change.getOwner())); MergeableInfo info = m.apply( <START> new RevisionResource(new ChangeResource(control), ps)); <END> return change.isMergeable() != info.mergeable; } catch (ResourceConflictException e) { return false; } finally { tl.setContext(old); if (reviewDb != null) { reviewDb.close(); reviewDb = null; } } }</code><technical_language>For reference: this originally changed in Ia7c9761e. This is ok a) is a case need pass a manual control, i.e. for change owner implicit user, b) notes stored control well</technical_language>

Target:
public Boolean call() throws Exception { mergeabilityCheckQueue.updatingMergeabilityFlag(change, force); RequestContext context = new RequestContext() { @Override public CurrentUser getCurrentUser() { return identifiedUserFactory.create(change.getOwner()); } @Override public Provider<ReviewDb> getReviewDbProvider() { return new Provider<ReviewDb>() { @Override public ReviewDb get() { if (reviewDb == null) { try { reviewDb = schemaFactory.open(); } catch (OrmException e) { throw new ProvisionException("Cannot open ReviewDb", e); } } return reviewDb; } }; } }; RequestContext old = tl.setContext(context); ReviewDb db = context.getReviewDbProvider().get(); try { PatchSet ps = db.patchSets().get(change.currentPatchSetId()); Mergeable m = mergeable.get(); m.setForce(force); ChangeControl control = changeControlFactory.controlFor(change.getId(), context.getCurrentUser()); MergeableInfo info = m.apply( new RevisionResource(new ChangeResource(control), ps)); return change.isMergeable() != info.mergeable; } catch (ResourceConflictException e) { return false; } finally { tl.setContext(old); if (reviewDb != null) { reviewDb.close(); reviewDb = null; } } }
Source:
<code>public void execute(ScriptEntry scriptEntry) { EntityTag source = scriptEntry.getObjectTag("source"); List<MythicMobsMobTag> targets = (List<MythicMobsMobTag>) scriptEntry.getObject("targets"); ElementTag signal = scriptEntry.getElement("signal"); <START> Debug.report(scriptEntry, getName(),ArgumentHelper.debugList("mythicmobs", targets) <END> + signal.debug() + (source == null ? "" : source.debug())); for (MythicMobsMobTag mob : targets) { mob.getMob().signalMob((source == null ? null : BukkitAdapter.adapt(source.getBukkitEntity())), signal.asString()); } }</code><technical_language>if (scriptEntry.dbCallShouldDebug()) { single command in of Denizen Also, this line is missing a space a comma</technical_language>

Target:
public void execute(ScriptEntry scriptEntry) { EntityTag source = scriptEntry.getObjectTag("source"); List<MythicMobsMobTag> targets = (List<MythicMobsMobTag>) scriptEntry.getObject("targets"); ElementTag signal = scriptEntry.getElement("signal"); if (scriptEntry.dbCallShouldDebug()) { Debug.report(scriptEntry, getName(), ArgumentHelper.debugList("mythicmobs", targets) + signal.debug() + (source == null ? "" : source.debug())); } for (MythicMobsMobTag mob : targets) { mob.getMob().signalMob(source == null ? null : BukkitAdapter.adapt(source.getBukkitEntity()), signal.asString()); } }
Source:
<code><START> protected boolean check() { return true; } <END></code><technical_language>Check for existence of file delete</technical_language>

Target:
protected boolean check() { return file.exists(context); }
Source:
<code>public static void main(String[] args) throws Exception { Map<String, Object> cl = CLI.opt("w", "wait", null, CLI.AS_INT) .boolOpt("i", "ignore-errors") .arg("TOPO", CLI.INTO_LIST) .parse(args); @SuppressWarnings("unchecked") final List<String> names = (List<String>) cl.get("TOPO"); Integer wait = (Integer) cl.get("w"); <START> Boolean continueOnError = (Boolean) cl.get("i"); <END> final KillOptions opts = new KillOptions(); if (wait != null) { opts.set_wait_secs(wait); } NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception { int errorCount = 0; for (String name : names) { try { nimbus.killTopologyWithOpts(name, opts); LOG.info("Killed topology: {}", name); } catch (Exception e) { errorCount += 1; if (!continueOnError) { throw e; } else { LOG.info( "Caught error killing topology '{}'; continuing as -i was passed. Exception: {}", name, e.getClass().getName() ); } } } if (errorCount > 0) { throw new RuntimeException("Failed to successfully kill " + errorCount + " topologies."); } } }); }</code><technical_language>is set</technical_language>

Target:
public static void main(String[] args) throws Exception { Map<String, Object> cl = CLI.opt("w", "wait", null, CLI.AS_INT) .boolOpt("i", "ignore-errors") .arg("TOPO", CLI.INTO_LIST) .parse(args); @SuppressWarnings("unchecked") final List<String> names = (List<String>) cl.get("TOPO"); Integer wait = (Integer) cl.get("w"); Boolean continueOnError = (Boolean) cl.get("i"); final KillOptions opts = new KillOptions(); if (wait != null) { opts.set_wait_secs(wait); } NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception { int errorCount = 0; for (String name : names) { try { nimbus.killTopologyWithOpts(name, opts); LOG.info("Killed topology: {}", name); } catch (Exception e) { errorCount += 1; if (!continueOnError) { throw e; } else { LOG.error( "Caught error killing topology '{}'; continuing as -i was passed.", name, e ); } } } if (errorCount > 0) { throw new RuntimeException("Failed to successfully kill " + errorCount + " topologies."); } } }); }
Source:
<code>private void resetSelection() { if (fSelectionGroupRoot != null) { disposeSelectionGroupRoot(); } fSelectionGroupRoot = getFileSystemTree(); fSelectionGroup.setRoot(fSelectionGroupRoot); <START> if (fCreateExperimentCheckbox != null && fCreateExperimentCheckbox.getSelection()) { <END> File file = getSourceFile(); if (file != null) { IPath path = new Path(file.getAbsolutePath()); fExperimentNameText.setText(path.lastSegment()); } } }</code><technical_language>suggestion: source file name if text is currently blank. If user types in experiment name selecting source, overwrites user input. fancy overwrite if user typed in text box ;)</technical_language>

Target:
private void resetSelection() { if (fSelectionGroupRoot != null) { disposeSelectionGroupRoot(); } fSelectionGroupRoot = getFileSystemTree(); fSelectionGroup.setRoot(fSelectionGroupRoot); if (fCreateExperimentCheckbox != null) { File file = getSourceFile(); if (file != null) { String previousName = fExperimentNameText.getText().trim(); if (((fPreviousSource != null) && (previousName.equals(fPreviousSource))) || previousName.isEmpty()) { fExperimentNameText.setText(file.getName()); } fPreviousSource = file.getName(); } } }
Source:
<code>private void addMemory(int mem) { if(!isPersistent()) { throw DataUtils.newIllegalStateException( <START> DataUtils.ERROR_INTERNAL, "Memory calculation error2"); <END> } memory += mem; }</code><technical_language>message "addMemory called for persistent db"</technical_language>

Target:
private void addMemory(int mem) { memory += mem; }
Source:
<code>public String valueOfAttributeOnIn(String attribute, String place, String container) { String result; WebElement element = getElementToRetrieveValue(place, container); try { result = element.getAttribute(attribute); <START> } catch(NullPointerException e) { <END> result = null; } return result; }</code><technical_language>catch NullPointers do a check element is null get attribute</technical_language>

Target:
public String valueOfAttributeOnIn(String attribute, String place, String container) { String result = null; WebElement element = getElementToRetrieveValue(place, container); if (element != null) { result = element.getAttribute(attribute); } return result; }
Source:
<code>public void call(Object base, Method method) { Class<?>[] paramTypes = method.getParameterTypes(); java.lang.annotation.Annotation[][] parmAnnos = method.getParameterAnnotations(); Object[] params = new Object[paramTypes.length]; try { for (int i = 0; i < paramTypes.length; i++) { params[i] = resolveParameter(parmAnnos[i], paramTypes[i]); } method.setAccessible(true); method.invoke(base, params); } catch (InvocationTargetException invokEx) { Throwable c = invokEx.getCause(); if (c == null) c = invokEx; <START> _log.debug("", c); <END> throw UiException.Aide.wrap(c); } catch (Exception e) { _log.error("", e); throw UiException.Aide.wrap(e); } }</code><technical_language>OperationException</technical_language>

Target:
public void call(Object base, Method method) { Class<?>[] paramTypes = method.getParameterTypes(); java.lang.annotation.Annotation[][] parmAnnos = method.getParameterAnnotations(); Object[] params = new Object[paramTypes.length]; try { for (int i = 0; i < paramTypes.length; i++) { params[i] = resolveParameter(parmAnnos[i], paramTypes[i]); } method.setAccessible(true); method.invoke(base, params); } catch (InvocationTargetException invokEx) { Throwable c = invokEx.getCause(); if (c == null) c = invokEx; if (c instanceof OperationException) { _log.debug("", c); } else { _log.error("", c); } throw UiException.Aide.wrap(c); } catch (Exception e) { _log.error("", e); throw UiException.Aide.wrap(e); } }
Source:
<code>public FindIterable<Document> prepare(FindIterable<Document> cursor) { FindIterable<Document> target = delegate.prepare(cursor); <START> if (limit.isPresent()) { <END> target = target.limit(limit.get()); } return target; }</code><technical_language>return limit.map(it -> target.limit(it)).orElse(target)</technical_language>

Target:
public FindIterable<Document> prepare(FindIterable<Document> cursor) { FindIterable<Document> target = delegate.prepare(cursor); return limit.map(it -> target.limit(it)).orElse(target); }
Source:
<code>private String calculateNonce() { Date d = new Date(); SimpleDateFormat f = new SimpleDateFormat("yyyy:MM:dd:hh:mm:ss"); String fmtDate = f.format(d); <START> Random rand = new Random(100000); <END> Integer randomInt = rand.nextInt(); return CredentialUtil.H(fmtDate + randomInt.toString()); }</code><technical_language>Shouldnt this SecureRandom</technical_language>

Target:
private String calculateNonce() { LocalDateTime time = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy:MM:dd:HH:mm:ss.SSS"); String fmtTime = formatter.format(time); return CredentialUtil.encryptMD5(fmtTime + CommonHelper.randomString(10)); }
Source:
<code>public RunnerTaskState getRunnerTaskState(String taskId) { final ThreadingTaskRunnerWorkItem workItem = tasks.get(taskId); if (workItem == null) { return null; } else { if (workItem.getThread() == null) { <START> return RunnerTaskState.PENDING; <END> } else if (!workItem.isFinished()) { return RunnerTaskState.RUNNING; } else { return RunnerTaskState.NONE; } } }</code><technical_language>task is finished set thread null task finishes</technical_language>

Target:
public RunnerTaskState getRunnerTaskState(String taskId) { final ThreadingTaskRunnerWorkItem workItem = tasks.get(taskId); return workItem == null ? null : workItem.getState(); }
Source:
<code>public void valdiateDateBad() { Date testDate = null; <START> String message = "The date should NOT be valid."; <END> assertFalse("The date should NOT be valid.", concurStandardAccountingExtractService.validateDate(testDate)); }</code><technical_language>this local variable. removed</technical_language>

Target:
public void valdiateDateBad() { Date testDate = null; assertFalse("The date should NOT be valid.", concurStandardAccountingValidationService.validateDate(testDate)); }
Source:
<code>public void onEvent(Event event) { long eventSeenAt = 0L; <START> if (event.getHeader().getEventType() == EventType.QUERY) { <END> QueryEventData queryEventData = event.getData(); mysqlTxExecutionTimer.update(queryEventData.getExecutionTime(), TimeUnit.SECONDS); } boolean trackMetrics = event.getHeader().getEventType() == EventType.XID; if (trackMetrics) { eventSeenAt = System.currentTimeMillis(); } while (mustStop.get() != true) { if (event.getHeader().getEventType() == EventType.GTID) { gtid = ((GtidEventData)event.getData()).getGtid(); } BinlogConnectorEvent ep = new BinlogConnectorEvent(event, client.getBinlogFilename(), client.getGtidSet(), gtid); try { if ( queue.offer(ep, 100, TimeUnit.MILLISECONDS ) ) { break; } } catch (InterruptedException e) { return; } } if (trackMetrics) { queueTimer.update(System.currentTimeMillis() - eventSeenAt, TimeUnit.MILLISECONDS); } }</code><technical_language>a local trackMetrics below, for XID events. I assume execution time is transaction, update - track this for XIDs, is works</technical_language>

Target:
public void onEvent(Event event) { long eventSeenAt = 0L; boolean trackMetrics = false; if (event.getHeader().getEventType() == EventType.QUERY) { trackMetrics = true; eventSeenAt = System.currentTimeMillis(); QueryEventData queryEventData = event.getData(); mysqlTxExecutionTimer.update(queryEventData.getExecutionTime(), TimeUnit.SECONDS); } while (mustStop.get() != true) { if (event.getHeader().getEventType() == EventType.GTID) { gtid = ((GtidEventData)event.getData()).getGtid(); } BinlogConnectorEvent ep = new BinlogConnectorEvent(event, client.getBinlogFilename(), client.getGtidSet(), gtid); try { if ( queue.offer(ep, 100, TimeUnit.MILLISECONDS ) ) { break; } } catch (InterruptedException e) { return; } } if (trackMetrics) { queueTimer.update(System.currentTimeMillis() - eventSeenAt, TimeUnit.MILLISECONDS); } }
Source:
<code>private synchronized boolean buildSafeClusterMemberList(ArrayList<Process> members) { int previousMemberCount = members.size(); if (m_cluster != null && m_cluster.size() > previousMemberCount) { <START> members.clear(); members.addAll(m_cluster.subList(previousMemberCount, m_cluster.size())); <END> return true; } else { return false; } }</code><technical_language>This is a bit strange. clears current list adds a list. This sense for while loops loop get 5 hosts loop if 6 hosts put 6th host list stuck in infinite loop next time previous members 1 5</technical_language>

Target:
private synchronized boolean buildSafeClusterMemberList(ArrayList<Process> members) { int previousMemberCount = members.size(); if (m_cluster != null && m_cluster.size() > previousMemberCount) { members.clear(); for (int ii = 0; ii < previousMemberCount; ii++) { members.add(null); } members.addAll(m_cluster.subList(previousMemberCount, m_cluster.size())); return true; } else { return false; } }
Source:
<code>static Binder proxy(Binder binder) { return (Binder) Proxy.newProxyInstance( ForbidInstallBinder.class.getClassLoader(), <START> new Class[] {Binder.class}, <END> new ForbidInstallBinder(binder)); }</code><technical_language>This needs Class<?></technical_language>

Target:
static Binder proxy(Binder binder) { return (Binder) Proxy.newProxyInstance( ForbidInstallBinder.class.getClassLoader(), new Class<?>[] {Binder.class}, new ForbidInstallBinder(binder)); }
Source:
<code>private static String getModules(Map<String, ModuleService> modules) { StringBuilder sb = new StringBuilder("Available Modules:"); for(ModuleService entry : modules.values()) { sb.append( <START> String.format("%n %-10s - %s", entry.getName(), entry.getDescription()) <END> ); } return sb.toString(); }</code><technical_language>do new line beginning of line? multi line text end new line</technical_language>

Target:
private String getModules(Map<String, ModuleService> modules) { StringBuilder sb = new StringBuilder(String.format("Modules:%n")); for(ModuleService entry : modules.values()) { sb.append( String.format(" %-10s - %s%n", entry.getName(), entry.getDescription()) ); } return sb.toString(); }
Source:
<code>public TokenBucket(long capacity, long tokensPerSecond, long initialTokens) { this.tokens = new AtomicLong(initialTokens); this.capacity = Math.max(capacity, tokensPerSecond); this.tokensPerPeriod = tokensPerSecond; <START> this.nextRefillTime = System.nanoTime() + refreshPeriodNanos; <END> }</code><technical_language>nit: do need nano seconds? org.apache.zookeeper.common.Time.currentElapsedTime()</technical_language>

Target:
public TokenBucket(long capacity, long tokensPerSecond, long initialTokens) { init(capacity, tokensPerSecond, initialTokens); }
Source:
<code>private String encryptPassword(String username, String realm, String password) { try { StringBuilder sb = new StringBuilder(); for (String algorithm : algorithms) { PasswordFactory passwordFactory = PasswordFactory.getInstance(algorithm); AlgorithmParameterSpec spec; sb.append(algorithm); sb.append(":"); switch (algorithm) { case ScramDigestPassword.ALGORITHM_SCRAM_SHA_1: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_256: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_384: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_512: spec = new IteratedSaltedPasswordAlgorithmSpec(ScramDigestPassword.DEFAULT_ITERATION_COUNT, salt(ScramDigestPassword.DEFAULT_SALT_SIZE)); break; case DigestPassword.ALGORITHM_DIGEST_MD5: case DigestPassword.ALGORITHM_DIGEST_SHA: case DigestPassword.ALGORITHM_DIGEST_SHA_256: case DigestPassword.ALGORITHM_DIGEST_SHA_384: case DigestPassword.ALGORITHM_DIGEST_SHA_512: spec = new DigestPasswordAlgorithmSpec(username, realm); break; default: <START> throw new IllegalArgumentException("Unknown algorithm " + algorithm); <END> } Password encrypted = passwordFactory.generatePassword(new EncryptablePasswordSpec(password.toCharArray(), spec)); byte[] encoded = BasicPasswordSpecEncoding.encode(encrypted); sb.append(ByteIterator.ofBytes(encoded).base64Encode().drainToString()); sb.append(";"); } return sb.toString(); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { throw new RuntimeException(e); } }</code><technical_language>create this String Messages.java</technical_language>

Target:
private String encryptPassword(String username, String realm, String password) { try { StringBuilder sb = new StringBuilder(); for (String algorithm : algorithms) { PasswordFactory passwordFactory = PasswordFactory.getInstance(algorithm); AlgorithmParameterSpec spec; sb.append(algorithm); sb.append(":"); switch (algorithm) { case ScramDigestPassword.ALGORITHM_SCRAM_SHA_1: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_256: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_384: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_512: spec = new IteratedSaltedPasswordAlgorithmSpec(ScramDigestPassword.DEFAULT_ITERATION_COUNT, salt(ScramDigestPassword.DEFAULT_SALT_SIZE)); break; case DigestPassword.ALGORITHM_DIGEST_MD5: case DigestPassword.ALGORITHM_DIGEST_SHA: case DigestPassword.ALGORITHM_DIGEST_SHA_256: case DigestPassword.ALGORITHM_DIGEST_SHA_384: case DigestPassword.ALGORITHM_DIGEST_SHA_512: spec = new DigestPasswordAlgorithmSpec(username, realm); break; default: throw MSG.userToolUnknownAlgorithm(algorithm); } Password encrypted = passwordFactory.generatePassword(new EncryptablePasswordSpec(password.toCharArray(), spec)); byte[] encoded = BasicPasswordSpecEncoding.encode(encrypted); sb.append(ByteIterator.ofBytes(encoded).base64Encode().drainToString()); sb.append(";"); } return sb.toString(); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { throw new RuntimeException(e); } }
Source:
<code>private void handlePrepare() throws IOException { List<BufferManager.TrackFormat> trackFormatList = mBufferManager.readTrackInfoFiles(); if (trackFormatList == null || trackFormatList.isEmpty()) { throw new IOException("Cannot find meta files for the recording."); } List<Format> formats = ImmutableList.copyOf( Lists.transform(trackFormatList, tf -> createFormat(tf.mediaFormat))); Format videoFormat = Iterables.find(formats, f -> MimeTypes.isVideo(f.sampleMimeType)); Iterable<TrackGroup> trackGroups = Iterables.transform(formats, TrackGroup::new); if (videoFormat != null) { Format textFormat = Format.createTextSampleFormat( null, MimeTypes.APPLICATION_CEA708, 0, videoFormat.language, null); <START> trackGroups = Iterables.concat(trackGroups, ImmutableList.of(new TrackGroup(textFormat))); <END> } mTrackGroupArray = new TrackGroupArray(Iterables.toArray(trackGroups, TrackGroup.class)); mSampleBuffer = mRecordingSampleBufferFactory.create( mBufferManager, mBufferListener, true, RecordingSampleBuffer.BUFFER_REASON_RECORDED_PLAYBACK); mSampleBuffer.init(Lists.transform(trackFormatList, tf -> tf.trackId), formats); mCallback.onPrepared(); }</code><technical_language>is this safe? concat is a lazy implementation calling problems concating yourself. works this</technical_language>

Target:
private void handlePrepare() throws IOException { List<BufferManager.TrackFormat> trackFormatList = mBufferManager.readTrackInfoFiles(); if (trackFormatList == null || trackFormatList.isEmpty()) { throw new IOException("Cannot find meta files for the recording."); } List<Format> formats = ImmutableList.copyOf( Lists.transform(trackFormatList, tf -> createFormat(tf.mediaFormat))); Format videoFormat = Iterables.find(formats, f -> MimeTypes.isVideo(f.sampleMimeType)); Iterable<TrackGroup> captionTrackGroups = new ArrayList<>(); if (videoFormat != null) { Format textFormat = Format.createTextSampleFormat( null, MimeTypes.APPLICATION_CEA708, 0, videoFormat.language, null); captionTrackGroups = ImmutableList.of(new TrackGroup(textFormat)); } Iterable<TrackGroup> trackGroups = Iterables.concat(Iterables.transform(formats, TrackGroup::new), captionTrackGroups); mTrackGroupArray = new TrackGroupArray(Iterables.toArray(trackGroups, TrackGroup.class)); mSampleBuffer = mRecordingSampleBufferFactory.create( mBufferManager, mBufferListener, true, RecordingSampleBuffer.BUFFER_REASON_RECORDED_PLAYBACK); mSampleBuffer.init(Lists.transform(trackFormatList, tf -> tf.trackId), formats); mCallback.onPrepared(); }
Source:
<code>public static void putDocuments(String indexName, List<Document> documents) { Index index = getIndex(indexName); int delay = 2; for (int attempts = 0; attempts < MAX_RETRIES; attempts++) { try { PutResponse result = index.put(documents); if (Config.PERSISTENCE_CHECK_DURATION == 0) { continue; } boolean isSuccessful; List<Document> documentsToRetry = new ArrayList<Document>(); for (int i = 0; i < documents.size(); i++) { isSuccessful = result.getResults().get(i).getCode() == StatusCode.OK; if (!isSuccessful) { documentsToRetry.add(documents.get(i)); } } int elapsedTime = 0; isSuccessful = documentsToRetry.isEmpty(); while (!isSuccessful && elapsedTime < Config.PERSISTENCE_CHECK_DURATION) { ThreadHelper.waitBriefly(); result = index.put(documentsToRetry); for (int i = 0; i < documentsToRetry.size(); i++) { isSuccessful = result.getResults().get(i).getCode() == StatusCode.OK; if (!isSuccessful) { break; } } if (!isSuccessful) { elapsedTime += ThreadHelper.WAIT_DURATION; } } if (elapsedTime >= Config.PERSISTENCE_CHECK_DURATION) { log.info(String.format(ERROR_EXCEED_DURATION, documents, indexName)); } } catch (PutException e) { if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())) { ThreadHelper.waitFor(delay * 1000); delay *= 2; continue; } else { log.severe(String.format(ERROR_NON_TRANSIENT_BACKEND_ISSUE, documents, indexName) + TeammatesException.toStringWithStackTrace(e)); break; } } } <START> } <END></code><technical_language>Method long nesting deep. SLAP a bit more</technical_language>

Target:
public static void putDocuments(String indexName, List<Document> documents) { Index index = getIndex(indexName); int delay = 2; for (int attempts = 0; attempts < MAX_RETRIES; attempts++) { try { List<Document> failedDocuments = putDocuments(index, documents); boolean isSuccessful = failedDocuments.isEmpty(); if (Config.PERSISTENCE_CHECK_DURATION == 0) { continue; } int elapsedTime = 0; while (!isSuccessful && elapsedTime < Config.PERSISTENCE_CHECK_DURATION) { ThreadHelper.waitBriefly(); isSuccessful = putDocuments(index, failedDocuments).isEmpty(); if (!isSuccessful) { elapsedTime += ThreadHelper.WAIT_DURATION; } } if (elapsedTime >= Config.PERSISTENCE_CHECK_DURATION) { log.info(String.format(ERROR_EXCEED_DURATION, documents, indexName)); } } catch (PutException e) { if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())) { ThreadHelper.waitFor(delay * 1000); delay *= 2; continue; } else { log.severe(String.format(ERROR_NON_TRANSIENT_BACKEND_ISSUE, documents, indexName) + TeammatesException.toStringWithStackTrace(e)); break; } } } }
Source:
<code>public LocalSearchResultProvider(LocalSearchBackend backend, IQueryBackendContext context, PQuery query, IPlanProvider planProvider, QueryEvaluationHint userHints) throws QueryProcessingException { this.backend = backend; this.resultProviderAccess = context.getResultProviderAccess(); this.hintProvider = context.getHintProvider(); engine = (AdvancedViatraQueryEngine) hintProvider; this.query = query; this.planProvider = planProvider; this.userHints = userHints; this.runtimeContext = context.getRuntimeContext(); try { searchContext = new <START> ISearchContext.SearchContext(runtimeContext, engine.getBaseIndex(), resultProviderAccess, userHints, <END> backend.getCache()); } catch (ViatraQueryException e) { throw new QueryProcessingException("Could not create search context for {1}", new String[]{query.getFullyQualifiedName()}, e.getMessage(), query, e); } }</code><technical_language>runtimeConext resultProviderAccess is accessible IQueryBackendContext. For sake of future-proffing SearchConext constructor, propagate backend context instead of specific parts of it. Also, search context dependence NavigationHelper removed bug <LINK_0>, is closed, TODOs updated. this is unrelated this change</technical_language>

Target:
public LocalSearchResultProvider(LocalSearchBackend backend, IQueryBackendContext context, PQuery query, IPlanProvider planProvider, QueryEvaluationHint userHints) throws QueryProcessingException { this.backend = backend; this.resultProviderAccess = context.getResultProviderAccess(); this.hintProvider = context.getHintProvider(); engine = (AdvancedViatraQueryEngine) hintProvider; this.query = query; this.planProvider = planProvider; this.userHints = userHints; this.runtimeContext = context.getRuntimeContext(); try { searchContext = new ISearchContext.SearchContext(context, engine.getBaseIndex(), userHints, backend.getCache()); } catch (ViatraQueryException e) { throw new QueryProcessingException("Could not create search context for {1}", new String[]{query.getFullyQualifiedName()}, e.getMessage(), query, e); } }
Source:
<code>protected NuxeoPrincipal createAdministrator() { <START> return new UserPrincipal("Administrator", new ArrayList<>(), false, true); <END> }</code><technical_language>replaced unmodifiable version List.of()</technical_language>

Target:
protected NuxeoPrincipal createAdministrator() { return new UserPrincipal("Administrator", List.of(), false, true); }
Source:
<code>private String deserializationPath() { <START> return "avro.deserialization"; <END> }</code><technical_language>sth content.avro.deserialization? in future add content.json.* metrics, weird .json root metric</technical_language>

Target:
private String deserializationPath() { return "content.avro.deserialization"; }
Source:
<code>private void filterOutLastReadBlobs(List<CloudBlobMetadata> cloudBlobMetadataList, Set<String> lastReadBlobIds, long lastUpdateTime) { List<CloudBlobMetadata> removeList = new LinkedList<>(); <START> for (CloudBlobMetadata cloudBlobMetadata : cloudBlobMetadataList) { <END> if (removeList.size() == lastReadBlobIds.size() || cloudBlobMetadata.getLastUpdateTime() > lastUpdateTime) { break; } if (lastReadBlobIds.contains(cloudBlobMetadata.getId())) { removeList.add(cloudBlobMetadata); } } cloudBlobMetadataList.removeAll(removeList); }</code><technical_language>Minor: iterate input list call iter.remove() (a bit more efficient)</technical_language>

Target:
private void filterOutLastReadBlobs(List<CloudBlobMetadata> cloudBlobMetadataList, Set<String> lastReadBlobIds, long lastUpdateTime) { ListIterator<CloudBlobMetadata> iterator = cloudBlobMetadataList.listIterator(); int numRemovedBlobs = 0; while(iterator.hasNext()) { CloudBlobMetadata cloudBlobMetadata = iterator.next(); if(numRemovedBlobs == lastReadBlobIds.size() || cloudBlobMetadata.getLastUpdateTime() > lastUpdateTime) { break; } if (lastReadBlobIds.contains(cloudBlobMetadata.getId())) { iterator.remove(); numRemovedBlobs++; } } }
Source:
<code>public void testOnGenerateClickedWhenUserConfirmGenerateKey() { InputDialog inputDialog = mock(InputDialog.class); when(dialogFactory.createInputDialog(anyString(), anyString(), (InputCallback)anyObject(), (CancelCallback)anyObject())) .thenReturn(inputDialog); <START> when(inputDialog.withValidator(any(InputValidator.class))).thenReturn(inputDialog); <END> presenter.onGenerateClicked(); verify(dialogFactory).createInputDialog(anyString(), anyString(), inputCallbackCaptor.capture(), (CancelCallback)anyObject()); InputCallback inputCallback = inputCallbackCaptor.getValue(); inputCallback.accepted(GITHUB_HOST); verify(service).generatePair(Matchers.eq(SshKeyManagerPresenter.VCS_SSH_SERVICE), eq(GITHUB_HOST)); }</code><technical_language>I do in setup method</technical_language>

Target:
public void testOnGenerateClickedWhenUserConfirmGenerateKey() { when(dialogFactory.createInputDialog(anyString(), anyString(), (InputCallback)anyObject(), (CancelCallback)anyObject())) .thenReturn(inputDialog); presenter.onGenerateClicked(); verify(dialogFactory).createInputDialog(anyString(), anyString(), inputCallbackCaptor.capture(), (CancelCallback)anyObject()); InputCallback inputCallback = inputCallbackCaptor.getValue(); inputCallback.accepted(GITHUB_HOST); verify(service).generatePair(Matchers.eq(SshKeyManagerPresenter.VCS_SSH_SERVICE), eq(GITHUB_HOST)); }
Source:
<code>public List<IEntityAction> getAllEntityActions() { <START> return Lists.newArrayList(VampirismRegistries.ENTITYACTIONS.getValues()); <END> }</code><technical_language>getValues() is deprecated .getValuesCollection() (same result)</technical_language>

Target:
public List<IEntityAction> getAllEntityActions() { return Lists.newArrayList(VampirismRegistries.ENTITYACTIONS.getValuesCollection()); }
Source:
<code>public int hashCode() { <START> return Objects.hash(parentNode, predicate); <END> }</code><technical_language>IMPORTANT (see above), break equals contract + changes implementation</technical_language>

Target:
public int hashCode() { return Objects.hash(System.identityHashCode(parentNode), System.identityHashCode(predicate)); }
Source:
<code>public VMNamesListReturnForXmlRpc(Map<String, Object> innerMap) { status = new StatusForXmlRpc((Map<String, Object>) innerMap.get(STATUS)); Object[] vmNames = (Object[]) innerMap.get(VM_NAMES); if (vmNames != null) { vmNamesList = <START> Arrays.asList(vmNames).stream().map(Objects::toString).collect(Collectors.toList()); <END> } }</code><technical_language>Arrays.stream(vmNames) instead of creating a list intermediate step</technical_language>

Target:
public VMNamesListReturnForXmlRpc(Map<String, Object> innerMap) { status = new StatusForXmlRpc((Map<String, Object>) innerMap.get(STATUS)); Object[] vmNames = (Object[]) innerMap.get(VM_NAMES); if (vmNames != null) { vmNamesList = Arrays.stream(vmNames).map(Objects::toString).collect(Collectors.toList()); } }
Source:
<code>void createRsaKeyRunner(Consumer<CreateRsaKeyOptions> testRunner) { final Map<String, String> tags = new HashMap<>(); tags.put("foo", "baz"); <START> final CreateRsaKeyOptions createRsaKeyOptions = new CreateRsaKeyOptions(KEY_NAME) <END> .setExpiresOn(OffsetDateTime.of(2050, 1, 30, 0, 0, 0, 0, ZoneOffset.UTC)) .setNotBefore(OffsetDateTime.of(2000, 1, 30, 12, 59, 59, 0, ZoneOffset.UTC)) .setTags(tags); testRunner.accept(createRsaKeyOptions); }</code><technical_language>generateResourceId() for key name generates a randomized value, helps running live tests. suggestion final CreateRsaKeyOptions createRsaKeyOptions = new CreateRsaKeyOptions(generateResourceId(KEY_NAME))</technical_language>

Target:
void createRsaKeyRunner(Consumer<CreateRsaKeyOptions> testRunner) { final Map<String, String> tags = new HashMap<>(); tags.put("foo", "baz"); final CreateRsaKeyOptions createRsaKeyOptions = new CreateRsaKeyOptions(generateResourceId(KEY_NAME)) .setExpiresOn(OffsetDateTime.of(2050, 1, 30, 0, 0, 0, 0, ZoneOffset.UTC)) .setNotBefore(OffsetDateTime.of(2000, 1, 30, 12, 59, 59, 0, ZoneOffset.UTC)) .setTags(tags); testRunner.accept(createRsaKeyOptions); }
Source:
<code>public CloudBigtableConfiguration build() { <START> return new CloudBigtableConfiguration(projectId, zoneId, clusterId, additionalConfigurations); <END> }</code><technical_language>singular</technical_language>

Target:
public CloudBigtableConfiguration build() { return new CloudBigtableConfiguration(projectId, zoneId, clusterId, additionalConfiguration); }
Source:
<code>private static void assertGeometryEquals(Geometry actual, Geometry expected) { <START> if (expected.isEmpty()) { <END> assertTrue(actual.isEmpty()); } else { assertEquals(actual.norm(), expected.norm()); } }</code><technical_language>earlier commits enhanced serialization avoid losing multi-types this test simplified assertEquals(actual.norm(), expected.norm()); in cases</technical_language>

Target:
private static void assertGeometryEquals(Geometry actual, Geometry expected) { assertEquals(actual.norm(), expected.norm()); }
Source:
<code>public JsonRpcRequest(@Assisted("message") String message, JsonParser jsonParser, JsonRpcFactory jsonRpcFactory) { this.jsonParser = jsonParser; checkNotNull(message, "Message must not be null"); checkArgument(!message.isEmpty(), "Message must not be empty"); <START> <END> JsonObject jsonObject = jsonParser.parse(message).getAsJsonObject(); method = jsonObject.get("method").getAsString(); if (jsonObject.has("id")) { id = jsonObject.get("id").getAsString(); } else { id = null; } if (jsonObject.has("params")) { params = jsonRpcFactory.createParams(jsonObject.get("params").toString()); } else { params = null; } }</code><technical_language>extra line</technical_language>

Target:
public JsonRpcRequest(@Assisted("message") String message, JsonParser jsonParser, JsonRpcFactory jsonRpcFactory) { checkNotNull(message, "Message must not be null"); checkArgument(!message.isEmpty(), "Message must not be empty"); JsonObject jsonObject = jsonParser.parse(message).getAsJsonObject(); method = jsonObject.get("method").getAsString(); if (jsonObject.has("id")) { id = jsonObject.get("id").getAsString(); } else { id = null; } if (jsonObject.has("params")) { params = jsonRpcFactory.createParams(jsonObject.get("params").toString()); } else { params = null; } }