auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Property(String humanName, ExecutableElement element) { this.methodName = element.getSimpleName().toString(); this.humanName = humanName; this.element = element; type = TypeName.get(element.getReturnType()); annotations = buildAnnotations(element); typeAdapter = getAnnotationValue(element, GsonTypeAdapter.class); TypeMirror returnType = element.getReturnType(); <START> instanceOfOptional = !TypeKind.TYPEVAR.equals(returnType.getKind()) <END> && (MoreTypes.isTypeOf(Optional.class, returnType) || MoreTypes.isTypeOf(com.google.common.base.Optional.class, returnType)); }</code><technical_language>This is a bit limited supports guava java 8's. more generic? (Unless AutoValue supports two, fine. memory's fuzzy)</technical_language>

Target:
public Property(String humanName, ExecutableElement element) { this.methodName = element.getSimpleName().toString(); this.humanName = humanName; this.element = element; type = TypeName.get(element.getReturnType()); annotations = buildAnnotations(element); typeAdapter = getAnnotationValue(element, GsonTypeAdapter.class); instanceOfOptional = isOptional(element.getReturnType()); }
Source:
<code>public UpdateRequest processPreUpdate( UpdateRequest input, Map<String, Metacard> existingMetacards) throws StopProcessingException { Function<Metacard, Metacard> oldMetacard = <START> update -> Optional.ofNullable(existingMetacards.get(update.getId())).orElse(null); <END> List<Metacard> newMetacards = input.getUpdates().stream().map(Map.Entry::getValue).collect(Collectors.toList()); if (newMetacards.stream().anyMatch(m -> isOwnerChanged(oldMetacard.apply(m), m))) { throw new StopProcessingException(FAILURE_OWNER_CANNOT_CHANGE); } if (newMetacards .stream() .filter( newVersionOfMetacard -> isAccessControlUpdated( oldMetacard.apply(newVersionOfMetacard), newVersionOfMetacard)) .filter(Objects::nonNull) .map(oldMetacard) .filter(subjectIsNotOwner) .anyMatch(subjectIsNotAccessAdmin)) { throw new StopProcessingException(FAILURE_NOT_ADMIN_OR_OWNER); } return input; }</code><technical_language>question: I missing result achieved update -> existingMetacards.get(update.getId());</technical_language>

Target:
public UpdateRequest processPreUpdate( UpdateRequest input, Map<String, Metacard> existingMetacards) throws StopProcessingException { Map<String, Metacard> filteredExistingMetacards = existingMetacards .values() .stream() .filter(hasIntrigueTag) .collect(Collectors.toMap(Metacard::getId, Function.identity())); Function<Metacard, Metacard> oldMetacard = update -> Optional.ofNullable(update.getId()).map(filteredExistingMetacards::get).orElse(null); List<Metacard> newMetacards = input.getUpdates().stream().map(Map.Entry::getValue).collect(Collectors.toList()); if (newMetacards.stream().anyMatch(m -> isOwnerChanged(oldMetacard.apply(m), m))) { throw new StopProcessingException(FAILURE_OWNER_CANNOT_CHANGE); } if (newMetacards .stream() .filter( newVersionOfMetacard -> isAccessControlUpdated( oldMetacard.apply(newVersionOfMetacard), newVersionOfMetacard)) .filter(Objects::nonNull) .map(oldMetacard) .filter(Objects::nonNull) .filter(subjectIsNotOwner) .anyMatch(subjectIsNotAccessAdmin)) { throw new StopProcessingException(FAILURE_NOT_ADMIN_OR_OWNER); } return input; }
Source:
<code>private LambdaEvent createBasicEvent(String repository, String gitReference, String username, String installationId, LambdaEvent.LambdaEventType type) { LambdaEvent lambdaEvent = new LambdaEvent(); lambdaEvent.setRepository(repository); lambdaEvent.setReference(gitReference); lambdaEvent.setUsername(username); lambdaEvent.setType(type); lambdaEvent.setInstallationId(installationId); <START> Optional<User> user = Optional.ofNullable(userDAO.findByGitHubUsername(username)); <END> user.ifPresent(lambdaEvent::setUser); return lambdaEvent; }</code><technical_language>a big fan of methods returning Optional if null returned, if a method returns a null, I more complicated create Optional if empty -- I do a null check here, change UserDAO.findByGitHubUsername return Optional. DAOs returning Optionals, I lean former</technical_language>

Target:
private LambdaEvent createBasicEvent(String repository, String gitReference, String username, String installationId, LambdaEvent.LambdaEventType type) { LambdaEvent lambdaEvent = new LambdaEvent(); lambdaEvent.setRepository(repository); lambdaEvent.setReference(gitReference); lambdaEvent.setGithubUsername(username); lambdaEvent.setType(type); User user = userDAO.findByGitHubUsername(username); if (user != null) { lambdaEvent.setUser(user); } return lambdaEvent; }
Source:
<code><START> public void setSealedState(boolean isSealed) { <END> this.isSealed = isSealed; }</code><technical_language>changes master - previous version (with doc) needs retained</technical_language>

Target:
void setSealedState(boolean isSealed) { this.isSealed = isSealed; }
Source:
<code>@OnClick void onClick(View view) { if (callback != null && entry != null && card != null) { <START> callback.onSelectPage(card, entry, TransitionUtil.getSharedElements(getContext(), titleView, subtitleView, imageView)); <END> } }</code><technical_language>want title subtitle shared elements here? a font size, smooth transitioning</technical_language>

Target:
@OnClick void onClick(View view) { if (callback != null && entry != null && card != null) { callback.onSelectPage(card, entry, TransitionUtil.getSharedElements(getContext(), imageView)); } }
Source:
<code>public TestNumberedScoreBoardEventProviderImpl(TestScoreBoardEventProvider parent, int number) { super(parent, number, TestScoreBoardEventProvider.NChild.NUMBERED, TestNumberedScoreBoardEventProvider.class, Value.class, Child.class); <START> if (parent instanceof TestNumberedScoreBoardEventProvider) { <END> setCopy(Value.RO_DIRECT_COPY, parent, TestNumberedScoreBoardEventProvider.Value.INT, true); setCopy(Value.RW_DIRECT_COPY, parent, TestNumberedScoreBoardEventProvider.Value.INT, false); } else { setCopy(Value.RO_DIRECT_COPY, parent, TestScoreBoardEventProvider.Value.INT, true); setCopy(Value.RW_DIRECT_COPY, parent, TestScoreBoardEventProvider.Value.INT, false); } }</code><technical_language>this false</technical_language>

Target:
public TestNumberedScoreBoardEventProviderImpl(TestScoreBoardEventProvider parent, int number) { super(parent, number, TestScoreBoardEventProvider.NChild.NUMBERED, TestNumberedScoreBoardEventProvider.class, Value.class, Child.class); setCopy(Value.RO_DIRECT_COPY, parent, TestScoreBoardEventProvider.Value.INT, true); setCopy(Value.RW_DIRECT_COPY, parent, TestScoreBoardEventProvider.Value.INT, false); }
Source:
<code>public List<TransactionSigner> getTransactionSigners() { <START> return signers; <END> }</code><technical_language>Duplicate list avoid callers modifying internal state</technical_language>

Target:
public List<TransactionSigner> getTransactionSigners() { lock.lock(); try { return ImmutableList.copyOf(signers); } finally { lock.unlock(); } }
Source:
<code>private boolean replaceFilePathsWithBytes(ModelNode request) throws CommandFormatException, IOException { boolean didReplacement = false; ModelNode opDesc = request.clone(); String opName = opDesc.get("operation").asString(); opDesc.get("operation").set("read-operation-description"); opDesc.get("name").set(opName); ModelNode response = execute(opDesc, false); ModelNode requestProps = response.get("result", "request-properties"); for (Property prop : requestProps.asPropertyList()) { <START> if (ModelType.valueOf(prop.getValue().get("type").asString()) == ModelType.BYTES) { <END> String filePath = request.get(prop.getName()).asString(); File localFile = new File(filePath); try { request.get(prop.getName()).set(Util.readBytes(localFile)); didReplacement = true; } catch (OperationFormatException e) { throw new CommandFormatException(e); } } } return didReplacement; }</code><technical_language>This throw IAE if server-side author screwed is "type" declaration. happen folks "modern" subsystem authoring, some stuff WildfFly have. do isDefined check, or, ModelType of "type" is spec supposed ModelType, do this: ModelNode typeDesc = prop.getValue().get("type"); if (typeDesc.getType() == ModelType.TYPE && typeDesc.asType() == ModelType.BYTES) { avoid failing bogus strings (e.g. "long") people stuck a "type" description. Again, in WildFly/EAP bogus stuff, this is careful external stuff</technical_language>

Target:
private boolean replaceFilePathsWithBytes(ModelNode request) throws CommandFormatException, IOException { boolean didReplacement = false; ModelNode opDesc = request.clone(); String opName = opDesc.get("operation").asString(); opDesc.get("operation").set("read-operation-description"); opDesc.get("name").set(opName); ModelNode response = execute(opDesc, false); ModelNode requestProps = response.get("result", "request-properties"); for (Property prop : requestProps.asPropertyList()) { ModelNode typeDesc = prop.getValue().get("type"); if (typeDesc.getType() == ModelType.TYPE && typeDesc.asType() == ModelType.BYTES) { String filePath = request.get(prop.getName()).asString(); File localFile = new File(filePath); try { request.get(prop.getName()).set(Util.readBytes(localFile)); didReplacement = true; } catch (OperationFormatException e) { throw new CommandFormatException(e); } } } return didReplacement; }
Source:
<code>public Block[] getSequenceBlocks(int start, int length) { int sequenceLength = 2 * length; BlockBuilder samplesBuilder = DOUBLE.createBlockBuilder(null, sequenceLength); BlockBuilder weightsBuilder = DOUBLE.createBlockBuilder(null, sequenceLength); for (int weight = 1; weight < 3; ++weight) { for (int i = start; i < start + length; i++) { <START> DOUBLE.writeDouble(samplesBuilder, Double.valueOf(i)); <END> DOUBLE.writeDouble(weightsBuilder, Double.valueOf(weight)); } } return new Block[] { createRLEBlock(TestReservoirAggregation.SIZE, sequenceLength), samplesBuilder.build(), weightsBuilder.build() }; }</code><technical_language>remove unnecessary Double.valueOf DOUBLE.writeDouble(samples, i); DOUBLE.writeDouble(weights, weight);</technical_language>

Target:
public Block[] getSequenceBlocks(int start, int length) { int positionCount = 2 * length; BlockBuilder samples = DOUBLE.createBlockBuilder(null, positionCount); BlockBuilder weights = DOUBLE.createBlockBuilder(null, positionCount); for (int weight = 1; weight < 3; weight++) { for (int i = start; i < start + length; i++) { DOUBLE.writeDouble(samples, i); DOUBLE.writeDouble(weights, weight); } } return new Block[] { createRLEBlock(MAX_SAMPLES, positionCount), samples.build(), weights.build() }; }
Source:
<code>protected void startMachines() throws InfrastructureException { KubernetesEnvironment k8sEnv = getContext().getEnvironment(); List<Service> createdServices = new ArrayList<>(); for (Service service : k8sEnv.getServices().values()) { createdServices.add(namespace.services().create(service)); } List<Ingress> readyIngresses = createAndWaitReady(k8sEnv.getIngresses().values()); if (failFastOnUnrecoverableEvents) { namespace.pods().watchContainers(new UnrecoverableEventHanler()); <START> } <END> final KubernetesServerResolver serverResolver = new KubernetesServerResolver(createdServices, readyIngresses); doStartMachine(serverResolver); }</code><technical_language>I useful add MachineLogsPublisher here. WDYT</technical_language>

Target:
protected void startMachines() throws InfrastructureException { KubernetesEnvironment k8sEnv = getContext().getEnvironment(); List<Service> createdServices = new ArrayList<>(); for (Service service : k8sEnv.getServices().values()) { createdServices.add(namespace.services().create(service)); } List<Ingress> readyIngresses = createAndWaitReady(k8sEnv.getIngresses().values()); namespace.pods().watchContainers(new MachineLogsPublisher()); if (!Strings.isNullOrEmpty(unrecoverableEvents)) { namespace.pods().watchContainers(new UnrecoverableEventHanler()); } final KubernetesServerResolver serverResolver = new KubernetesServerResolver(createdServices, readyIngresses); doStartMachine(serverResolver); }
Source:
<code>private boolean operationHasRepresentationParam(Operation o) { boolean ret = false; for (Parameter p : o.getParameters()) { if (p.getName().equals("v")) { <START> ret = true; <END> } } return ret; }</code><technical_language>return immediately save some unnecessary cycles? break out of for loop</technical_language>

Target:
private boolean operationHasRepresentationParam(Operation o) { boolean ret = false; for (Parameter p : o.getParameters()) { if (p.getName().equals("v")) { ret = !ret; } } return ret; }
Source:
<code>public void searchesBouts() throws Exception { final String urn = "urn:test:2"; final MkBase base = new MkBase(); final Aliases aliases = base.user(new URN(urn)).aliases(); aliases.add("test2"); final Inbox inbox = aliases.iterate().iterator().next().inbox(); <START> final Bout firstbout = inbox.bout(inbox.start()); <END> final String firsttitle = "bout1 title"; firstbout.rename(firsttitle); final Bout secbout = inbox.bout(inbox.start()); final String sectitle = "bout2 title"; secbout.rename(sectitle); firstbout.messages().post("hello"); secbout.messages().post("world"); final String body = new RsPrint( new TkAuth( new TkInbox(base), new PsFixed(new Identity.Simple(urn)) ).act( new RqFake( RqMethod.GET, String.format( "/search?q=%s", "r" ) ) ) ).printBody(); MatcherAssert.assertThat( body, Matchers.containsString(sectitle) ); MatcherAssert.assertThat( body, Matchers.not(Matchers.containsString(firsttitle)) ); }</code><technical_language>@danff name</technical_language>

Target:
public void searchesBouts() throws Exception { final String urn = "urn:test:2"; final MkBase base = new MkBase(); final Aliases aliases = base.user(new URN(urn)).aliases(); aliases.add("test2"); final Inbox inbox = aliases.iterate().iterator().next().inbox(); final Bout first = inbox.bout(inbox.start()); final String firsttitle = "bout1 title"; first.rename(firsttitle); final Bout second = inbox.bout(inbox.start()); final String secondtitle = "bout2 title"; second.rename(secondtitle); first.messages().post("hello"); second.messages().post("world"); final String body = new RsPrint( new TkAuth( new TkInbox(base), new PsFixed(new Identity.Simple(urn)) ).act( new RqFake( RqMethod.GET, String.format( "/search?q=%s", "r" ) ) ) ).printBody(); MatcherAssert.assertThat( body, Matchers.containsString(secondtitle) ); MatcherAssert.assertThat( body, Matchers.not(Matchers.containsString(firsttitle)) ); }
Source:
<code>public Class<?> createExtensionClass(Class<?> cls, QName qname, ClassLoader loader) { try { return ClassLoaderUtils.loadClass(cls.getName() + "Extensibility", ExtensionClassLoader.class); <START> } catch (ClassNotFoundException e) { <END> } return null; }</code><technical_language>log exception (debug trace), troubleshooting</technical_language>

Target:
public Class<?> createExtensionClass(Class<?> cls, QName qname, ClassLoader loader) { return findClass(cls.getName() + "Extensibility", ExtensionClassLoader.class); }
Source:
<code>public void accept(final FeedRangeVisitor visitor) { if (visitor == null) { <START> throw new NullPointerException("visitor"); <END> } visitor.visit(this); }</code><technical_language>I checkNotNull pattern consistent more succinct. else in new code</technical_language>

Target:
public void accept(final FeedRangeVisitor visitor) { checkNotNull(visitor, "Argument 'visitor' must not be null"); visitor.visit(this); }
Source:
<code>public void play() { if (isPaused()) { togglePause(); } else if( !this.mobile ) { <START> clickOnArea(2); <END> } else { clickOnArea(4); } }</code><technical_language>get rid of magic numbers? I in this context</technical_language>

Target:
public void play() { if (isPausedWithOverlay()) { togglePause(); } else if( !this.mobile ) { clickOnArea(2); } else { clickOnArea(4); } }
Source:
<code>public void evaluate() throws Exception { assertTrue(Franke.evaluate(0.0, 0.0) > 0); assertTrue(Franke.evaluate(1.0, 0.0) > 0); assertTrue(Franke.evaluate(0.0, 1.0) > 0); assertTrue(Franke.evaluate(1.0, 1.0) > 0); <START> } <END></code><technical_language>put max in too</technical_language>

Target:
public void evaluate() throws Exception { assertTrue(Franke.evaluate(0.0, 0.0) > 0); assertTrue(Franke.evaluate(1.0, 0.0) > 0); assertTrue(Franke.evaluate(0.0, 1.0) > 0); assertTrue(Franke.evaluate(1.0, 1.0) > 0); assertTrue(Franke.evaluate(0.2, 0.2) > 0); assertTrue(Franke.evaluate(0.0, 0.0) < 1.22); assertTrue(Franke.evaluate(1.0, 0.0) < 1.22); assertTrue(Franke.evaluate(0.0, 1.0) < 1.22); assertTrue(Franke.evaluate(1.0, 1.0) < 1.22); assertTrue(Franke.evaluate(0.2, 0.2) < 1.22); }
Source:
<code>private ExecutableContainer loadExecutableContainer(Session session, InternalTask task) { try { ExecutableContainer container = null; <START> if (task.getClass().equals(InternalForkedScriptTask.class)) { <END> TaskData taskData = queryScriptTaskData(session, task); if (taskData != null) { container = taskData.createExecutableContainer(); } } else if (task.getClass().equals(InternalScriptTask.class)) { TaskData taskData = queryScriptTaskData(session, task); if (taskData != null) { container = taskData.createExecutableContainer(); } } else { throw new IllegalArgumentException("Unexpected task class: " + task.getClass()); } if (container == null) { throw new DatabaseManagerException("Failed to load data for task " + task.getId()); } return container; } catch (Exception e) { throw new DatabaseManagerException(e); } }</code><technical_language>Is merge body of branches</technical_language>

Target:
private ExecutableContainer loadExecutableContainer(Session session, InternalTask task) { try { ExecutableContainer container = null; if (isScriptTask(task)) { TaskData taskData = queryScriptTaskData(session, task); if (taskData != null) { container = taskData.createExecutableContainer(); } } else { throw new IllegalArgumentException("Unexpected task class: " + task.getClass()); } if (container == null) { throw new DatabaseManagerException("Failed to load data for task " + task.getId()); } return container; } catch (Exception e) { throw new DatabaseManagerException(e); } }
Source:
<code>public static String getName(Context cxt, int category) { if (category < 0 || category > CATEGORY_NAMES_ID.length) { return null; } <START> return cxt.getString(CATEGORY_NAMES_ID[category - 1]); <END> }</code><technical_language>is a logic error line 22. category = CATEGORY_NAMES_ID.length pass get IndexOutOfBoundException. Please rewrite following: return (category > -1 && category < CATEGORY_NAMES_ID.length) ? cxt.getString(CATEGORY_NAMES_ID[category - 1]) : null; && give performance. expression is false, need evaluate expression</technical_language>

Target:
public static String getName(Context cxt, int category) { return (category > 0 && category < CATEGORY_NAMES_ID.length + 1) ? cxt.getString(CATEGORY_NAMES_ID[category - 1]) : null; }
Source:
<code>private static String createUrl(String httpPath) { <START> return String.format("%s/%s", server, httpPath); <END> }</code><technical_language>url building here, avoid problems / end of server</technical_language>

Target:
private static String createUrl(String httpPath) { if (httpPath == null) { return server.toString(); } try { return new URL(server, httpPath).toString(); } catch (MalformedURLException ex) { throw new RuntimeException(ex); } }
Source:
<code>protected void endVmCommand() { initializeObjectState(); if (getParameters().getTaskGroupSuccess()) { getSnapshotDao().remove(getParameters().getSnapshotId()); } else { List<String> failedToRemoveDisks = new ArrayList<>(); for (VdcActionParametersBase parametersBase : getParameters().getImagesParameters()) { ImagesContainterParametersBase imagesParams = (ImagesContainterParametersBase) parametersBase; if (imagesParams.getTaskGroupSuccess()) { Snapshot snapshotWithoutImage = ImagesHandler.prepareSnapshotConfigWithoutImageSingleImage( getParameters().getSnapshotId(), imagesParams.getImageId()); getSnapshotDao().update(snapshotWithoutImage); } else { <START> log.errorFormat("Could not delete image {1} from snapshot {2}", <END> getParameters().getSnapshotId(), imagesParams.getImageId()); DiskImage diskImage = getDiskImageDao().getSnapshotById(imagesParams.getImageId()); failedToRemoveDisks.add(diskImage.getDiskAlias()); } } if (!failedToRemoveDisks.isEmpty()) { addCustomValue("DiskAlias", StringUtils.join(failedToRemoveDisks, ", ")); AuditLogDirector.log(this, AuditLogType.USER_REMOVE_SNAPSHOT_FINISHED_FAILURE_PARTIAL_SNAPSHOT); } getSnapshotDao().updateStatus(getParameters().getSnapshotId(), SnapshotStatus.OK); } super.endVmCommand(); }</code><technical_language>/s/{1}/{0} /s/{2}/{1}</technical_language>

Target:
protected void endVmCommand() { initializeObjectState(); if (getParameters().getTaskGroupSuccess()) { getSnapshotDao().remove(getParameters().getSnapshotId()); } else { List<String> failedToRemoveDisks = new ArrayList<>(); for (VdcActionParametersBase parametersBase : getParameters().getImagesParameters()) { ImagesContainterParametersBase imagesParams = (ImagesContainterParametersBase) parametersBase; if (imagesParams.getTaskGroupSuccess()) { Snapshot snapshotWithoutImage = ImagesHandler.prepareSnapshotConfigWithoutImageSingleImage( getParameters().getSnapshotId(), imagesParams.getImageId()); getSnapshotDao().update(snapshotWithoutImage); } else { log.errorFormat("Could not delete image {0} from snapshot {1}", getParameters().getSnapshotId(), imagesParams.getImageId()); DiskImage diskImage = getDiskImageDao().getSnapshotById(imagesParams.getImageId()); failedToRemoveDisks.add(diskImage.getDiskAlias()); } } if (!failedToRemoveDisks.isEmpty()) { addCustomValue("DiskAliases", StringUtils.join(failedToRemoveDisks, ", ")); AuditLogDirector.log(this, AuditLogType.USER_REMOVE_SNAPSHOT_FINISHED_FAILURE_PARTIAL_SNAPSHOT); } getSnapshotDao().updateStatus(getParameters().getSnapshotId(), SnapshotStatus.OK); } super.endVmCommand(); }
Source:
<code>private void setupContextListener() { IDebugContextManager contextManager = DebugUITools.getDebugContextManager(); IDebugContextService contextService = contextManager .getContextService(getSite().getWorkbenchWindow()); fDebugContextListener = new IDebugContextListener() { @Override public void debugContextChanged(DebugContextEvent event) { try { if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) { ISelection s = event.getContext(); setDebugContext(s); } } catch (Throwable e) { <START> e.printStackTrace(); <END> } } }; contextService.addDebugContextListener(fDebugContextListener); setDebugContext(contextService.getActiveContext()); }</code><technical_language>Do want dump stack here</technical_language>

Target:
private void setupContextListener() { IDebugContextManager contextManager = DebugUITools.getDebugContextManager(); IDebugContextService contextService = contextManager .getContextService(getSite().getWorkbenchWindow()); fDebugContextListener = new IDebugContextListener() { @Override public void debugContextChanged(DebugContextEvent event) { if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) { ISelection s = event.getContext(); setDebugContext(s); } } }; contextService.addDebugContextListener(fDebugContextListener); setDebugContext(contextService.getActiveContext()); }
Source:
<code>protected ListedHashTree getLnpTestPlan() { ListedHashTree testPlan = new ListedHashTree(JMeterElements.testPlan()); HashTree threadGroup = testPlan.add( JMeterElements.threadGroup(NUMBER_OF_USER_ACCOUNTS, RAMP_UP_PERIOD, 1)); threadGroup.add(JMeterElements.csvDataSet(getPathToTestDataFile(getCsvConfigPath()))); threadGroup.add(JMeterElements.cookieManager()); threadGroup.add(JMeterElements.defaultSampler()); threadGroup.add(JMeterElements.onceOnlyController()) .add(JMeterElements.loginSampler()); <START> String firstPath = "webapi/student?courseid=${courseId}"; <END> threadGroup.add(JMeterElements.httpSampler(firstPath, GET, null)); String secondPath = "webapi/session?courseid=${courseId}&fsname=${fsname}&intent=STUDENT_SUBMISSION"; threadGroup.add(JMeterElements.httpSampler(secondPath, GET, null)); String thirdPath = "webapi/questions?courseid=${courseId}&fsname=${fsname}&intent=STUDENT_SUBMISSION"; threadGroup.add(JMeterElements.httpSampler(thirdPath, GET, null)); return testPlan; }</code><technical_language>Is reason name path firstPath, secondPath on</technical_language>

Target:
protected ListedHashTree getLnpTestPlan() { ListedHashTree testPlan = new ListedHashTree(JMeterElements.testPlan()); HashTree threadGroup = testPlan.add( JMeterElements.threadGroup(NUMBER_OF_USER_ACCOUNTS, RAMP_UP_PERIOD, 1)); threadGroup.add(JMeterElements.csvDataSet(getPathToTestDataFile(getCsvConfigPath()))); threadGroup.add(JMeterElements.cookieManager()); threadGroup.add(JMeterElements.defaultSampler()); threadGroup.add(JMeterElements.onceOnlyController()) .add(JMeterElements.loginSampler()); String getSessionsPath = "webapi/student?courseid=${courseId}"; threadGroup.add(JMeterElements.httpSampler(getSessionsPath, GET, null)); String getSessionDetailsPath = "webapi/session?courseid=${courseId}&fsname=${fsname}&intent=STUDENT_SUBMISSION"; threadGroup.add(JMeterElements.httpSampler(getSessionDetailsPath, GET, null)); String getQuestionsPath = "webapi/questions?courseid=${courseId}&fsname=${fsname}&intent=STUDENT_SUBMISSION"; threadGroup.add(JMeterElements.httpSampler(getQuestionsPath, GET, null)); return testPlan; }
Source:
<code>public OutputStream encodingStream(final Writer out) { checkNotNull(out); return new OutputStream() { int bitBuffer = 0; int bitBufferLength = 0; int writtenChars = 0; @Override public void write(int b) throws IOException { bitBuffer <<= 8; bitBuffer |= b & 0xFF; bitBufferLength += 8; while (bitBufferLength >= alphabet.bitsPerChar) { int charIndex = (bitBuffer >> (bitBufferLength - alphabet.bitsPerChar)) & alphabet.mask; out.write(alphabet.encode(charIndex)); writtenChars++; bitBufferLength -= alphabet.bitsPerChar; } } @Override public void flush() throws IOException { out.flush(); } @Override public void close() throws IOException { if (bitBufferLength > 0) { int charIndex = (bitBuffer << (alphabet.bitsPerChar - bitBufferLength)) & alphabet.mask; out.write(alphabet.encode(charIndex)); writtenChars++; if (paddingChar != null) { while (writtenChars % alphabet.charsPerChunk != 0) { out.write(paddingChar.charValue()); writtenChars++; } } } <START> bitBufferLength = 0; <END> out.close(); } }; }</code><technical_language>move this increment writtenChars (so, in case write of padding character fails re-close stream anyway, get correctly)</technical_language>

Target:
public OutputStream encodingStream(final Writer out) { checkNotNull(out); return new OutputStream() { int bitBuffer = 0; int bitBufferLength = 0; int writtenChars = 0; @Override public void write(int b) throws IOException { bitBuffer <<= 8; bitBuffer |= b & 0xFF; bitBufferLength += 8; while (bitBufferLength >= alphabet.bitsPerChar) { int charIndex = (bitBuffer >> (bitBufferLength - alphabet.bitsPerChar)) & alphabet.mask; out.write(alphabet.encode(charIndex)); writtenChars++; bitBufferLength -= alphabet.bitsPerChar; } } @Override public void flush() throws IOException { out.flush(); } @Override public void close() throws IOException { if (bitBufferLength > 0) { int charIndex = (bitBuffer << (alphabet.bitsPerChar - bitBufferLength)) & alphabet.mask; out.write(alphabet.encode(charIndex)); writtenChars++; bitBufferLength = 0; if (paddingChar != null) { while (writtenChars % alphabet.charsPerChunk != 0) { out.write(paddingChar.charValue()); writtenChars++; } } } out.close(); } }; }
Source:
<code>private void handleUncaughtThrowable(Throwable t) { if (errored.compareAndSet(false, true)) { log.error("unrecoverable error in task feeder or one of its mapper threads. immediately halting jvm", t); <START> Runtime.getRuntime().halt(1); <END> } }</code><technical_language>new method in basis replace this</technical_language>

Target:
private void handleUncaughtThrowable(Throwable t) { if (errored.compareAndSet(false, true)) { log.error("unrecoverable error in task feeder or one of its mapper threads. immediately halting jvm", t); Shutdown.exit(1); } }
Source:
<code>public static HttpMethod createHttpMethod(String httpMethodString) { if (METHOD_GET.equals(httpMethodString)) { return HttpMethod.GET; } else if (METHOD_PUT.equals(httpMethodString)) { return HttpMethod.PUT; } else if (METHOD_POST.equals(httpMethodString)) { <START> return HttpMethod.POST; <END> } else if (METHOD_DELETE.equals(httpMethodString)) { return HttpMethod.DELETE; } else { throw new IllegalArgumentException("given httpMethod '" + httpMethodString + "' is unknown"); } }</code><technical_language>a proposal: java import static org.eclipse.jetty.http.HttpMethod.*; ... ... public static HttpMethod createHttpMethod(String httpMethodString) { Predicate<HttpMethod> isMethodAllowed = m -> m == GET || m == POST || m == PUT || m == DELETE; return Optional.ofNullable(HttpMethod.fromString(httpMethodString)) .filter(isMethodAllowed) .orElseThrow(new IllegalArgumentException("Given HTTP Method '" + httpMethodString + "' is unknown")); }</technical_language>

Target:
public static HttpMethod createHttpMethod(String httpMethodString) { return Optional.ofNullable(HttpMethod.fromString(httpMethodString)) .filter(m -> m == GET || m == POST || m == PUT || m == DELETE) .orElseThrow(() -> new IllegalArgumentException("Given HTTP Method '" + httpMethodString + "' is unknown")); }
Source:
<code>static void beginEnqueueingWork(Context context, String osNotificationId, int androidNotificationId, String jsonPayload, boolean isRestoring, long timestamp, boolean isHighPriority) { Data inputData = new Data.Builder() .putInt(ANDROID_NOTIF_ID_WORKER_DATA_PARAM, androidNotificationId) .putString(JSON_PAYLOAD_WORKER_DATA_PARAM, jsonPayload) .putLong(TIMESTAMP_WORKER_DATA_PARAM, timestamp) .putBoolean(IS_RESTORING_WORKER_DATA_PARAM, isRestoring) .build(); OneTimeWorkRequest workRequest = new OneTimeWorkRequest.Builder(NotificationWorker.class) .setInputData(inputData) .build(); if (!Strings.isEmptyOrWhitespace(osNotificationId)) { <START> if (notificationIds.contains(osNotificationId)) { <END> OneSignal.Log(OneSignal.LOG_LEVEL.DEBUG, "OSNotificationWorkManager notification with notificationId: " + osNotificationId + " already queued"); return; } else { notificationIds.add(osNotificationId); } } OneSignal.Log(OneSignal.LOG_LEVEL.DEBUG, "OSNotificationWorkManager enqueueing notification work with notificationId: " + osNotificationId + " and jsonPayload: " + jsonPayload); WorkManager.getInstance(context) .enqueueUniqueWork(osNotificationId, ExistingWorkPolicy.KEEP, workRequest); }</code><technical_language>combine this logic OneSignal.isDuplicateNotification somehow? obvious ways of checking for duplicates</technical_language>

Target:
static void beginEnqueueingWork(Context context, String osNotificationId, int androidNotificationId, String jsonPayload, boolean isRestoring, long timestamp, boolean isHighPriority) { Data inputData = new Data.Builder() .putInt(ANDROID_NOTIF_ID_WORKER_DATA_PARAM, androidNotificationId) .putString(JSON_PAYLOAD_WORKER_DATA_PARAM, jsonPayload) .putLong(TIMESTAMP_WORKER_DATA_PARAM, timestamp) .putBoolean(IS_RESTORING_WORKER_DATA_PARAM, isRestoring) .build(); OneTimeWorkRequest workRequest = new OneTimeWorkRequest.Builder(NotificationWorker.class) .setInputData(inputData) .build(); OneSignal.Log(OneSignal.LOG_LEVEL.DEBUG, "OSNotificationWorkManager enqueueing notification work with notificationId: " + osNotificationId + " and jsonPayload: " + jsonPayload); WorkManager.getInstance(context) .enqueueUniqueWork(osNotificationId, ExistingWorkPolicy.KEEP, workRequest); }
Source:
<code>public Domain domain(final String name) { final Domain domain = this.origin.domain(name); return new Domain() { @Override public void create() { domain.create(); } @Override public void drop() { domain.drop(); } @Override public String name() { return domain.name(); } @Override public Item item(final String name) { return domain.item(name); } @Override public Iterable<Item> select(final SelectRequest request) { return new Iterable<Item>() { @Override public Iterator<Item> iterator() { return Iterators.filter( domain.select(request).iterator(), new Predicate<Item>() { @Override public boolean apply(final Item item) { <START> return Long.parseLong(item.get("time")) <END> < SanitizedDomains.this.limit; } } ); } }; } }; }</code><technical_language>in time attribute parsed new Time(item.get("time"))</technical_language>

Target:
public Domain domain(final String name) { final Domain domain = this.origin.domain(name); return new Domain() { @Override public void create() { domain.create(); } @Override public void drop() { domain.drop(); } @Override public String name() { return domain.name(); } @Override public Item item(final String name) { return domain.item(name); } @Override public Iterable<Item> select(final SelectRequest request) { return new Iterable<Item>() { @Override public Iterator<Item> iterator() { return Iterators.filter( domain.select(request).iterator(), new Predicate<Item>() { @Override public boolean apply(final Item item) { final boolean good = SanitizedDomains.this.good(item); if (!good) { item.clear(); } return good; } } ); } }; } }; }
Source:
<code>private void init( final OutputStream output, final SAMFileHeader header, final boolean writeHeader, final TaskAttemptContext ctx) throws IOException { origOutput = output; refSource = new ReferenceSource(Paths.get(URI.create(ctx.getConfiguration().get(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY)))); <START> if (null != header) { <END> cramContainerStream = new CRAMContainerStreamWriter(origOutput, null, refSource, header, HadoopBAMID); if (writeHeader) { this.writeHeader(header); } } }</code><technical_language>Nit: style header != null in this codebase</technical_language>

Target:
private void init( final OutputStream output, final SAMFileHeader header, final boolean writeHeader, final TaskAttemptContext ctx) throws IOException { origOutput = output; final URI referenceURI = URI.create( ctx.getConfiguration().get(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY) ); refSource = new ReferenceSource(Paths.get(referenceURI)); if (header != null) { cramContainerStream = new CRAMContainerStreamWriter( origOutput, null, refSource, header, HADOOP_BAM_PART_ID); if (writeHeader) { this.writeHeader(header); } } }
Source:
<code>public void enterImage() { <START> clickOn(addMediaButton); <END> clickOn(mediaLibraryButton); if (isElementDisplayed(allowMediaAccessButton)) { clickOn(allowMediaAccessButton); } onView(withIndex(withId(R.id.media_grid_item_image), 0)).perform(click()); clickOn(confirmButton); if (isElementDisplayed(onView(withText("LEAVE OFF")))) { clickOn(onView(withText("LEAVE OFF")).inRoot(isDialog())); } }</code><technical_language>a failure testPublishFullPost this step test is a long press media icon instead of a regular tap. I remember this happening I worked Espresso tests in I remember if a avoid it; this happen before</technical_language>

Target:
public void enterImage() { String addMediaButtonId = "media_button_container"; clickOn(addMediaButtonId); String mediaBarButtonId = "media_bar_button_library"; clickOn(mediaBarButtonId); if (isElementDisplayed(allowMediaAccessButton)) { clickOn(allowMediaAccessButton); } onView(withIndex(withId(R.id.media_grid_item_image), 0)).perform(click()); clickOn(confirmButton); if (isElementDisplayed(onView(withText("LEAVE OFF")))) { clickOn(onView(withText("LEAVE OFF")).inRoot(isDialog())); } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { PlotCommit commit = (PlotCommit) getSelection(getPage()).getFirstElement(); final Repository repository = getRepository(event); if (repository == null) return null; String currentBranch = getCurrentBranch(repository); final Ref ref = getRef(commit, repository, currentBranch); String jobname = NLS.bind( UIText.RebaseCurrentRefCommand_RebasingCurrentJobName, currentBranch, ref.getName()); <START> RebaseCurrentRefCommand rebaseCurrentRef = new RebaseCurrentRefCommand( <END> jobname) { @Override public RebaseOperation createRebaseOperation(ExecutionEvent event2) throws ExecutionException { return new RebaseOperation(repository, ref); } }; rebaseCurrentRef.execute(event); return null; }</code><technical_language>t is unnecessary instantiate this concrete class. need dialogMessage else. AbstractRebaseCommandHandler rebaseCurrentRef = new AbstractRebaseCommandHandler( jobname, UIText.RebaseCurrentRefCommand_RebaseCanceledMessage) { instead</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { PlotCommit commit = (PlotCommit) getSelection(getPage()).getFirstElement(); final Repository repository = getRepository(event); if (repository == null) return null; String currentBranch = getCurrentBranch(repository); final Ref ref = getRef(commit, repository, currentBranch); String jobname = NLS.bind( UIText.RebaseCurrentRefCommand_RebasingCurrentJobName, currentBranch, ref.getName()); AbstractRebaseCommandHandler rebaseCurrentRef = new AbstractRebaseCommandHandler( jobname, UIText.RebaseCurrentRefCommand_RebaseCanceledMessage) { @Override protected RebaseOperation createRebaseOperation( ExecutionEvent event2) throws ExecutionException { return new RebaseOperation(repository, ref); } }; rebaseCurrentRef.execute(event); return null; }
Source:
<code>public StepExecutionResult execute(ExecutionContext context) throws IOException, InterruptedException { Path filePath = filesystem.resolve(input); try { for (FileScrubber scrubber : scrubbers) { try (FileChannel channel = readWriteChannel(filePath)) { if (scrubber instanceof FileContentsScrubber) { ((FileContentsScrubber) scrubber).scrubFile(channel); } else if (scrubber instanceof FileAttributesScrubber) { ((FileAttributesScrubber) scrubber).scrubFileWithPath(filePath); } } } } catch (FileContentsScrubber.ScrubException e) { context.logError(e, "Error scrubbing non-deterministic metadata from %s", filePath); <START> } <END> return StepExecutionResults.SUCCESS; }</code><technical_language>deterministic builds extremely important for of Buck users of core principles Buck's philosophy, this change uncomfortable. If cgo binaries important for project, please consider fixing scrubber, if not, consider rid of them. a compromise, consider adding a flag controls behavior in case of scrubber failures preserves existing behavior of failing default switched a forgiving mode</technical_language>

Target:
public StepExecutionResult execute(ExecutionContext context) throws IOException, InterruptedException { Path filePath = filesystem.resolve(input); try { for (FileScrubber scrubber : scrubbers) { try (FileChannel channel = readWriteChannel(filePath)) { if (scrubber instanceof FileContentsScrubber) { ((FileContentsScrubber) scrubber).scrubFile(channel); } else if (scrubber instanceof FileAttributesScrubber) { ((FileAttributesScrubber) scrubber).scrubFileWithPath(filePath); } } } } catch (FileContentsScrubber.ScrubException e) { context.logError(e, "Error scrubbing non-deterministic metadata from %s", filePath); return StepExecutionResults.ERROR; } return StepExecutionResults.SUCCESS; }
Source:
<code>public PagesSpatialIndex get() { if (rtree.isEmpty()) { return EMPTY_INDEX; } <START> else { <END> return new PagesRTreeIndex(session, addresses, types, outputChannels, channels, rtree, spatialRelationshipTest, filterFunctionFactory); } }</code><technical_language>else needed</technical_language>

Target:
public PagesSpatialIndex get() { if (rtree.isEmpty()) { return EMPTY_INDEX; } return new PagesRTreeIndex(session, addresses, types, outputChannels, channels, rtree, spatialRelationshipTest, filterFunctionFactory); }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { RepositoryGroups groupsUtil = RepositoryGroups.getInstance(); RepositoryGroup group; try { group = groupsUtil.createGroup(newGroupName(groupsUtil)); } catch (IllegalStateException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } List<File> repoDirs = getSelectedRepositories(event); if (!repoDirs.isEmpty()) { groupsUtil.addRepositoriesToGroup(group, repoDirs); } CommonViewer viewer = getView(event).getCommonViewer(); viewer.refresh(); <START> RepositoryGroupNode groupNode = new RepositoryGroupNode(group); viewer.setSelection(new StructuredSelection(groupNode), true); viewer.expandToLevel(groupNode, 1); <END> IStructuredSelection sel = viewer.getStructuredSelection(); viewer.editElement(sel.getFirstElement(), 0); return null; }</code><technical_language>this call getView(event).expandNodeForGroup(group); instead</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { RepositoryGroups groupsUtil = RepositoryGroups.getInstance(); RepositoryGroup group; try { group = groupsUtil.createGroup(newGroupName(groupsUtil)); } catch (IllegalStateException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } List<File> repoDirs = getSelectedRepositories(event); if (!repoDirs.isEmpty()) { groupsUtil.addRepositoriesToGroup(group, repoDirs); } RepositoriesView view = getView(event); CommonViewer viewer = view.getCommonViewer(); viewer.refresh(); RepositoryGroupNode groupNode = new RepositoryGroupNode(group); viewer.setSelection(new StructuredSelection(groupNode), true); view.expandNodeForGroup(group); IStructuredSelection sel = viewer.getStructuredSelection(); viewer.editElement(sel.getFirstElement(), 0); return null; }
Source:
<code><START> public String getEditText() { <END> return textArea.getAttribute("value"); }</code><technical_language>this private method if resign form separate method</technical_language>

Target:
private String getEditText() { return editArea.getAttribute("value"); }
Source:
<code><START> @Deprecated public Integer getRotation() { <END> return rotation; }</code><technical_language>This is in App: <LINK_0></technical_language>

Target:
public Integer getRotation() { return rotation; }
Source:
<code>private void assertStatus(final ClusterMemberStatus s, TransportEndpoint[] members) { Predicate<ClusterMember> predicate = new Predicate<ClusterMember>() { @Override public boolean apply(@Nullable ClusterMember input) { <START> return input != null && input.status() == s; <END> } }; Function<ClusterMember, TransportEndpoint> function = new Function<ClusterMember, TransportEndpoint>() { @Override public TransportEndpoint apply(ClusterMember input) { return input.endpoint(); } }; List<TransportEndpoint> list = newArrayList(transform(filter(target.members(), predicate), function)); assertEquals("expect " + s + ": " + list, members.length, list.size()); for (TransportEndpoint member : members) { assertTrue("expect " + s + ": " + member, list.contains(member)); } }</code><technical_language>is nullable</technical_language>

Target:
private void assertStatus(final ClusterMemberStatus s, TransportEndpoint[] members) { Predicate<ClusterMember> predicate = new Predicate<ClusterMember>() { @Override public boolean apply(ClusterMember input) { return input.status() == s; } }; Function<ClusterMember, TransportEndpoint> function = new Function<ClusterMember, TransportEndpoint>() { @Override public TransportEndpoint apply(ClusterMember input) { return input.endpoint(); } }; List<TransportEndpoint> list = newArrayList(transform(filter(target.members(), predicate), function)); assertEquals("expect " + s + ": " + list, members.length, list.size()); for (TransportEndpoint member : members) { assertTrue("expect " + s + ": " + member, list.contains(member)); } }
Source:
<code>public ReminderThread(Context context) { valueToKey = new HashMap<>(); keyToValue = new HashMap<>(); this.mContext = context; runnable = new Runnable() { @Override public void run() { XPathExpression condition; try{ condition = XPathParseTool.parseXPath(xPathConditionString); }catch (Exception e){ e.printStackTrace(); return; } Hashtable<String, DataInstance> instances = new Hashtable<>(); <START> instances.put("casedb", new ExternalDataInstance("jr://instance/casedb","casedb")); <END> EvaluationContext ec = CommCareApplication._().getCurrentSessionWrapper().getEvaluationContext(instances); String caseXPathRef = "instance('casedb')/casedb/case[@case_type='" + caseTypeString + "']"; TreeReference caseType = XPathReference.getPathExpr(caseXPathRef).getReference(); List<TreeReference> refs = ec.expandReference(caseType); while(mContinuePolling) { long current = System.currentTimeMillis(); for(TreeReference ref : refs) { EvaluationContext internal = new EvaluationContext(ec, ref); Log.d("Result", condition.eval(internal).toString()); if((Boolean) condition.eval(internal)){ playNoise(); } } long delay = (System.currentTimeMillis() - current); try { Thread.sleep(sleepTime * 1000 - delay); System.out.println("Sleeping for" + String.valueOf(sleepTime*1000-delay)); sleepTime *= 2; } catch (InterruptedException e) { e.printStackTrace(); mContinuePolling = false; } } } }; myThread = new Thread(runnable); }</code><technical_language>This good bootstrap for testing, I want move loading "connector" objects driven data Alert object itself. if want some pointers for set up</technical_language>

Target:
public ReminderThread(Context context) { this.mContext = context; runnable = new Runnable() { @Override public void run() { try{ evalulateAlertExpressions(); }catch(Exception e){ mContinuePolling = false; System.out.println("Stopping thread"); if(!Thread.interrupted()){ showNotification("Alerts have stopped because of an error!"); } } } }; myThread = new Thread(runnable); }
Source:
<code>public void testAggregator() throws Exception { mMetricsMaster.addAggregator( new SumInstancesAggregator("metricA", MetricsSystem.InstanceType.WORKER, "metricA")); mMetricsMaster.addAggregator( new SumInstancesAggregator("metricB", MetricsSystem.InstanceType.WORKER, "metricB")); List<Metric> metrics1 = Lists.newArrayList( Metric.from("worker.192_1_1_1.metricA", 10, MetricType.GAUGE), Metric.from("worker.192_1_1_1.metricB", 20, MetricType.GAUGE)); mMetricsMaster.workerHeartbeat("192_1_1_1", metrics1); List<Metric> metrics2 = Lists.newArrayList( Metric.from("worker.192_1_1_2.metricA", 1, MetricType.GAUGE), Metric.from("worker.192_1_1_2.metricB", 2, MetricType.GAUGE)); mMetricsMaster.workerHeartbeat("192_1_1_2", metrics2); <START> waitForAndCheckResult(() -> (Long) getGauge("metricA") == 11L); <END> assertEquals(22L, getGauge("metricB")); List<Metric> metrics3 = Lists.newArrayList( Metric.from("worker.192_1_1_2.metricA", 3, MetricType.GAUGE)); mMetricsMaster.workerHeartbeat("192_1_1_2", metrics3); waitForAndCheckResult(() -> (Long) getGauge("metricA") == 13L); assertEquals(20L, getGauge("metricB")); }</code><technical_language>do some of asserts this wait()? Is a wait for update happen, do original asserts? confusing determine assert wait call in order</technical_language>

Target:
public void testAggregator() throws Exception { mMetricsMaster.addAggregator( new SumInstancesAggregator("metricA", MetricsSystem.InstanceType.WORKER, "metricA")); mMetricsMaster.addAggregator( new SumInstancesAggregator("metricB", MetricsSystem.InstanceType.WORKER, "metricB")); List<Metric> metrics1 = Lists.newArrayList( Metric.from("worker.192_1_1_1.metricA", 10, MetricType.GAUGE), Metric.from("worker.192_1_1_1.metricB", 20, MetricType.GAUGE)); mMetricsMaster.workerHeartbeat("192_1_1_1", metrics1); List<Metric> metrics2 = Lists.newArrayList( Metric.from("worker.192_1_1_2.metricA", 1, MetricType.GAUGE), Metric.from("worker.192_1_1_2.metricB", 2, MetricType.GAUGE)); mMetricsMaster.workerHeartbeat("192_1_1_2", metrics2); checkMetricValue("metricA", 11L); checkMetricValue("metricB", 22L); List<Metric> metrics3 = Lists.newArrayList( Metric.from("worker.192_1_1_2.metricA", 3, MetricType.GAUGE)); mMetricsMaster.workerHeartbeat("192_1_1_2", metrics3); checkMetricValue("metricA", 13L); checkMetricValue("metricB", 20L); }
Source:
<code>public void heartbeat() { if (mClosed) { return; } mThread.set(Thread.currentThread()); try { mBlockStore.checkStorage(); } catch (Exception e) { <START> LOG.warn("Failed to check storage: {}", e.toString()); <END> LOG.debug("Exception: ", e); } mThread.set(null); }</code><technical_language>try swapping lines in DefaultBlockWorker::stop() instead of this logic? // Stop heart-beat executors clients. mResourceCloser.close(); // Stop base. (closes executors.) super.stop();</technical_language>

Target:
public void heartbeat() { try { mBlockStore.checkStorage(); } catch (Exception e) { LOG.warn("Failed to check storage: {}", e.toString()); LOG.debug("Exception: ", e); } }